The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Creating a product
When creating a product, what would be the best way to add a line of code to an existing template?
Currently I'd like to add Code:
<script type="text/javascript" src="clientscript/jquery/1.3/jquery-1.3.2.min.js"></script> Code:
<meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" /> <meta name="generator" content="vBulletin $vboptions[templateversion]" /> <if condition="$show['threadinfo']"> <meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$threadinfo[prefix_plain_html] $threadinfo[title], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[title] $foruminfo[title_clean]" /> <else /><if condition="$show['foruminfo']"> <meta name="keywords" content="$foruminfo[title_clean], $vboptions[keywords]" /> <meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$foruminfo[description_clean]" /> <else /> <meta name="keywords" content="$vboptions[keywords]" /> <meta name="description" content="$vboptions[description]" /> </if></if> <!-- CSS Stylesheet --> $style[css] <if condition="is_browser('opera') AND !is_browser('opera', '8.0.1')"> <style type="text/css" id="vbulletin_opera8fix_css"> ul, ol { padding-$stylevar[left]:20px; } </style> </if> <if condition="$show['editor_css']"> $editor_css </if> <!-- / CSS Stylesheet --> <script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- var SESSIONURL = "$session[sessionurl_js]"; var SECURITYTOKEN = "$bbuserinfo[securitytoken]"; var IMGDIR_MISC = "$stylevar[imgdir_misc]"; var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10); // --> </script> <script type="text/javascript" src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script> <if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <script type="text/javascript" src="clientscript/jquery/1.3/jquery-1.3.2.min.js"></script> <if condition="$vboptions['externalrss']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] RSS Feed" href="external.php?type=RSS2" /> <if condition="$show['foruminfo'] OR $show['threadinfo']"> <link rel="alternate" type="application/rss+xml" title="$vboptions[bbtitle] - $foruminfo[title_clean] - RSS Feed" href="external.php?type=RSS2&forumids=$foruminfo[forumid]" /> </if> </if> this doesn't seem to work Code:
<plugins> <plugin active="1" executionorder="5"> <title>test</title> <hookname>global_start</hookname> <phpcode><![CDATA[$find = '<if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if>'; $replace = '<if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js?v=$vboptions[simpleversion]"></script></if> <script type="text/javascript" src="clientscript/jquery/1.3/jquery-1.3.2.min.js"></script>'; $vbulletin->templatecache['headinclude'] = str_replace($find, $replace, $vbulletin->templatecache['headinclude']);]]></phpcode> </plugin> </plugins> got it Code:
$search = '<!-- / CSS Stylesheet -->'; $replace = '<!-- / CSS Stylesheet --> test123'; $vbulletin->templatecache['headinclude'] = str_replace($search, $replace, $vbulletin->templatecache['headinclude']); |
#2
|
||||
|
||||
'k, guess I'm still stuck
PHP Code:
PHP Code:
Most likely just a typo, but any help would be more than appreciated! |
#3
|
|||
|
|||
Why are you using addslashes?
|
#4
|
||||
|
||||
I'm not really sure.. It was by the book, sort of say. But you're right, according to this http://us3.php.net/manual/en/function.addslashes.php it wouldn't be needed.
It doesn't alter the result though. |
#5
|
|||
|
|||
I did this and it worked fine
PHP Code:
It has to be on global_start too. Although Im sure you have already realised that |
#6
|
||||
|
||||
both [minicode]foo[/minicode] and [minicode]<!-- / CSS Stylesheet --> test 125345[/minicode] are indeed working. As it is right now you should be able to see the word foo on top of your website.
Since the code I'm using instead of foo is a bit longer, I'm trying to load a custom template called vbdock_facebox_headinclude. Which also is the thing that isn't working. |
#7
|
||||
|
||||
Can't you append it to the end of $headerinclude? Something like:
PHP Code:
|
#8
|
|||
|
|||
This should work (fetch_template())
PHP Code:
|
#9
|
||||
|
||||
Quote:
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|