ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

PHP inside channel entry

March 26, 2012 2:12pm

Subscribe [2]
  • #1 / Mar 26, 2012 2:12pm

    xpo60rj

    11 posts

    I wanted to use php inside my channel entries. Is this possible in EE2? I’ve set my template to allow php on output and the Default Text Formatting for my field is set to none. Yet php does not seem to parse.

    I know in EE1 you would need a few plugins to do this but I did not see EE2 versions of these plugins….

     

  • #2 / Mar 26, 2012 2:38pm

    glenndavisgroup

    436 posts

    Hi xpo60rj,

    What version of EE are you using?

    Can you post your EE code please?

    Thank you,

    Mike

  • #3 / Mar 26, 2012 2:47pm

    xpo60rj

    11 posts

    EE 2.4


    In my template:

    {exp:channel:entries channel="mychannel" limit="1"}                                  
    {body}
    {/exp:channel:entries}


    In my entry for body field:

    <?php 
    
    $test = "test";
    echo "$test";
    echo "hello world $test";
    
    ?>

     


    It just spits out the code.

  • #4 / Mar 27, 2012 11:10am

    Shane Eckert

    7174 posts

    Hello xpo60rj,

    Thank you for posting your question here on the ExpressionEngine forums.

    Allowing PHP in a template means that you can put PHP in the template code, but not in a channel field being displayed by that template.

    Does that make sense?

    Please let me know if there is anything else I can do to help.

    Cheers,

  • #5 / Mar 27, 2012 12:42pm

    xpo60rj

    11 posts

    Yes…I was hoping there was a workaround for EE2 like their was for EE1 http://expressionengine.com/wiki/PHP_In_Entries. Having to hardcode my content with the template looks to be my only option now even though it constantly changes.

  • #6 / Mar 30, 2012 5:03pm

    Shane Eckert

    7174 posts

    Hey xpo60rj,

    I looked around Devot://ee for an Add-On but no luck.

    Sorry I could not be of more help.

    Have a great weekend.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases