vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to get a template var from one template to also be usable in another CMS template (https://vborg.vbsupport.ru/showthread.php?t=240023)

L2V 04-07-2010 11:09 PM

How to get a template var from one template to also be usable in another CMS template
 
I have been working on some conditionals for my navbar template that show a different image depending on the section of the site they are in.

In the CMS, how can I get {vb:var parenttitle} from the vbcms_content_article_preview template so that it is also accessible in the navbar template?

L2V 04-09-2010 12:19 AM

WooHoo! I got it working. I hate editing php files but it gets me what I need...

To do this, I used the fix at http://www.vbulletin.com/forum/proje...?issueid=37252 and modified it to get the parentid for my conditional.

open /packages/vbcms/controller/content.php
Around line 93 ( after protected function authorizeAction() { ) add
Code:

vB::$vbulletin->parentid = $this->node->getParentId();
As an example, let's say you want a graphic to appear in the navbar template of any CMS page that belongs within a section with id# 5, in your template you can use :
Code:

<vb:if condition="$vbulletin->parentid == 5">........</vb:if>
As mentioned, I hate modifying php files since I will have to redo this every time I upgrade. Anyone know how to make this into a plug-in type thing?


All times are GMT. The time now is 02:29 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.00961 seconds
  • Memory Usage 1,710KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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