The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
A question about programatically changing templates at runtime
Hi,
Recently, I downloaded and tested the CYB Donate mod, which will add an item called DONATE to the navbar. However, I was not really satisfied with the location of it (right next to the FAQ), and started looking for a less obtrusive spot to insert it. Initially I figured I'd try positioning it directly left from the Log Out option, but gave up on that idea after quite some failures. I then decided I'd instead add it to my footer, and eventually, after quite a bit of trying, I managed to position it at the very right, next to the "top" link. I have a question to satisfy my curiosity, though. The link plugin-item (or object, not sure about the proper term) uses a str_replace function to change the template, like so: Code:
$vbulletin->templatecache['footer'] = str_replace('$vbphrase[top]</a>','$vbphrase[top]</a> - $cyb_paypal_donate_link',$vbulletin->templatecache['footer']); Code:
$vbulletin->templatecache['footer'] = str_replace('<a href="#top" onclick="self.scrollTo(0, 0); return false;">$vbphrase[top]</a>' , $cyb_paypal_donate_link - <a href="#top" onclick="self.scrollTo(0, 0); return false;">$vbphrase[top]</a>' , $vbulletin->templatecache['footer']); 1) The str_replace function only supports a certain amount of characters (Pretty sure this is not the case, as I also tried replacing parts of the code above, but to no avail) 2) It's due to there being HTML tags in the code, which at the time of the replace happening have already been parsed. My money is on option 2, but a second opinion would be greatly appreciated, along with maybe some tips and hints on how to fiind out more. Cheers. Peter |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|