The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Let PHP Live! (Allow PHP code in templates) Details »» | |||||||||||||||||||||||||||
Let PHP Live! (Allow PHP code in templates)
Developer Last Online: Jul 2011
I got frustrated that the vBulletin template system limited me in this way so... I wrote a hack around it.
Just use <? <?php <?= as you would normally in the templates. I'd like to see PHP based templates in the future, vBulletin! <if> is useless if I can just type <? if ?> ! Things to Remember You cannot break up PHP blocks. <? if (0): ?> Hello!!! <? endif ?> will not work, and you'll get a nice error message about how it didn't. If it's really a concern for anyone, I can try to get it working. In my opinion, that's not a big deal. I think PHP support sans breaking up blocks in 10 lines of hack code is pretty nice, myself. That's a limitation of eval anyway Variables aren't always the same in PHP mode! While you can use $vboptions[bbtitle] in your main code and get it working, vBulletin is doing behind the scenes voodoo on stuff. To access $vboptions[x]: $GLOBALS['vbulletin']->options['x'] Show Your Support
|
Comments |
#12
|
||||
|
||||
I'm sure there was a very good reason php was not allowed in templates, and it's never necessary if stuff is written properly. Still, nice of you to share.
|
#13
|
|||
|
|||
I'm pretty sure it's annoying when software intentionally tries to limit the administrator. If you have a huge problem, remove Styles Permissions in the administrator permissions for the administrator you cannot trust. All of my admins also have FTP access and have been in my community for 5 years, I would trust them with babysitting my children. If you cannot trust your administrators, then who can you trust? They have access to all of your board. They could delete all of that board. I guess it is a security risk to have administrators at all. :/
However, it is not good to assume that all situations can be solved by saying "well, if it was written RIGHT then this wouldn't be necessary." This is a nice shortcut for anyone who actually wants to turn vBulletin into something else besides a stock vBulletin with a different logo and color scheme. Here is my situation and the reason I wrote this particular hack: I wanted to integrate the header and footer which vBulletin uses with the rest of my site's template system. I do this by calling top() and bottom() when I need the header and when I need the footer respectively. Since each template has different values that I will need to pass to top() for the navigation selection, title, necessary <head> elements, etc I will need to replace the HTML code that starts every template with a call to top(). Saying that I could just put this in $header is ridiculous- vBulletin itself does not do that. What am I supposed to do? Make a plugin for every single _start of a document? That's also ridiculous, and also hard to maintain. I know separating code and display is the hot new thing to do, but that doesn't mean you should have to go out of your way to do it. Personally, I like being able to include template files and use PHP formatting logic to echo stuff directly into templates without being assed to make a plugin in some far away part of the CP. vBulletin template support is poor; it needs this. Thanks to everyone who installed! |
#14
|
|||
|
|||
FINALLY - thanks
I need it for certain gameserver stuff which was a pain before. I mean yes, you can call php files using a nice neet plugin and such, but this makes it sooo easier - thanks [high]* utw-Mephisto clicks install[/high] |
#15
|
||||
|
||||
can I get a "this hack for dummies" post? How exactly does this work?
I want to put this php code in my header: Code:
<?php { include("http://www.mysite.com/in.php"); } ?> *EDIT* Is it as easy as using this: Code:
<?php { include("http://www.mysite.com/in.php");} ?> |
#16
|
||||
|
||||
I installed and works perfect.. <!- / thank you - >
|
#17
|
||||
|
||||
PHP Code:
Quote:
What do you mean about having to use multiple _start plugins? You should only have to use global_start. One plugin. You can even have it include a PHP script you can edit/upload to change the code. This way, it is all in one central location, and it keeps your templates as templates, rather than code soup. I would like to see how your templates are holding up in a years time. Anyway, if it works for you - great, I'm sure others will appreciate it as well. I just think you should give the template system another try the way it is supposed to be used, and you will probably see why we feel this way. |
#18
|
|||
|
|||
Quote:
|
#19
|
||||
|
||||
I assume that was some poor attempt at sarcasm -- but you should probably know that most of "them" read and post here often.
|
#20
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
I don't really want to bruise egos here, so I will reserve the majority of what I have to say. All I will say is that you can't even do something simple like zebra-striping tables with vBulletin's templating functionality, and it is embarrassing. Please don't talk to me like I am new and stop hijacking my thread with your nonsense. Thanks. And once again, thanks to everyone who installed! |
#21
|
||||
|
||||
Thank you for the mod.... and keep them coming
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|