vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   $foruminfo variables in ad location templates? (https://vborg.vbsupport.ru/showthread.php?t=294433)

curriertech 01-27-2013 01:24 AM

$foruminfo variables in ad location templates?
 
I've added a column to the forum table and can reference the value in a conditional via $foruminfo[varname] in the forumdisplay template but what I really want to do is use it in the ad location templates. How can I get this to work? More info on what I've done is here: https://vborg.vbsupport.ru/showthread.php?t=294400

Lynne 01-27-2013 03:09 AM

I don't believe you can use conditions in the Ad Manager.

curriertech 01-27-2013 11:27 AM

I'm not using the ad manager, I'm using the ad location templates such as ad_navbar_below.

kh99 01-27-2013 12:24 PM

I think the problem might be that $foruminfo isn't registered to the ad templates (as you mentioned in the other thread). To do that you'd use a plugin on hook parse_templates and code like:
Code:

global $foruminfo;
vB_Template::preRegister('template_name', array('hideads' => $foruminfo['hideads']));


(of course you'd use the actual termplate name). Then in the template you'd check $hideads.

curriertech 01-27-2013 12:37 PM

Thanks Kevin, I was sure it was a matter of preregistering something but I couldn't for the life of me figure out which var and hook. This worked like a charm, thank you!

kh99 01-27-2013 12:56 PM

Oh, I also meant to mention this: if $foruminfo is a global variable you might be able to do it without an extra plugin, like this:

Code:

<vb:if condition="$GLOBALS['foruminfo']['hideads']">

curriertech 01-27-2013 12:58 PM

Quote:

Originally Posted by kh99 (Post 2399849)
Oh, I also meant to mention this: if $foruminfo is a global variable you might be able to do it without an extra plugin, like this:

Code:

<vb:if condition="$GLOBALS['foruminfo']['hideads']">

I'll give this a shot, thank you. I did try with $GLOBALS but I had the syntax of the rest of it very, very wrong. :D

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

Works perfectly, thanks again Kevin!


All times are GMT. The time now is 07:02 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.01110 seconds
  • Memory Usage 1,721KB
  • 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_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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