vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

Hippy 11-22-2010 09:55 PM

thanks for the time and effort spent on this article

very helpfull

KaiStone 01-01-2011 06:09 PM

Please help me with this issue.

I have a plug in (Location: parse_templates)

Code:

if($vbulletin->options['enable_vbadv'] AND in_array($vbulletin->userinfo['usergroupid'], explode(',', $vbulletin->options['vbadv_ug'])))
                        {
                                        switch($vbulletin->options['vbadv_place'])
                                {
                                        case 1:
                                                $place = '$navbar';
                                                $fechttemplate = 'FORUMHOME';
                                                break;
                                        case 2:
                                                $place = '$ad_location[ad_navbar_below]';
                                                $fechttemplate = 'navbar';
                                                break;
                                        default:
                                                $place = '$navbar';
                                                $fechttemplate = 'FORUMHOME';
                                                break;
                                }
                        $vbulletin->templatecache[$fechttemplate] = str_replace($place, $place . '\n' . fetch_template('forumhome_+++++++_com_adv'), $vbulletin->templatecache[$fechttemplate]);
                        }



I've tried to fix it like this

Code:

if($vbulletin->options['enable_vbadv'] AND in_array($vbulletin->userinfo['usergroupid'], explode(',', $vbulletin->options['vbadv_ug'])))
                        {
        $templater = vB_Template::create('forumhome_+++++++_com_adv');
        $templater->register('advheader', $advheader);
        $advheader = $templater->render();
                                        switch($vbulletin->options['vbadv_place'])
                                {
                                        case 1: $template_hook['forumhome_above_forums'] .= $advheader; break;
                                        case 2: $ad_location['global_below_navbar'] .= $advheader; break;
                                }
                        }

But it takes effect only when I choose case 1, display below forums. When I choose "Below Navbar", there's nothing displayed. Please help me to fix it.

Thank you very much, and sorry for my bad English.

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

It's Fixed. Just simple change Location to "global_start"

TheInsaneManiac 01-03-2011 03:48 PM

All I want to do is covert the current fetch template into current VB code. How do I do this in 4.0?
Code:

eval('$soundnotification = "' . fetch_template('sound_notification') . '";');
I tried:
Code:

$soundnotification .= vB_Template::create('sound_notification')->render();
But to no avail does it work

rob01 01-05-2011 05:52 PM

is posible to do

{vb:raw my_var.userid}

or how i should call for the user id or username?

for example vb3:

<br>User Registration IP Address: $spammerinfo[ipaddress]
<br>User IP Address for Selected Post: $postinfo[ipaddress]

but how to make it work for vb4?
:S

KaiStone 01-06-2011 11:20 AM

Quote:

Originally Posted by rob01 (Post 2144523)
is posible to do

{vb:raw my_var.userid}

or how i should call for the user id or username?

for example vb3:

<br>User Registration IP Address: $spammerinfo[ipaddress]
<br>User IP Address for Selected Post: $postinfo[ipaddress]

but how to make it work for vb4?
:S

As my knowledge, if in vB3, the command is $spammerinfo[ipaddress] and $postinfo[ipaddress], so in vB4, the command is

{vb:raw spammerinfo.ipaddress}
{vb:raw postinfo.ipaddress}

rob01 01-07-2011 12:18 AM

uhmm yeah, but the problem is that spammerinfo attribute is not working :S

Lynne 01-07-2011 01:27 AM

Quote:

Originally Posted by rob01 (Post 2145208)
uhmm yeah, but the problem is that spammerinfo attribute is not working :S

Did you register the variable for use in that template?

TheInsaneManiac 01-08-2011 12:18 AM

Quote:

Originally Posted by TheInsaneManiac (Post 2143389)
All I want to do is covert the current fetch template into current VB code. How do I do this in 4.0?
Code:

eval('$soundnotification = "' . fetch_template('sound_notification') . '";');
I tried:
Code:

$soundnotification .= vB_Template::create('sound_notification')->render();
But to no avail does it work

Help

Yaung Sein 01-09-2011 02:20 AM

I want to register $forum in facebook_publishcheckbox template. But I don't know where I set those set those register value in what file.

PHP Code:

vB_Template::preRegister('facebook_publishcheckbox',array('forum' => $forum)); 


facebook_publishcheckbox Template
Code:

<label id="fb_pulishlabel" for="fb_dopublish">
        <img src="{vb:stylevar imgdir_misc}/facebook.gif" alt="{vb:rawphrase publish_to_facebook}" />
        {vb:rawphrase publish_to_facebook}
        <input type="checkbox" tabindex="1" id="fb_dopublish" value="1" <vb:if condition="in_array($forum['forumid'], array(70,80,81,82,83,88,92,93))"><vb:else />checked="checked" </vb:if>name="fb_dopublish" />
</label>

Please help me, I am a very beginner.

KaiStone 01-13-2011 11:05 AM

Put the register code in a plugin, and call it where your template displays (by choosing hook location). In the case you don't really know what to do, Creat a new plugin and choose hook location is global_start or parse_template


All times are GMT. The time now is 01:52 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.01729 seconds
  • Memory Usage 1,753KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete