vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   Template Editing - All the variables and coding bits you need to know! (https://vborg.vbsupport.ru/showthread.php?t=113489)

Boofo 04-28-2006 06:54 PM

Quote:

Originally Posted by Brad
You can access information in objects directly with the templates. For example this:

HTML Code:

<b>$bbuserinfo[username]</b>
Can be written as:

HTML Code:

<b>{$vbulletin->userinfo['username']}</b>

It doesn't seem to like that in if condition = statements, though. ;)

chipet 04-28-2006 07:40 PM

Hm. when I laying the code on a different homepage it doen't login when I try login, Im just being redirected to the forum without being loged in.

Brad 04-28-2006 08:47 PM

Quote:

Originally Posted by Boofo
It doesn't seem to like that in if condition = statements, though. ;)

In these places simpy drop the brackets :)

Boofo 04-28-2006 09:12 PM

Quote:

Originally Posted by Brad
In these places simpy drop the brackets :)

In a condition, would that be the same as <if condition="$show['member']">?

Adrian Schneider 05-02-2006 03:21 AM

Conditions are executed like so:

Code:

blah blah<if condition="$var">eggnog<else />cheese</if>blahblah
Code:

blah blah" . (($var) ? "eggnog" : "cheese") . "blahblah
Because they aren't parsed through double quotes like the rest, there is no need for the braces. I always use the full object vars in conditions, though the shorthand versions appear to work fine as well.

@Boofo: looking at global.php lines 431 (for me anyway):
PHP Code:

if ($vbulletin->userinfo['userid'])
{
    
$show['guest'] = false;
    
$show['member'] = true;
}
else
{
    
$show['guest'] = true;
    
$show['member'] = false;


so to answer your question: yes. It's probably "best" to use $show variables in templates as much as possible, because it keeps the application logic seperate from your templates, but for things as simple as that it shouldn't really matter.

toolblast 05-02-2006 03:27 PM

Interesting. Thanks for sharing that SirAdrian, it is always best as a programmer to keep things as clear to look at and logical, I like the if statement format you showed.

dwbro1 05-06-2006 09:14 PM

Thanks this is great!

evofile 05-08-2006 07:50 PM

hooooooo tnx bro nice writing

SaN-DeeP 05-08-2006 11:57 PM

thanks for sharing

bashy 05-11-2006 06:42 PM

Thanks for a great post and thanks to the other members/staff that have contributed, this will come in really handy for e when i create new page that im working on, Just out of interest, i take it these variables will work within something like Logicans Web Templates? I am sure it will but i just want to make sure? :)


All times are GMT. The time now is 08:00 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.02444 seconds
  • Memory Usage 1,738KB
  • 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
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (3)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