So you want a product hack and do not want to do any template editing?Read this and find out how.
I will use my right click disabled hack as example.
I guess I don't need to explain what a product is , if yes read other tuts.
Firstly take your code and put it into a template.(Can't be PHP!If is php simply use plugins and hooks!)
Code:
<templates>
<template name="zh_nrc" templatetype="template" date="1148052896" username="Ziki" version="3.5.4"><![CDATA[
<script language=JavaScript>
var message="$zhnrctext";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
</script>
]]></template>
</templates>
So we have a template that containst a js code.Now what we do we cache the template.We have to create a plugin under the hook location cache_templates
Code:
<plugins>
<plugin active="1">
<title>ZH_NRC_CACHE</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[
$globaltemplates = array_merge($globaltemplates, array('zh_nrc'));
]]></phpcode>
</plugin>
</plugins>
So our template/code is cached.Now we need to look up the hook location and template where the code will be shown/executed.I will use global_start and headinclude so it will be executed on every page.(headinclude acts like the <head> tags in HTML)
Code:
<plugin active="1">
<title>JS_PLACEMENT</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[
$ara = '<!-- / CSS Stylesheet -->';
$vbulletin->templatecache['headinclude'] = str_replace($ara,$ara.fetch_template('zh_nrc'),$vbulletin->templatecache['headinclude'])
;]]>
</phpcode>
</plugin>
</plugins>
Now $ara represents a piece of code in the chosen template ['headinclude'].The rest of the code fetches the template (('zh_nrc')) and replaces $ara in headinclude with the zh_nrc template.
I suggest you pick a comment not a code for that!
Hopefully you understand it and like it
