Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-03-2011, 01:44 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to change the meta description? vboptions[description]?

Folks I have a custom template which I use to output custom pages outside normal forum functionality.
I want to change the keywords and description metas which in the headinclude look like
HTML Code:
<meta name="description" content="$vboptions[description]" />
My php script does this at the top:
PHP Code:
session_start();
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT''reviews');
define('CSRF_PROTECTION'true);
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array('custom_shell','headinclude');
$actiontemplates = array();
chdir("/home/sites/avforums/public_html/forums");
require_once(
'/home/sites/avforums/public_html/forums/global.php'); 
and after building the page into $page, then
PHP Code:
    eval('$navbar = "' fetch_template('navbar') . '";');
    
$HTML $page;
    eval(
'print_output("' fetch_template('custom_shell') . '");'); 
The template looks like this:
HTML Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]" id="vbulletin_html">
<head>
<base href="http://www.avforums.com/forums/" />
$headinclude
<title>$pagetitle - $vboptions[bbtitle]</title>
<link href="http://www.avforums.com/styles/balloontip.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="http://www.avforums.com/highslide/highslide-with-html.js"></script>
<script type="text/javascript" src="http://www.avforums.com/highslide/highslide.config.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="http://www.avforums.com/highslide/highslide.css" />
</head>
<body>
$header

<if condition="$headerbanner">$headerbanner</if>
$navbar

$HTML

<if condition="$footerbanner"><br />$footerbanner</if>
$footer
</body>
</html>
In the php script, I tried
$vbulletin->options['description'] = "AVForums reviews";
and
$vboptions['description'] = "AVForums reviews";

and neither work.
Any ideas please?
Reply With Quote
  #2  
Old 05-05-2011, 08:33 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone?
Reply With Quote
  #3  
Old 05-05-2011, 12:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe you could make a plugin on hook parse_templates like this:
Code:
if (THIS_SCRIPT == 'reviews')
{
    $vbulletin->options['description'] = "AVForums reviews";
}

Or maybe in your code you could do a preg_replace() on $headinclude after global.php is included, and replace the meta tags.
Reply With Quote
  #4  
Old 05-05-2011, 08:47 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. It's not until I'm a bit into the script that I know what description I want to have. It's kind of a problem and I think I might have to create a custom version of global.php just for these special pages.
Reply With Quote
  #5  
Old 05-05-2011, 09:00 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, how about this: in the headinclude template put
Code:
<if condition="THIS_SCRIPT != 'reviews'">
...
</if>

around the meta tags, and in your template put a new variable where you want the description meta tags to be (or maybe copy the entire meta tag block from headinclude to your template and replace the variables as needed), then you have until the template eval to set that variable.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:32 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.05548 seconds
  • Memory Usage 2,211KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete