vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Passing variable custom template - how? (Anyone here?) (https://vborg.vbsupport.ru/showthread.php?t=70762)

xlguy 10-19-2004 11:32 AM

Passing variable custom template - how? (Anyone here?)
 
vb3.0.3

In my .php file I have this:

PHP Code:

if($bbuserinfo['userid']) 
      { 
          eval(
'$vbboxtop = "' fetch_template('vbboxtop') . '";'); 
          eval(
'$vbboxbot = "' fetch_template('vbboxbot') . '";'); 
          eval(
'print_output("' fetch_template('premier') . '");');
      } 
      else 
      { 
          
print_no_permission();
      } 

Is there anyway of passing some details to the vbboxtop template (that's a custom one I made). I would like to specify a page title and pass that to vbboxtop. So my .php code might look like this:

PHP Code:

if($bbuserinfo['userid']) 
      { 
          
$mypagetitle "This is the title";
          eval(
'$vbboxtop = "' fetch_template('vbboxtop') . '";'); XX pass $mypagetitle
          
eval('$vbboxbot = "' fetch_template('vbboxbot') . '";'); 
          eval(
'print_output("' fetch_template('premier') . '");');
      } 
      else 
      { 
          
print_no_permission();
      } 

I need to know how to pass $mypagetitle to vbboxtop. That way when I edit the template in the AdminCP I can put $mypagetitle in the template and it will change the title depending on which of my custom .php pages is calling it.

Hope this makes sense... I know this site is quiet but any help would be great.

Colin F 10-19-2004 11:41 AM

It seems what you did is right.

Just make sure the variable has a value, and then call it in the script using $mypagetitle

xlguy 10-19-2004 11:43 AM

What I want to do is include $mypagetitle in a *template* in AdminCP not another .php file. I can't work out how you can pass variables to use in the templates. That's my question. Thanks :)

xlguy 10-19-2004 11:51 AM

That's odd, I just tried it again and now it works... ROFL!

In my template I have:

Code:

<div align="center">
<div class="page" style="width:100%; text-align:left">
<div style="padding:0px 10px 0px 10px">

<table cellpadding="4" cellspacing="2" border="0" width="100%" align="center">
<thead><tr align="center"> <td class="thead" width="100%" align="left">$custompagetitle</td></tr></thead>
<tbody>
<tr>
 <td class="alt1" align="left">

And I call it using:

PHP Code:

if($bbuserinfo['userid']) 
      { 
          
$custompagetitle "This is the title"
          eval(
'$vbboxtop = "' fetch_template('vbboxtop') . '";');
          eval(
'$vbboxbot = "' fetch_template('vbboxbot') . '";'); 
          eval(
'print_output("' fetch_template('premier') . '");'); 
      } 
      else 
      { 
          
print_no_permission(); 
      } 

And it now works... which is strange/good. I guess that $custompagetitle is made available in all 3 templates I call now? Is that ok or should I do it in another way?

Colin F 10-19-2004 12:26 PM

Exactly, all the $variables that have a value which is set before the call are available, because of the eval() I think.


All times are GMT. The time now is 05:32 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.01908 seconds
  • Memory Usage 1,729KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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