How to Get PHP Working Inside Template
November 30, 2006 7:15 PM
Subscribe
Help me figure out how to add PHP into a template.
I've purchased a php script and in the admin interface their is template area that you can change how the page looks
(See Picture) using html and predefine codes.
When I insert PHP script into the template area, it shows up as plain text on the site. I've emailed the developer but haven't heard any response. Anybody know how I can make PHP actually execute?
Thanks!
posted by bleucube to computers & internet (7 comments total)
%title%with the title, for example. The instructions above the field don't mention using PHP in the template area.I expect the script treats the text from the template area as plain text, and does a search-and-replace to replace "%title%" with whatever the title is.
Since it's being treated as a plain text string, any PHP you put in there won't be executed. Without fully understanding the script and being able to modify it, it looks like you're out of luck. The developer evidently didn't intend for people to put PHP in the template.
This is not a bad idea on the developers, since the whole point of these kind of templating systems is to insulate you from the raw PHP. Allowing PHP to be executed would probably necessitate use of the
eval()function which any sensible developer wants to avoid at all costs, since it can cause security nightmares.What are you trying to do that requires PHP? Whatever it is, you're probably better off doing it in another part of the script than the templating system.
posted by matthewr at 7:32 PM on November 30, 2006