The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
Quote:
Quote:
PHP Code:
|
#12
|
||||
|
||||
Well, I learned something new too then, thanks Paul. When should array merge be used?
|
#13
|
|||
|
|||
Once again thank you all very, very much for guiding me through this.
Here's what I changed: - Dropped the executionorder per acidburn's advice - Made the template phrased because I forgot to the first time - Removed the search string from the template because I know how it works now (thank you again, acidburn) - Added Paul's code snippet to add to the global template array - Added JumpD's code to grab the template from cache - Changed the hook to forumhome_complete Things I'm not sure on: - What/how the template actually gets added to the global templates, unless that's exactly what Paul's code does. I'm assuming that it's basically if you're on the index, then add s_n_t to the cache? - If I took a step forward here. Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <product productid="chris777_showinvisible" active="1"> <title>Show Invisible Users Online</title> <description>Will add a count of invisible users in WGO.</description> <version>1.0.0</version> <dependencies></dependencies> <codes></codes> <templates> <template name="silly_newbie_template" templatetype="template" username="chris-777" version="1.0.0"> <![CDATA[ <!-- Newbie Template --> <phrase>$vbphrase[online_invisible]</phrase> $numberinvisible <!-- /Newbie --> ]]> </template> </templates> <plugins> <plugin active="1"> <title>Show Invisible in WOL</title> <hookname>forumhome_complete</hookname> <phpcode><![CDATA[ if (THIS_SCRIPT == 'index') { $globaltemplates[] = 'silly_newbie_template'; } $search_text = '$vbphrase[x_members_and_y_guests]</phrase>)'; $vbulletin->templatecache['FORUMHOME'] = str_replace($search_text, $search_text.$vbulletin->templatecache['silly_newbie_template'],$vbulletin->templatecache['FORUMHOME']); ]]> </phpcode> <phrases> <phrasetype name="GLOBAL" fieldname="global"> <phrase name="online_invisible"> <![CDATA[ Invisible: ]]> </phrase> </phrasetype> </phrases> </product> |
#14
|
||||
|
||||
You don't need the <phrase> tags around $vbphrase[onlineinvisible]. You'll only need those if you're going to be using a variable inside of the phrase. For example: phrase1: "There have been {1} users online today, but there were {2} online yesterday." Then you'd use: <phrase 1="$userstoday" 2="$usersyesterday">$vbphrase[onlinetoday]</phrase>.
Paul's code caches the template so your board doesn't have to query for it every page load. The template is installed (if that's what you were trying to say) whenever the product is imported. This code needs to be put in a plugin by itself using hook 'cache_templates'. Code:
if (THIS_SCRIPT == 'index') { $globaltemplates[] = 'silly_newbie_template'; } Code:
$search_text = '$vbphrase[x_members_and_y_guests]</phrase>)'; $vbulletin->templatecache['FORUMHOME'] = str_replace($search_text, Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|