Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2012, 07:23 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 09-15-2012, 07:38 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 09-15-2012, 07:41 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 09-15-2012, 07:46 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?)
Reply With Quote
  #5  
Old 09-15-2012, 07:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 09-15-2012, 08:01 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 09-15-2012, 08:10 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 09-15-2012, 08:20 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:52 PM.


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.05179 seconds
  • Memory Usage 2,232KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete