vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Having issues with custom page titles using variables. (https://vborg.vbsupport.ru/showthread.php?t=220625)

vbem2 08-11-2009 05:33 AM

Having issues with custom page titles using variables.
 
VB 3.7

In the custom template I have this:
Code:

<title>$Year $MakeOther $ModelOther $Trim Gas Mileage ($vehiclenickname) - $vboptions[bbtitle]</title>
Works fine as a title for just viewing the page, but links show up like this: "Check it out: Gas Mileage () - EcoModder.com"

You can see it here in google: http://www.google.com/#hl=en&q=em-fu...fp=pBEVNRsPIgM

Ideas?

Thanks!

Lynne 08-11-2009 03:56 PM

It doesn't work fine when viewing the actual page either. This is in your source code:
HTML Code:

<title>    Gas Mileage () - EcoModder.com</title>
The variables you are using in the title are not availabe at the time the $header template is parsed. So, you need to change the location of the plugin where you define them if you want them to show up there.

vbem2 08-11-2009 04:41 PM

Can you elaborate a little on that? I know php decently but find working with VB a little difficult. Is there a standard solution to this issue (I assumed it was common)?

Thanks!

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

Also, when I look at a page with firebug, I see this as the title tag:
HTML Code:

<title>1991 Honda CRX DX Gas Mileage (Vegan Powa!) - EcoModder.com</title>
*confused*

Sorry for being a newb

Lynne 08-11-2009 04:56 PM

Perhaps your page is cached and that is why you see the whole title?

I don't know what your code is, but the variables you use in the <title> must be defined before they may be used. So, you need to define them before the header template is evaled which is in the global.php page (I am pretty sure). So, pick a plugin to use that gets evaled *before* the header template is evaled and define those variables in that plugin.

vbem2 08-11-2009 05:18 PM

Yeah, I get that I need to define it first, I'm just a little confused as to the work flow. Also, I did a hard refresh to ensure I wasn't seeing a cached page, still shows the proper title for me though.

Anyway, here's my code.

First, this fetches the data:
PHP Code:

while ($row=$db->fetch_array($vehicledetails))
       {
        
$vehiclenickname $row[VehicleNickname];
        
$vehicleuserid $row[UserID];
        
$Year $row[Year];
        
$MakeOther $row[MakeOther];
        
$ModelOther $row[ModelOther];        
        
$Trim $row[Trim];
    } 

Then, further down in the php we have this which calls the template:

PHP Code:

eval('print_output("' fetch_template('emFuelLog') . '");'); 

Then in the template I have this:
HTML Code:

<head>
<meta name="description" content="$foruminfo[description]" />
<title>$Year $MakeOther $ModelOther $Trim Gas Mileage ($vehiclenickname) - $vboptions[bbtitle]</title>
$headinclude
</head>

A little unclear on why it's not getting through :(. Thanks for helping me!

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

O I see! It seems to be a problem with being logged in or not. Ideas?

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

Seems to be fixed now, let me know if you can see the titles!?

For some reason my partner had made the sql query that fetches those variables only display for the owner of the pages in question, oops!

Thank you so much for helping me figure it out :D

Lynne 08-11-2009 05:51 PM

I see it now! Looks like you got the issue cleared up. :)

vbem2 08-12-2009 01:23 AM

Sweet, thanks again for the help!


All times are GMT. The time now is 05:18 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.01068 seconds
  • Memory Usage 1,737KB
  • 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
  • (3)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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