PDA

View Full Version : Php in templates


blueuniverse
10-25-2004, 06:48 AM
Basically, I want the function to be able to use PHP in the template system.

Would anybody be able to do this?

Johnny
10-25-2004, 12:40 PM
<a href="http://www.vbulletin.com/docs/html/main/templates_phpinclude_start" target="_blank">http://www.vbulletin.com/docs/html/m...pinclude_start</a>

vb docs explains it all.

blueuniverse
10-25-2004, 12:49 PM
Ok, so if I had a load of code, that I wanted to be displayed on one page only, I'd have to include it on every page?

Colin F
10-25-2004, 01:02 PM
Ok, so if I had a load of code, that I wanted to be displayed on one page only, I'd have to include it on every page?
No. Use a templateconditional in the form of:
<if condition="THIS_SCRIPT == bla">include(foo.php);</if>

Zachery
10-25-2004, 02:04 PM
No. Use a templateconditional in the form of:
<if condition="THIS_SCRIPT == bla">include(foo.php);</if>
You cant do that, and you cannot use php in the templates, you need to hack the files :)

blueuniverse
10-27-2004, 07:19 AM
So is there, absolutely no way to do it at the moment. If there isn't, would anybody be kind enough to make a hack?

Andreas
10-27-2004, 07:39 AM
As already said, you can't use PHP in templates (except a few functions in <if ...>-statements.

What you can do is put code in phpinclude_start|end, you can also do this conditional by using


if (THIS_SCRIPT == 'foobar') {
// Do smth for that specific page
}


Modifying vB so it is possible to use PHP in templates generally is a bad idea due to security issues.

blueuniverse
10-27-2004, 07:43 AM
Well, Zachery just said

You cant do that, and you cannot use php in the templates, you need to hack the files

It may be a bad idea security wise, but I do need to find some way of getting this code onto some pages (maybe not through templates) as I need the code to use the styles that the user has set.

Andreas
10-27-2004, 07:45 AM
Hmm ... and what's the problem with putting the code in phpinclude_start?

blueuniverse
10-27-2004, 08:57 AM
So in the PHP start template, I'd put what (if I had loads of code, where would it go in the code you gave me).


if (THIS_SCITPT == 'foobar') {
// Do smth for that specific page
}


It just seems weird having to put all the code for each page in the php include start template, when I only need it on one page.

Andreas
10-27-2004, 09:30 AM
Well, the other option would be to edit the PHP file for that specific page(s).

What exactly do you want to do?

blueuniverse
10-27-2004, 09:44 AM
Well, basically I have a links script. (shown here (http://www.blueuniverse.co.uk/links/))

The script is in the middle of the page, and I want this to be on my forums (http://www.rouseindahouse.com), using the template (header and footer) of the style my visitors are using.

Andreas
10-27-2004, 01:31 PM
https://vborg.vbsupport.ru/showthread.php?t=60403
http://www.vbadvanced.com/products.php?do=productinfo&p=2

blueuniverse
10-27-2004, 01:40 PM
I don't want a new links script though, as I paid specially for a coder to do the one I have for me.

Andreas
10-27-2004, 01:55 PM
Well, then i'd suggest you include global.php and create some custom templates for this script.