<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

      <title>Comments on: How to Get PHP Working Inside Template</title>
      <link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template/</link>
      <description>Comments on Ask MetaFilter post How to Get PHP Working Inside Template</description>
	  	  <pubDate>Thu, 30 Nov 2006 19:32:12 -0800</pubDate>
      <lastBuildDate>Thu, 30 Nov 2006 19:32:12 -0800</lastBuildDate>
      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>

<item>
  	<title>Question: How to Get PHP Working Inside Template</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template</link>	
  	<description>Help me figure out how to add PHP into a template. &lt;br /&gt;&lt;br /&gt; I&apos;ve purchased a php script and in the admin interface their is template area that you can change how the page looks &lt;a href=&quot;http://bleucube.com/1.jpg&quot;&gt;(See Picture)&lt;/a&gt; using html and predefine codes. &lt;br&gt;
&lt;br&gt;
When I insert PHP script into the template area, it shows up as plain text on the site.  I&apos;ve emailed the developer but haven&apos;t heard any response.  Anybody know how I can make PHP actually execute?&lt;br&gt;
&lt;br&gt;
Thanks!</description>
  	<guid isPermaLink="false">post:ask.metafilter.com,2008:site.52115</guid>
  	<pubDate>Thu, 30 Nov 2006 19:15:01 -0800</pubDate>
  	<dc:creator>bleucube</dc:creator>
	
	<category>PHP</category>
	
	<category>Template</category>
	
</item>
<item>
  	<title>By: matthewr</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787192</link>	
  	<description>That looks like some kind of custom templating system, where the script will replace &lt;code&gt;%title%&lt;/code&gt; with the title, for example. The instructions above the field don&apos;t mention using PHP in the template area.&lt;br&gt;
&lt;br&gt;
I expect the script treats the text from the template area as plain text, and does a search-and-replace to replace &amp;quot;%title%&amp;quot; with whatever the title is.&lt;br&gt;
&lt;br&gt;
Since it&apos;s being treated as a plain text string, any PHP you put in there won&apos;t be executed. Without fully understanding the script and being able to modify it, it looks like you&apos;re out of luck. The developer evidently didn&apos;t intend for people to put PHP in the template.&lt;br&gt;
&lt;br&gt;
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 &lt;code&gt;eval()&lt;/code&gt; function which any sensible developer wants to avoid at all costs, since it can cause security nightmares.&lt;br&gt;
&lt;br&gt;
What are you trying to do that requires PHP? Whatever it is, you&apos;re probably better off doing it in another part of the script than the templating system.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787192</guid>
  	<pubDate>Thu, 30 Nov 2006 19:32:12 -0800</pubDate>
  	<dc:creator>matthewr</dc:creator>
</item>
<item>
  	<title>By: AmbroseChapel</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787193</link>	
  	<description>Unless it specifically says you &lt;em&gt;can &lt;/em&gt;do it, I would assume you can&apos;t.&lt;br&gt;
&lt;br&gt;
That script uses PHP to create pages. You want to add PHP inside the PHP, which could potentially cause all kinds of problems. I would suggest that the only thing you&apos;re allowed to use is plain HTML and those variables defined for you.&lt;br&gt;
&lt;br&gt;
But tell us what system it is and we can look into it in more detail.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787193</guid>
  	<pubDate>Thu, 30 Nov 2006 19:32:21 -0800</pubDate>
  	<dc:creator>AmbroseChapel</dc:creator>
</item>
<item>
  	<title>By: matthewr</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787195</link>	
  	<description>&lt;small&gt;not a bad idea on the developers &lt;strong&gt;[part]&lt;/strong&gt;&lt;/small&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787195</guid>
  	<pubDate>Thu, 30 Nov 2006 19:32:55 -0800</pubDate>
  	<dc:creator>matthewr</dc:creator>
</item>
<item>
  	<title>By: bleucube</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787514</link>	
  	<description>The script is &lt;a href=&quot;http://13scripts.com/#babeloggerv3&quot;&gt;Babeloggerv3&lt;/a&gt;, I&apos;m using it for a link dump site.  Would it be possible to just add the PHP script to the config page were the rest of the definitions are, so that way I could add something lik %TOP10% and it would run that script?&lt;br&gt;
&lt;br&gt;
Thanks for the answers so far!</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787514</guid>
  	<pubDate>Fri, 01 Dec 2006 06:15:22 -0800</pubDate>
  	<dc:creator>bleucube</dc:creator>
</item>
<item>
  	<title>By: ReiToei</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787515</link>	
  	<description>A templating system like that is designed so that people should not be allowed to arbitarily insert their own PHP code. The security risks are too great.&lt;br&gt;
&lt;br&gt;
I imagine you would be able to achieve what you want by creating your own custom %foo% that does what you want by  working backwards in the source of the &apos;predefined codes&apos;.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787515</guid>
  	<pubDate>Fri, 01 Dec 2006 06:15:44 -0800</pubDate>
  	<dc:creator>ReiToei</dc:creator>
</item>
<item>
  	<title>By: Bael&apos;Gar</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787526</link>	
  	<description>The problem you&apos;re running up against is that PHP works by parsing the script once. To get the code you&apos;re putting in the template to run, PHP would have to parse the script a second time. And that isn&apos;t going to happen. It&apos;s a chicken and egg problem. Your chicken is laying an egg, and then you want the egg to lay another egg. Which, of course, would be an abomination against God, which PHP doesn&apos;t allow for.&lt;br&gt;
&lt;br&gt;
The developer would have to make some non-trivial modifications to the application to make it handle PHP or plain text. But of course I&apos;ve never seen the code, so I&apos;m just guessing.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787526</guid>
  	<pubDate>Fri, 01 Dec 2006 06:24:45 -0800</pubDate>
  	<dc:creator>Bael&apos;Gar</dc:creator>
</item>
<item>
  	<title>By: IronLizard</title>
  	<link>http://ask.metafilter.com/52115/How-to-Get-PHP-Working-Inside-Template#787548</link>	
  	<description>So besides your other problems, where&apos;s your opening and closing tags for the php script?</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.52115-787548</guid>
  	<pubDate>Fri, 01 Dec 2006 06:59:11 -0800</pubDate>
  	<dc:creator>IronLizard</dc:creator>
</item>

    </channel>
</rss>
