vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Navbar Template Conditionals Help (https://vborg.vbsupport.ru/showthread.php?t=295204)

Mickie D 02-17-2013 09:39 AM

Navbar Template Conditionals Help
 
Hi all,

Looking for some conditionals that correspond to the navbar template.

Example If I am on showthread page, I would like to call the title of thread (first post) in the navbar.

Something like this

Code:

<vb:if condition="THIS_SCRIPT == 'showthread'">
{raw thread.info[post]}
</vb:if>

Not sure what variable is used for navbar?

Or if it needs a plugin?

Thanks
Mick

kh99 02-17-2013 09:46 AM

I'd have to test it to be sure, but you could try {vb:raw GLOBALS.threadinfo.title}

Mickie D 02-17-2013 11:35 AM

I think vbulletin.org was lagging earlier as I replied to this?

That worked perfect, I have tried to thank you in the last two posts where you have helped me but it says I cannot thank you because you was the last person I thanked... just shows how helpful you are :)

Thank you very much for the code.

Mick

kh99 02-17-2013 06:46 PM

Thanks. Looking at it again, you might want vb:raw instead of vb:var - I was thinking you should handle any html tags, but the SHOWTHREAD template uses vb:raw so it must be handled elsewhere.

Mickie D 02-18-2013 08:11 AM

Cheers, I changed it to raw :)

Can I ask what the difference is as both worked ?

Just for future reference.

Regards
Mick

kh99 02-18-2013 11:25 AM

The only difference is that 'var' will run the value through htmlspecialchars(), which encodes html characters like '<' and '>' (as &lt; and &gt;) so that they will appear as '<' and '>' in the output. Otherwise they would act as html tags, so if someone were to put html tags in the thread title they could affect the look of your page.

I have to admit I don't know offhand how it's handled - maybe those characters aren't allowed at all in thread titles or something. But you could do a test by creating a thread with a title like '<b>Bold</b>' and then see if vb:raw looks different than vb:var.

Edit: I just went ahead and tried it. If you create a thread with title '<b>Bold</b>' and use vb:var you get &lt;b&gt;Bold&lt;/b&gt;, which means that htmlspecialchars is being applied twice. So you need to use vb:raw in this case, or you might end up with strange things like that.


All times are GMT. The time now is 03:04 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.02225 seconds
  • Memory Usage 1,717KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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