Let PHP Live! (Allow PHP code in templates)
Just use
I'd like to see PHP based templates in the future, vBulletin!
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']
Not much to get working... you import the XML file, the end. Nothing to configure. Code only runs when templates are compiled.
Basically, what I wonder is can I paste it into a post and have a script executed? What would have to be enabled for that script to be executed?
I think this is very important question. Can someone give an answer about this?
Thanks
I want to put this php code in my header:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The reason - mysite.com and forums.mysite.com are on two different servers.
*EDIT*
Is it as easy as using this:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
????
Do you ? If you do, make sure you back up.
I trust all my Administrators. But just because you trust someone doesn't mean that they wouldn't for some reason get upset and retaliate.
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Much easier IMO. Or, do it properly, and actually USE the templates.
I'd like to see PHP based templates in the future, vBulletin!
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.
Basically, what I wonder is can I paste it into a post and have a script executed? What would have to be enabled for that script to be executed?
http://www.vbulletin.com/forum/showthread.php?t=173937
I dont seem to be able to add pages now with php, although my previously added ones work fine.
Fatal error: Call to undefined function: showprevious() in /home/devnerds/public_html/includes/adminfunctions_template.php(3593) : eval()'d code(27) : eval()'d code on line 1
Is the error I get.
Regards
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
/me clicks install
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Much easier IMO. Or, do it properly, and actually USE the templates.
Well no, you are assuming thats how it works and assumptions are never nice. top() and bottom() take parameters depending on what page they are called from, and I don't want to use the template system. That means I have to keep two seperate copies of the current template of my site and I surely don't like redundancy. Please read my previous (and very long) post.
if ?> is useless if I can just type
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.
Well no, you are assuming thats how it works and assumptions are never nice. top() and bottom() take parameters depending on what page they are called from, and I don't want to use the template system. That means I have to keep two seperate copies of the current template of my site and I surely don't like redundancy. Please read my previous (and very long) post.
I would like to see how your templates are holding up in a years time.
Much better than your way, as I am not having to maintain two sets of templates. Please read my previous (and very long) post, get off your high horse and get out of my topic.
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!
just dont tell anybody. whos going to know if you dont tell them? you could even change the name of the plugin so they dont know.
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 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. :D
Thanks to everyone who installed!
This is one thing VB lacks, integration with an external page. Why not give us easier ways to do these sort of things VB ?? tips/guides templates anything.........
thanx for this addon i will play with it to see if i can use it
Great work. really nice.
Hurray!!!!!!!!!!!
"Installed" & "Nominated" because it works with 3.7.x also.
I do not put people in power who I can not trust.
Do you ? If you do, make sure you back up.
I'll still take this for a spin for when I next need to do some PHP stuff. Thanks!
#If you have any other info about this subject , Please add it free.# |
Posted in xn--oq0a.com | edit