This is really perfect. Because your plugin automatically includes the PHP start and end tags, I can just use the same field for the display as for the output:
<pre>{exp:pretty_php}
{php_snippet}
{/exp:pretty_php}</pre>
<h5>Output:</h5>
{exp:allowphp}
{php_snippet}
{/exp:allowphp}
Because pretty php encodes the output, I don’t have to worry about encoding, either. So now I don’t have redundant fields. 😉
Thanks Lodewijk! This is working out really well. 😉
Hello. I have been trying to do this, and there is no way to make it work. When you said:
{exp:allowphp}
{php_snippet}
{/exp:allowphp}
You were implying that {php_snippet} is your custom field? … and then all PHP code that you write in this field will print properly, because it doesn’t work for me.
Please, if you can give me hand with this. I need to be able to parse PHP inside the fields, so that I can make a little icon that will appear when the post has been updated. BTW, if you know a different way to achieve this, I’ll appreciate the help too.
Thanks a lot
Atiosis
Atiosis - you’d be much better, and more secure, creating a plugin to place an image on updated posts, or using the last edit date, rather than allowing PHP in your entries.
Yes, {php_snippet} is the custom field.
You didn’t say what you have in your template, you are putting the actualy plugin code there, without the <?php and ?> correct? The plugin is still working wonderfully on my site.
Hi Lisa,
How can I use the {edit_date} to do this. and the other issue is that, after two weeks the “update” graphic should dissapear.
Also, what I am writing is this:
{exp:allowphp}
{body}
{/exp:allowphp}
… and is not working; and then I am trying to write PHP codes into the body field, as a part of the post. is that the way it should be?
I don’t know anything a bout PHP nor any language but HTML. :( so I am very much limited to something that already has been done.
thanks.
Yes, I used the {exp:alllow} code into the template. I want this code to parse this PHP code; which I don’t remember where I got from:
<?php
global $LOC;
$mytime = $LOC->set_localized_time();
?>
<?php
global $LOC;
$mytime = $LOC->set_localized_time() - "{entry_date}";
if ($mytime < 1209600)
{
?>
<img src="http://131.94.118.90/expengine/imgs/newicon.gif" alt="" />
<?php
}
?>
The problem is that as soon as I place the {exp:alllow}{body}{/exp:alllow}, the content of that field wont show. If I parse the PHP on the same template works perfeclty, but in that case I rather just use <?php ?> 😖
I am a bit confused.
You don’t include the <?php or the ?> - as per some of my earlier messages in the thread.
I’m still not sure why you’re going this route rather than in the template. It does open up a security issue on sites with more than one author and really isn’t needed for what you’re doing.
Hi Lisa
I posted a note the other day about being able to parse straight into post rssfeeds using PHP straight out of the publish form. Then i found this thread…What i am trying to achieve is parsing Simplepie del.icio.us, and Flickr feeds straight out of regular posts. I mentioned as an example, the WP “execPhp” plugin, used together with the WP-Simplepie plugin. So, if i understand correctly, with the “PHP EE Plugin” installed, one can apply php straight inside a non-formatted custom field?
Sorry Lisa, i’m a bit confused…you mean, you hight recommend this, EXCEPT if other users can have access to the weblog?…
On a similar subject, i got a reply from Derek:
Well to do what you are trying to do, you’d need not the PHP plugin but the Allow EECode plugin, and its tag would go in the template, not in the field. But that means that anyone with publishing rights can use any EE tag they want in entries. Here’s an idea: why not include the Magpie tag in your Entries tag, and just use feed URLs in an unformatted custom field. Simplified example:So to add the pMachine News feed to a particular entry, in the custom field named “feed_url” you would simply publish: http://www.pmachine.com/news.xml{if feed_url != ''} {exp:magpie url="{feed_url}" limit="10" refresh="720"} <ul> {magpie:items} <li><a href="http://{magpie:link}">{magpie:title}</a></li> {/magpie:items} </ul> {/exp:magpie} {/if}
I did paste this into my template EE tag entry…but still no luck… any idea?
Laurents, let’s keep that conversation threaded over on that topic, please.
Hi, I’m trying to use this formmailer from stadtaus which works great. When I’ve used it in the past I’ve hardcoded the link in EE to point to the /form/ folder on my server which includes the index.php files and all the relevant files that makes the formmailer function (html templates etc). So the static page appears to be all tied in. I’ve been trying to get the form into an entry (or even a template) so I can still have all my other EE facilities in place.
As far as I know I’ve got this plugin set up…
Aaaand its just showing a blank page
Saying that tho I tried using
echo (date("d F Y"))
Just to test if its working and it doesn’t show the date either. Need to get over this hurdle before I try and get the form mailer working I guess!
Can I PM somebody a login to have a check over what I’m doing wrong please?
Thanks
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.