vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   First Look at vBulletin 4 Template Variables (https://vborg.vbsupport.ru/showthread.php?t=217569)

TheSupportForum 02-27-2010 02:07 PM

can anyone help solve this problem

i want to include the following within a template

PHP Code:

<!--#echo var="REMOTE_ADDR" -->
<!--#echo var="HTTP_USER_AGENT" -->
<!--#echo var="REQUEST_URI" -->
<!--#echo var="HTTP_HOST" --> 

how can i do this and do i ned to include anything in the php file for it to work within a template

Ronny 03-05-2010 11:36 AM

I can't convert my custom pages until i know how to access and loop with templates again. It is nice to know how to access one single var or single var in an array but how to loop? I did try my luck with ... (but without any success, yet ...)

Template i need to loop for output
PHP Code:

$namelist vB_Template::create('names_loop')->render(); 


And the template that should display the whole looped conteend
PHP Code:

$templater vB_Template::create('NAMES');
$templater->register('names'$data);
$templater->register('names_loop'$namelist);
print_output($templater->render()); 


$data is an array like
PHP Code:

$data = array(=> array('name' => 'testuser''age' => 100), => array('name' => 'testuser 2''age' => 99)); 


My "NAMES" template looks like this ...
Code:

<div>{vb:raw names_loop}</div>

My "names_loop" template looks like this ...
Code:

<div style="magin: 10px; padding: 10px;">
  <div>{vb:raw names.name}</div>
  <div>{vb:raw names.age}</div>
</div>

So far i can access all the vars in my array with {vb:var names.0.name} or {vb:var names.0.age} but i can't use it in templates to loop an output.

Can anyone help, please? :confused:

Thanks.

Ducks 03-17-2010 10:35 PM

I'm trying to use a variable in SHOWTHREAD, but it's not showing for some reason.

Hook Location: showthread_start
variable: $msgbox
template variable: {vb:raw msgbox}

What can be wrong?

TalkVirginia 03-19-2010 08:10 AM

Quote:

Originally Posted by Ducks (Post 2005771)
I'm trying to use a variable in SHOWTHREAD, but it's not showing for some reason.

Hook Location: showthread_start
variable: $msgbox
template variable: {vb:raw msgbox}


What can be wrong?

Depending on where you want to place it. For example, if you want to place above the thread, use the showthread_above_posts template hook, then create a plugin using the showthread complete hook location. If you open showthread.php, examine around line 2176 and below.

Try this example:

1. Add a new custom template with the following contents:

Product: vBulletin (or if you are creating a mod, choose your product id)
Style: Style of your choice
Title: mytemplate

HTML Code:


<div id="pagetitle" class="pagetitle">
        <h1>Thread: <span class="threadtitle">{vb:raw msgbox}</a></span></h1>
</div>

2. Create a new plugin:
Product: vBulletin (or if you are creating a mod, choose your product id)
Hook Location: showthread_complete
Execution Order: Leave as default
Plugin PHP Code:

PHP Code:


$msgbox 
"Hello World";
$templater vB_Template::create('mytemplate');
$templater->register('msgbox'$msgbox);
$template_hook[showthread_above_posts] .= $templater->render(); 

Plugin Is Active: Yes

Ducks 03-23-2010 08:37 AM

Thanks, it's working now

Jaxel 04-14-2010 06:07 PM

Does anyone know how to get forumIDs and bbuserinfo from this new system?

I'm trying to use it as follows, but it doesn't work...

Code:

header.php?fid={vb:var forum.forumid}&pid={vb:var bbuserinfo.field9}

I'm trying to use this in the HEADER template. It seems that you can no longer call forum and user information in the header template. So it seems forcing specific headers to specific forums is IMPOSSIBLE in VB4.

TheSupportForum 04-18-2010 08:03 AM

i have a template i wish to add to the navbar template

i called it template2

i want to place my custom template above

Code:

<div id="breadcrumb" class="breadcrumb">
<ul class="floatcontainer">

i tried
Code:

{vb:raw navbar2}
link this

Code:


{vb:raw navbar2}
<div id="breadcrumb" class="breadcrumb">
<ul class="floatcontainer">

but did not work, my template name is navbar2

Jaxel 04-22-2010 04:06 AM

How would we use $vbulletin->options in this?

I am trying to use {vb:options media_thumb_dir} but its not working...

James T Brock 04-25-2010 02:20 AM

So basically the variables were changed for no reason just so that non-coders could understand it? Those new variables look a lot more confusing to me.

Zachery 04-25-2010 03:26 AM

Not sure why it was changed, but Jaxel:

{vb:raw vboptions.media_thumb_dir}


All times are GMT. The time now is 03:21 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.01709 seconds
  • Memory Usage 1,757KB
  • 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
  • (6)bbcode_code_printable
  • (1)bbcode_html_printable
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (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