Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] Rendering templates and registering variables - a short guide
cellarius's Avatar
cellarius
Join Date: Aug 2005
Posts: 1,987

 

Show Printable Version Email this Page Subscription
cellarius cellarius is offline 11-15-2009, 10:00 PM

Introduction

Starting with vB4, templates no longer get output using eval:
PHP Code:
eval('$mytemplate = "' fetch_template('mytemplate') . '";'); 
is outdated.
What's more: Variables and arrays from plugins that are executed on a page no longer can automatically be accessed in the templates of that page. They need to be registered first.
.
Basic functionality to render templates and register all variables/arrays you want to use inside

PHP Code:
/* Some Code, setting variables, (multidimensional) array */
$my_var "abc";
$my_array = array(
        
'key1' => 'value1',
        
'key2' => array(
                '
key21' => 'value21',
                '
key22' => 'value22'
        '
)
    );

/* render template and register variables */
$templater vB_Template::create('mytemplate');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$templater->render(); 
  • The first line provides the template that is to be rendered, using the new vB_Template class (vB_Template::create). The method gets passed the name of the template as an argument.
  • The following two lines register a variable and an array that we want to use in our template. Arguments passed are 1. the name you want to use to access the variable, and 2. the variable from the code you want to register. You can register as many variables/arrays as you want. Just remember you have to register every variable and array that you want to use in your custom template in this way. If you don't register them, they will not be available.
  • The fourth line renders the template ($templater->render()).
In the template you know will be able to use the registered variables/arrays in this way:
HTML Code:
{vb:raw my_var}
{vb:raw my_array.key1}
{vb:raw my_array.key2.key21}
Note the last one: multidimensional arrays are perfectly possible.
.
.
.
Now, with the result of the rendering we can do several things:
.
Output template directly - custom pages


PHP Code:
$templater vB_Template::create('mytemplate');
    
$templater->register_page_templates(); 
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
print_output($templater->render()); 
This immediatly outputs the template. Use this if you have created your own page, for example.
Note the second line, which is special for this type of use:
PHP Code:
$templater->register_page_templates(); 
This auto-registers the page level templates header, footer and headinclude that you will use in the template of your custom page.
.
Use a template hook


PHP Code:
$templater vB_Template::create('mytemplate');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$template_hook[forumhome_wgo_pos2] .= $templater->render(); 
The template will be shown using the choosen template hook (for example: $template_hook[forumhome_wgo_pos2]). See the dot before the = in the last line? The hook may be used by other modifications, too, so we don't want to overwrite it, but rather append our code to it, conserving everything that might already be there.
.
Save into a variable for later use in custom template
PHP Code:
$templater vB_Template::create('mytemplate');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$mytemplate_rendered $templater->render(); 
Now we have saved the rendered template into a variable. This variable in turn we can later on register in another template, if we want:
PHP Code:
$templater vB_Template::create('my_other_template');
     
$templater->register('my_template_rendered'$my_template_rendered);
 
print_output($templater->render()); 
Again, inside my_other_template we now could call
HTML Code:
{vb:raw my_template_rendered}
If you're running the first template call inside a loop, you may want to use .= instead of = in the last line, so that the results of every loop get added instead of overwriting the existing. But that depends, of course.
.
Save into an array and preregister to use in an existing/stock template

PHP Code:
$templater vB_Template::create('mytemplate');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$templatevalues['my_insertvar'] = $templater->render();
vB_Template::preRegister('FORUMHOME'$templatevalues); 
  • This is another, more flexible method to save the rendered template into a variable for future use in an already existing template. In this example, we want to show our own rendered template on forumhome.
  • Problem is: We have no direct way to register variables for already existing templates like FORUMHOME. It's created and rendered in the files, and we don't want to mess there.
  • To help with this, a new method was created for vB_Template class, called preRegister. Using this, we can pass our data to FORUMHOME before it is rendered. Note that the data needs to be saved into an array ($templatevalues['my_insertvar']), a simple variable will throw an error. In the last line the array is preregistered; you need to pass as arguments 1. the name of the existing template and 2. the array that contains the data. Again, this can be done for as many arrays as needed.
  • Of course, the preRegister functionality can be used for any kind of variables or arrays, no matter whether you have saved a rendered template (like in our example) into it or it contains just a simple boolean true/false statement.
To access the data inside the template it was preregistered for use:
HTML Code:
{vb:raw my_insertvar}
Note: it is not {vb:raw templatevalues.my_insertvar}!

Essentially the same as what I put for preRegister would be the following two lines. They could replace the last two lines in the above php codebox:
PHP Code:
$my_insertvar $templater->render();
vB_Template::preRegister('FORUMHOME',array('my_insertvar ' => $my_insertvar)); 
Of course you could add further pairs to that array if you need to preregister more than one variable.
.
.
Bonus track: ...whatever you do, cache your templates!

Now you know how to get your templates on screen - once you succeeded in doing that, make sure to do it in a fast and ressource saving manner: make use of vB's template cache. To see whether your templates are cached or not, activate debug mode by adding $config['Misc']['debug'] = true;to your config.php (don't ever use that on your live site!). Among the debug info is a list of all templates called, and non-cached templates will show up in red.

To cache your templates, add a plugin at hook cache_templates with the following code:
PHP Code:
// for a single template
$cache[] = 'mytemplate'

// for more than one templates in one step
$cache array_merge((array)$cache,array(
    
'mytemplate',
    
'myothertemplate',
    
'mythirdtemplate'
)); 
.
.
Hope this helps!
-cel

----
Addendum - There are now two blog posts on vb.com related to this topic:
http://www.vbulletin.com/forum/entry...in-4-templates
http://www.vbulletin.com/forum/entry...-4-based-files
Reply With Quote
  #272  
Old 04-09-2013, 06:07 PM
ezak ezak is offline
 
Join Date: Nov 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Links and Download Modification is stoped supported because the author is died

I have problem in vb 4.2.0 can't register the variables

1- plugins
Name: Links and Downloads Manager - Add LDM to main vBulletin menu
Hooks: Prosses_templates_complete
code:
PHP Code:
    require_once(DIR '/includes/local_links_defns.php');

    if (
LDM_NAVBAR_LOCATION) {

        if (
defined('THIS_SCRIPT') and
                (
               
THIS_SCRIPT == LDM_LINKS_SCRIPT    or THIS_SCRIPT == 'local_links'
            
or THIS_SCRIPT == LDM_ACTION_SCRIPT    or THIS_SCRIPT == 'local_links_actions'
            
or THIS_SCRIPT == LDM_ADMIN_SCRIPT    or THIS_SCRIPT == 'local_links_admin'
            
or THIS_SCRIPT == LDM_SEARCH_SCRIPT    or THIS_SCRIPT == 'local_links_search'
                
)
            ) {
// Highlight ldm tab when in LDM - LDM code will create the actual tab and navbar
            
$vbulletin->options['selectednavtab'] = 'ldm';
        }
        else {
// Create the tab, no navbar needed
            
$templater vB_Template::create('links_navbar');
            
$templater->quickRegister(array(
                
'ldm_links_script'=>LDM_LINKS_SCRIPT,
                ));
            
$template_hook[LDM_NAVBAR_LOCATION] .= $templater->render();
        }

    } 

2- /includes/local_links_defns.php
PHP Code:
<?php

/* ===========================================================================*/
//
// This code is provided free on the basis that you do not claim that
// it is your own, sell it or use it as the basis for other products that you
// sell. But by all means extend it, modify it, upgrade it, correct it,
// suggest improvements, call me an idiot, etc.
//
// (c) 2004/10
// Andrew Dearing
// European Industrial Research Management Association
// www.eirma.org
//
// v3.0.2, 05.02.2010
// For VB4.0.x
// see changes.txt for history
// v1.00, 1.3.2004
//
/* ===========================================================================*/

// These definitions should correspond to the names of the main LDM scripts
// (held in the forums directory

