The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Template conditional
I am trying to create a small plugin that add the possiblity to add a simple global annmouncement in the header of all pages.
I got everything working except for the conditional in the template. Here is the plugin code Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <product productid="simpleglobalannouncement" title="Global announcement" description="Display simple global announcement in the header." version="1.0.0" active="1"> <templates> <template name="simple_global_announcement" templatetype="template" date="1124952989" username="Tommy Jensen" version="1.0"><![CDATA[ <if condition="THIS_SCRIPT != 'register' AND THIS_SCRIPT != 'login'"> <if condition="$vboptions[enableglobalannouncement]"> <!-- global announcement --> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <thead> <tr> <td class="alt1"> <phrase 1="$bbuserinfo[username]" 2="$vboptions[bbtitle]">$vboptions[globalannouncementtext]</phrase> </td> </tr> </thead> </table> <br /> <!-- / global announcement --> </if> ]]></template> </templates> <plugins> <plugin active="1"> <title><![CDATA[Global announcement [Alteration]]]></title> <hookname>parse_templates</hookname> <phpcode><![CDATA[ eval('$simple_global_announcement = "' . fetch_template('simple_global_announcement') . '";'); ]]></phpcode> </plugin> <plugin active="1"> <title><![CDATA[Global announcement [Template Cache]]]></title> <hookname>cache_templates</hookname> <phpcode><![CDATA[ $globaltemplates[] = 'simple_global_announcement'; ]]></phpcode> </plugin> </plugins> <phrases> <phrasetype name="GLOBAL" fieldname="global"> </phrasetype> <phrasetype name="vBulletin Settings" fieldname="vbsettings"> <phrase name="settinggroup_simpleglobalannouncement"><![CDATA[Simple Global announcement]]></phrase> <phrase name="setting_enableglobalannouncement_title"><![CDATA[Enable Simple Global announcement]]></phrase> <phrase name="setting_enableglobalannouncement_desc"><![CDATA[Enable Simple Global announcement]]></phrase> <phrase name="setting_globalannouncementtext_title"><![CDATA[Announcement]]></phrase> <phrase name="setting_globalannouncementtext_desc"><![CDATA[Text for announcement]]></phrase> </phrasetype> </phrases> <options> <settinggroup name="simpleglobalannouncement" displayorder="2000"> <setting varname="enableglobalannouncement" displayorder="10"> <datatype>number</datatype> <optioncode><![CDATA[<span class=\"smallfont\" style=\"white-space:nowrap\"> <label for=\"qr0\"><input type=\"radio\" name=\"setting[$settingid]\" id=\"qr0\" value=\"0\" tabindex=\"1\"" . ($setting['value'] == 0 ? ' checked="checked"' : '') . " />$vbphrase[no]</label><br /> <label for=\"qr1\"><input type=\"radio\" name=\"setting[$settingid]\" id=\"qr1\" value=\"1\" tabindex=\"1\"" . ($setting['value'] == 1 ? ' checked="checked"' : '') . " />$vbphrase[yes]</label><br /> </span>]]></optioncode> <defaultvalue>0</defaultvalue> </setting> <setting varname="globalannouncementtext" displayorder="20"> <datatype>free</datatype> <optioncode>textarea</optioncode> </setting> </settinggroup> </options> </product> <if condition="$vboptions[enableglobalannouncement]==1"> but no matter what the announcement is diplayed always. How should the conditional be ? ------------------------------ I figured it out. I removed the conditional from the template and changed the plugin code to Code:
if ($vbulletin->options['enableglobalannouncement']) { eval('$simple_global_announcement = "' . fetch_template('simple_global_announcement') . '";'); } |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|