The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
append after <head> in all templates?
This turned out to be a global replace that is very handy if you know how to use it, you can find the solution begining in post 18(for vb4) and 20 (for vb3)
So I know if I was going to add something after <head> to one template I could do it something like: Code:
$find = '<head>'; $add = '<something>'; $vbulletin->templatecache['FORUMHOME'] = str_replace($find,$find.$add,$vbulletin->templatecache['FORUMHOME']); Tried this and a few other combinations with no luck: Code:
$find = '<head>'; $add = '<something>'; $find = str_replace($find,$find.$add,$find); |
#2
|
||||
|
||||
Why not just add it with a template hook. There are a couple in head or its sub templates.
|
#3
|
||||
|
||||
because im trying to change <head> to lol, just learning experiance
|
#4
|
|||
|
|||
What exactly are you trying to add to <head>? Maybe there's another way to do it instead of replacing it.
|
#5
|
||||
|
||||
If I recall correctly, what I have done in vB 3.8.9 to add something to pages is append it to either $spacer_open or $spacer_close.
|
#6
|
||||
|
||||
Quote:
this is just an example not what I'm doing, but say I wanted to replace Code:
<head> Code:
<head class="someClass"> so its looking like if I want to do something like this I'll have to create a replace for every template Code:
$find = '<head>'; $replace = '<head class="someClass">'; $vbulletin->templatecache['FORUMHOME'] = str_replace($find,$replace,$vbulletin->templatecache['FORUMHOME']); $vbulletin->templatecache['showthread'] = str_replace($find,$replace,$vbulletin->templatecache['showthread']); etc... |
#7
|
||||
|
||||
What do you get by adding CSS to the head element?
|
#8
|
||||
|
||||
that is not what im doing was just an example lol
|
#9
|
|||
|
|||
If it really turns out to be difficult to do this, you can write some native JavaScript to do this.
http://stackoverflow.com/questions/2...o-the-head-tag |
#10
|
||||
|
||||
the end result will actually be for spiders, and i dont believe spiders see execute js
--------------- Added [DATE]1460644385[/DATE] at [TIME]1460644385[/TIME] --------------- why does this method not work? Code:
<head> = str_replace('head', 'head class="test"', <head>); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|