define('LDM_LINKS_SCRIPT',        'local_links');
define('LDM_ACTION_SCRIPT',        'local_links_actions');
define('LDM_ADMIN_SCRIPT',        'local_links_admin');
define('LDM_RESIZE_SCRIPT',        'local_resize');
define('LDM_SEARCH_SCRIPT',        'local_links_search');
define('LDM_STREAM_SCRIPT',        'local_stream');

// This definition should be set to one of
//        'navtab_start', 'navtab_middle' or 'navtab_end'
// according to the location you want the entry to LDM to appear on the main vB navbar.
// Set the definition to the null strong '' if you do not want the entry to appear at all.

define('LDM_NAVBAR_LOCATION',    'navtab_middle');

?>
3- "links_navbar" template
PHP Code:
<vb:if condition="$vbulletin->options['selectednavtab'] == 'ldm'">

<
li class="selected">
    <
class="navtab" href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php{vb:raw session.sessionurl_q}">{vb:rawphrase ldm_vbmenu_ldm}</a>
    <
ul class="floatcontainer">
    <
li class="popupmenu">
    <
a href="javascript://" class="popupctrl">{vb:rawphrase ll_menu_cat}</a>
    <
ul class="popupbody popuphover">
    <
li>
    <
a href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php?{vb:raw session.sessionurl_q}">{vb:rawphrase ll_menu_home}</a>
    </
li>
<
vb:if condition="$show['ldm_add_category'] and $viewcatid>-2">
    <
li>
    <
a href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php?{vb:raw session.sessionurl_q}action=addcat&amp;catid={vb:raw  viewcatid}">{vb:rawphrase ll_menu_addcat}</a>
    </
li>
</
vb:if>
<
vb:if condition="$show['ldm_edit_category'] and $viewcatid>0">
    <
li>
    <
a href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php?{vb:raw session.sessionurl_q}action=editcat&amp;catid={vb:raw  viewcatid}">{vb:rawphrase ll_menu_editcat}</a></li>
</
vb:if>
    </
ul>
    </
li>

<
vb:if condition="$show['ldm_add_multi']">
    <
li class="popupmenu">
    <
a href="javascript://" class="popupctrl">{vb:rawphrase ll_entries}</a>
    <
ul class="popupbody popuphover">
    <
li id="ldm_navbar_addmulti">
    <
form action="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php" method="get">
    {
vb:rawphrase ll_menu_addmulti}
    <
input type="text" name="numadd" size="3" value="{vb:raw links_defaults.allow_add_multi}" />
    <
input type="hidden" name="action" value="addmultilink" />
    <
input type="hidden" name="catid" value="{vb:raw viewcatid}" />
    <
input type="submit" value="{vb:rawphrase ll_go}" name="submit" />
    </
form>
    </
li>
    </
ul>
    </
li>
<
vb:elseif condition="$show['ldm_add_link']" />
    <
li>
    <
a href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php?{vb:raw session.sessionurl}action=addlink&amp;catid={vb:raw viewcatid}">
    {
vb:rawphrase ll_menu_addlink}
    </
a>
    </
li>
</
vb:if>

    <
li class="popupmenu">
    <
a href="javascript://" class="popupctrl">{vb:rawphrase ll_menu_show}</a>
    <
ul class="popupbody popuphover">
<
vb:if condition="$show['ldm_mark_link']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.FAVS_CAT}">{vb:rawphrase ll_menu_showfav}</a></li>
</
vb:if>

<
vb:if condition="$show['ldm_add_link']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.MY_CAT}">{vb:rawphrase ll_menu_showmyl}</a></li>
</
vb:if>

<
vb:if condition="$show['ldm_star_links']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.NOM_CAT}">{vb:rawphrase ll_menu_shownominate}</a></li>
<
vb:if condition="$show['ldm_view_nominations']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.CNOM_CAT}">{vb:rawphrase ll_menu_showcnominate}</a></li>
</
vb:if>
</
vb:if>

    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.HOT_CAT}">{vb:rawphrase ll_menu_showhot}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.NEW_CAT}">{vb:rawphrase ll_menu_shownew}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.NEW_RATE}">{vb:rawphrase ll_menu_shownewrating}</a></li>

    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.RND_CAT}">{vb:rawphrase ll_menu_showrnd}</a></li>

<
vb:if condition="$show['ldm_admin_links']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.AVL_CAT}">{vb:rawphrase ll_menu_showavl}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.HIDE_CAT}">{vb:rawphrase ll_menu_showhid}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.BRKN_CAT}">{vb:rawphrase ll_menu_showbrk}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.INVD_CAT}">{vb:rawphrase ll_menu_showinv}</a></li>
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.UPLD_CAT}">{vb:rawphrase ll_menu_showupl}</a></li>
<
vb:if condition="$links_defaults['featured_user_favs']">
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=find&amp;catid={vb:raw LDM_cats.FEAT_CAT}">{vb:rawphrase ll_menu_showfeat}</a></li>
</
vb:if>
</
vb:if>

    </
ul>
    </
li>

<
vb:if condition="$show['ldm_search_quick']">
    <
li class="popupmenu">
    <
a href="javascript://" class="popupctrl">{vb:rawphrase ll_menu_search}</a>
    <
ul class="popupbody popuphover">
    <
li id="ldm_navbar_search">
        <
form action="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php" method="get" id="ldm_search">
        {
vb:rawphrase ll_menu_search}
        <
input type="text" name="search" size="15" value="" />
        <
input type="submit" value="{vb:rawphrase ll_go}" name="submit" />
        <
input type="hidden" name="action" value="show" />
        <
input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
        <
input type="hidden" name="literal" value="{vb:raw links_defaults.default_search_all}" />
        <
input type="hidden" name="desc"  value="<vb:if condition="$links_defaults['default_search_desc']">1<vb:else />0</vb:if>" />
        <
input type="hidden" name="keys"  value="<vb:if condition="$links_defaults['default_search_keys']">1<vb:else />0</vb:if>" />
        <
input type="hidden" name="ents"  value="<vb:if condition="$links_defaults['default_search_ents']">1<vb:else />0</vb:if>" />
        </
form>
        </
li>
        <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=search">{vb:rawphrase ll_advanced_search}</a></li>

        {
vb:raw ldm_mysavedsearch.menu}

        {
vb:raw ldm_myprofilesearch.menu}

    </
ul>
    </
li>
<
vb:elseif condition="$show['ldm_search_link']" />
    <
li><a href="{vb:raw LDM_scripts.LDM_SEARCH_SCRIPT}.php?{vb:raw session.sessionurl}action=search">{vb:rawphrase ll_menu_search}</a></li>
</
vb:if>

<
vb:if condition="$show['ldm_moderate_links']">
    <
li><a href="{vb:raw LDM_scripts.LDM_LINKS_SCRIPT}.php?{vb:raw session.sessionurl}action=mod">{vb:rawphrase ll_menu_mod}</a></li>
</
vb:if>

<
vb:if condition="$show['ldm_admin_links']">
    <
li><a href="{vb:raw LDM_scripts.LDM_ADMIN_SCRIPT}.php?{vb:raw session.sessionurl}action=admin">{vb:rawphrase ll_menu_admin} {vb:raw LDM_Version}</a></li>
</
vb:if>

    </
ul>
</
li>
<
vb:else />
<
li><class="navtab" href="{vb:raw ldm_links_script}.php{vb:raw session.sessionurl_q}">{vb:rawphrase ldm_vbmenu_ldm}</a></li>
</
vb:if> 

the problem Now , the variable is not registered like {vb:raw ldm_links_script} >> doesn't get the file name > thats make all links on the script ""when use the template" is invalid like this
http://localhost/vb/.php // Links and Download Main links
http://localhost/vb/.php?action=mod
http://localhost/vb/.php?action=admin



Please don't delete this post, the programer for this script will not help anymore, I searched alot to fix this problem but I can't fix it
BTW: this problem only available in vb4.2.0 , and not present in 4.1.x , don't know what is the reason
Reply With Quote
  #273  
Old 04-10-2013, 02:14 PM
jimsflies jimsflies is offline
 
Join Date: Aug 2009
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hopefully someone can help here... I am beginning the daunting task of upgrading from vb3.8 to vb4. My forumhome uses a variable "$forumbitcounter" which is calculated in a plugin which contains the following code:

Code:
$forumbitcounter++;
What do I need to do to get this variable working on forumhome in vb4?
Reply With Quote
  #274  
Old 04-10-2013, 03:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jimsflies View Post
Hopefully someone can help here... I am beginning the daunting task of upgrading from vb3.8 to vb4. My forumhome uses a variable "$forumbitcounter" which is calculated in a plugin which contains the following code:

Code:
$forumbitcounter++;
What do I need to do to get this variable working on forumhome in vb4?
You need to then preregister it for use in the FORUMHOME template (I assume that is the template you are using it in?)
PHP Code:
vB_Template::preRegister('FORUMHOME'array('forumbitcounter' => $forumbitcounter)); 
Reply With Quote
  #275  
Old 04-10-2013, 04:08 PM
jimsflies jimsflies is offline
 
Join Date: Aug 2009
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You need to then preregister it for use in the FORUMHOME template (I assume that is the template you are using it in?)
PHP Code:
vB_Template::preRegister('FORUMHOME'array('forumbitcounter' => $forumbitcounter)); 
This is prolly a dumb question but was the major one I had reading the original post of this article... Does the registration code go in the forum home template or in a plugin?

Also the variable is actually used in the forumhome_forumbit_level1_post template so would it need to be registered there or would registering it in the containing template be okay?
Reply With Quote
  #276  
Old 04-10-2013, 04:43 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That code goes in the plugin right after your code that defines the variable. And if the variable is in the forumhome_forumbit_level1_post template template, then it needs to be:

PHP Code:
$forumbitcounter++;
vB_Template::preRegister('forumhome_forumbit_level1_post'array('forumbitcounter' => $forumbitcounter)); 
Reply With Quote
  #277  
Old 04-10-2013, 04:55 PM
jimsflies jimsflies is offline
 
Join Date: Aug 2009
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne got it to work... I tried to like your post but got a message saying I have to like someone else's before liking any more of yours lol.

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

One other quick issue...I think this is due to the array (which I didn't have to use in vb3), the first value appears to be null, but needs to start with 1. How do I tell it to start with a value of 1?
Reply With Quote
  #278  
Old 04-10-2013, 10:34 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure I understand... what are you using in the template for the variable? It should just be $variable or {vb:raw variable}
Reply With Quote
  #279  
Old 04-11-2013, 05:20 AM
ezak ezak is offline
 
Join Date: Nov 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found where is the problem, thanks
Reply With Quote
  #280  
Old 04-11-2013, 07:37 PM
jimsflies jimsflies is offline
 
Join Date: Aug 2009
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I'm not sure I understand... what are you using in the template for the variable? It should just be $variable or {vb:raw variable}
I thought I had a fix yesterday, but it still isn't quite right. What I am doing is creating a counter for styling the forum home page. Using this counter in my template creates the alternating background shading and creates the two column layout as seen in my current vb3 site here: http://www.captivereefs.com/forum/forums.html

The problem seems to be on the first forumbitcount the value isn't 1 (I guess it is zero or is empty). Then the second forumbitcount is equal to 1 but should be 2.
Reply With Quote
  #281  
Old 04-11-2013, 10:05 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The variable needs to get preregistered for use in the template *after* is it defined, just like I had posted it above:

PHP Code:
$forumbitcounter++;
vB_Template::preRegister('forumhome_forumbit_level1_post'array('forumbitcounter' => $forumbitcounter)); 
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 01:54 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06677 seconds
  • Memory Usage 2,487KB
  • Queries Executed 26 (?)
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
  • (2)bbcode_code
  • (3)bbcode_html
  • (17)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (17)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete