vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   can't get variable to output? (https://vborg.vbsupport.ru/showthread.php?t=287874)

Mickie D 09-15-2012 07:23 PM

can't get variable to output?
 
Hi,

I am having an issue with a variable I want to call.

PHP Code:

$adss "CHECK THIS OUT";

vB_Template::preRegister('navbar',array('adss' => $adss)); 

Nothing shows up using

{vb:raw adss}

in the navbar template.

To be honest I did this just to test the variable, which I am sure should display??

I really wanted to call a custom code from the database using the forumid, but I guess I should get it outputting first

Thank you for any advice

Regards
Mick

kh99 09-15-2012 07:38 PM

Your code looks right, but where did you put it? If it's in a plugin using a hook that is called after the navbar is constructed then that might be the problem.

Mickie D 09-15-2012 07:41 PM

ahhh its in the showthread complete hook.

I wanted to pull data from the database (forum table) and output it in the navbar.

I have unique data for each forum (forum.un_data), I wanted to display this on the navbar?

Would that be possible?

Thank you very much for your help.

Mick

Scanu 09-15-2012 07:46 PM

showthread_complete is too late

--------------- Added [DATE]1347742066[/DATE] at [TIME]1347742066[/TIME] ---------------

I don't know if it's possible but you can try to use this on navbar

{vb:raw global.forumid} (is it correct Kevin?)

kh99 09-15-2012 07:53 PM

Yeah, showthread_getinfo looks like a good one, it's after a lot of checks that might send the user somewhere else, but it's before the navbar is made. And you can use $threadinfo['forumid'] to know which forum you're in.

Mickie D 09-15-2012 08:01 PM

KH99 you are the man!!

Thank you, I am going to try and pull the data from my custom forum info table.

I was thinking something simple like

PHP Code:

$adss $forum['un_data'];

vB_Template::preRegister('navbar',array('adss' => $adss)); 

But was wondering if I would need to make my table (forum.un_data) preregistered ?

Thanks again Kevin you are a really big help.

Mick

kh99 09-15-2012 08:10 PM

Oh, I see now, you already have the forum data available. Anyway, I'm not quite sure what you're asking but I think the answer is no, if you use the code you're showing there it should work without registering anything else.

Mickie D 09-15-2012 08:20 PM

Hi Kevin,

I am trying to pull data onto the navbar from a custom field in the forum table.

I have created a field called un_data

I can enter different data into each forum.un_data.

I will have a go, thanks for your help.

Mick

--------------- Added [DATE]1347749920[/DATE] at [TIME]1347749920[/TIME] ---------------

Hi all,

I have been working on outputting my code.

PHP Code:

$results $vbulletin->db->query_read("SELECT adss FROM ".TABLE_PREFIX."forum WHERE forumid = $forumid");

$adss $results;

vB_Template::preRegister('navbar',array('adss' => $adss)); 

The code just outputs
RESOURCE ID 52

Its not taking the data from adss in the database?

thanks again for all the help.

Mick

--------------- Added [DATE]1347790989[/DATE] at [TIME]1347790989[/TIME] ---------------

I got this working!

It has been a long time since I messed with mysql, and you need to do something with the data lol (mysql_fetch_row - etc), it was stuck in a resource and I forgot to add the code to deal with the array.

Thanks
Mick


All times are GMT. The time now is 04:59 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01626 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete