vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to change the meta description? vboptions[description]? (https://vborg.vbsupport.ru/showthread.php?t=263047)

Spinball 05-03-2011 01:44 PM

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?

Spinball 05-05-2011 08:33 AM

Anyone?

kh99 05-05-2011 12:47 PM

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.

Spinball 05-05-2011 08:47 PM

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.

kh99 05-05-2011 09:00 PM

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.


All times are GMT. The time now is 12:52 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.00999 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
  • (2)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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