vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Thread title in header? (https://vborg.vbsupport.ru/showthread.php?t=228715)

monstermunch 11-23-2009 08:41 PM

Thread title in header?
 
Hi,

Does anyone know if its possible to show the "thread title" in the header template, for some reason I cant get it to display.

im using the
Code:

$thread[title]
to try and display it but it dosent seem to work, although it seems to work in the title and showthread pages?

Probably something simple im doing wrong.

thanks

kh99 11-23-2009 09:42 PM

I think it's because the header template is processed before $thread[title] is set. I don't know if there's a "standard" trick to get around that. I guess if you really wanted to do it you could use a plugin to insert it somehow, using the showthread_complete hook.

navbar isn't done till the end so it could go near the navbar (but I guess it's already in the navbar :)).

monstermunch 11-24-2009 07:22 AM

Quote:

Originally Posted by kh99 (Post 1919787)
I think it's because the header template is processed before $thread[title] is set. I don't know if there's a "standard" trick to get around that. I guess if you really wanted to do it you could use a plugin to insert it somehow, using the showthread_complete hook.

navbar isn't done till the end so it could go near the navbar (but I guess it's already in the navbar :)).

I thought the same thing so decided to look at the showthread template and found $thread[title] is used in the <title></title> which is before the $header is called.. its odd as it seems to work before the $header, and in the $navbar but not in the $header template itself

kh99 11-24-2009 08:15 AM

But looking at the code in showthread.php, $header is set at the beginning (in global.php) and the showthread template isn't used until the end (and $navbar is set near the end). So although the $header appears after the <title></title> in the template, it is already set before the template even begins.

Something could be inserted between <body> and $header, but of course that would put it at the very top of the page.

monstermunch 11-24-2009 09:36 AM

Quote:

Originally Posted by kh99 (Post 1920018)
But looking at the code in showthread.php, $header is set at the beginning (in global.php) and the showthread template isn't used until the end (and $navbar is set near the end). So although the $header appears after the <title></title> in the template, it is already set before the template even begins.

Something could be inserted between <body> and $header, but of course that would put it at the very top of the page.


I see, so its dosent look like it something that easy to do then

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

Quote:

Originally Posted by kh99 (Post 1920018)
But looking at the code in showthread.php, $header is set at the beginning (in global.php) and the showthread template isn't used until the end (and $navbar is set near the end). So although the $header appears after the <title></title> in the template, it is already set before the template even begins.

Something could be inserted between <body> and $header, but of course that would put it at the very top of the page.

I just checked my showthread template and it goes in this order

<title></title>
$header
$navbar

it seems to work above the header, below the header, in the navbar, but not in the header , although I can get the forum topics to show in the header just no the thread/post title..

kh99 11-24-2009 04:30 PM

Quote:

Originally Posted by monstermunch (Post 1920036)
I just checked my showthread template and it goes in this order

<title></title>
$header
$navbar

Right, but what "$header" does is take what is in the variable "$header" and insert it in the template at that point. So it doesn't matter where it is in the template, what matters is where $header is set in the .php file compared to where the template is eval'd. In showthread.php, $header is set (by evaluating the header template) at the top before $thread is set, so $thread[title] doesn't show up. The forum info must work because it's set before the header template is eval'd.

However - in checking out why the forum stuff works, I noticed that there's another thread variable that *is* set early, it's called "$threadinfo". So, if you use $threadinfo[title] it should work in the header. (But word wrapping and censoring has not been done at that point, so it may be different than what appears in later in the page, if you use either of those features).


All times are GMT. The time now is 05: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.01072 seconds
  • Memory Usage 1,731KB
  • 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
  • (4)bbcode_quote_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