vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Dynamically add meta keywords on custom pages (https://vborg.vbsupport.ru/showthread.php?t=183673)

Zahl 06-27-2008 07:28 AM

Dynamically add meta keywords on custom pages
 
Hi there,

I have a custom page in my vB and I want to add meta keywords depending on what I'm
outputting. I tried doing stuff like $vb->options/$vboptions['keywords'] .= ', new keyword'; before I fetched any templates or did any output, but the keywords won't be
added, so it seems the headerinclude template already gets parsed when I just include
global.php
Any way to get around this? Thanks :)

Dismounted 06-27-2008 10:10 AM

You can add conditionals in the headinclude template to do this.

Zahl 06-27-2008 01:21 PM

OK, I tries this, but no luck. It really seems like the headerinclude template gets parsed before any of my code gets executed, so the conditional that checks for my stuff always finds nothing.... Any ideas what I'm doing wrong?

I'll take a look at the threadview stuff now, as it is using conditionals too....

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

OK, this is my solution now:
I added headinclude to the global templates
I add keywords via
$vbulletin->options['keywords'] .= ', my keyword';
And then I do a
eval('$headinclude = "' . fetch_template('headinclude') . '";');
before I fetch the final page template that uses $headinclude...

Dismounted 06-28-2008 05:15 AM

Use the parse_templates hook to do whatever you need to. Then you can use data from that hook in headinclude.

Opserty 06-28-2008 09:35 AM

Just edit the headinclude template directly and add the HTML you want to.


All times are GMT. The time now is 03:27 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.00926 seconds
  • Memory Usage 1,711KB
  • 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)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