We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Allow PHP in posts.

Development and Programming

Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Can you post the weblog entries & plugin tag you’ve used? Just as a note, logins are really a last resort troubleshooting thing that we do - and with this, you’d have to ask the plugin author for that kind of help. But if you can post the template information we can try to help. =)

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

This is the template

{assign_variable:section="dpv"}
{assign_variable:page="Services Dynpos provide"}

{exp:snippets template="includes/head"}

{exp:weblog:entries weblog="services" limit="1"}
{descrip}{dyn-summary}{/descrip}
{pagetitle}{title}{/pagetitle}
{/exp:weblog:entries}
{/exp:snippets}

<body id="{section}">

<!-- Skip Nav link - see also relevant CSS -->
<a href="#nav">Skip to navigation</a>

<div id="outer-wrapper">

<div id="inner-wrapper">

<h1>Dynpos | {page} | {exp:weblog:entries weblog="services" limit="1"}{title}{/exp:weblog:entries}</h1>
    
<div id="header">

</div><!-- header -->


<div id="content">

<div class="intro-box">

{exp:weblog:entries weblog="services" limit="1"}

<h2>{title}</h2>

{if dyn-img}
/phpThumb/phpThumb.php?src={dyn-img}&w=155&h=155&zc=1
{/if}


{dyn-summary}

<div class="clear"></div>

</div><!-- intro-box -->

{exp:allowphp}

{dyn-body}

{/exp:allowphp}

{/exp:weblog:entries}

</div><!-- main-content -->

<div id="extra">

{exp:snippets template="includes/navs"}{/exp:snippets}

{exp:snippets template="includes/news"}{/exp:snippets}

{exp:snippets template="includes/subscribe"}{/exp:snippets}

</div><!-- extra -->


{exp:snippets template="includes/footer"}{/exp:snippets}

This is the wee bit of php I was testing in the {dyn-body} custom field

echo (date("d F Y"))

Without opening & closing php as specified

Is that enough to go on?

Thank you!

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Ok, lets try something.

Make a new template, put only this in it:

{exp:weblog:entries weblog="services" limit="10" disable="trackbacks|member_data"}
<h1>{title}</h1>
<h5>Input:</h5>
{dyn-body}
<h5>Output:</h5>
{exp:allowphp}
{dyn-body}
{/exp:allowphp}
{/exp:weblog:entries}

Now, make a new post and put only this into the dyn_body textarea:

echo "This is echo text inside the allowphp tag.";

and post a link for us to that template.

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

Here you go, I limited the entry to this one using entry_id

Link be here

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Now view source:

echo “This is echo text inside the allowphp tag.”

You said you set this to formatting: none - but it’s formatting it in xHTML which is why it’s not working. You’ll want to double-check that field’s formatting options, and us the checkbox to apply it to previous entries.

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

Ah apologies I am setting that field to none manually using the formatting menu. I forgot to do it for the example but its set to none on the original one I tried

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Well you’ll need to set it to none for our test post….

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Ah, I see that you did - and it appears that the plugin is working fine. I’m not sure what’s up with your original post but if you can get it to work straight out in a template and not in your entry, you might want to ask the author about it. = Also, make sure you have Admin -> Output and Debugging -> Errors on, so that you get an error rather than a blank page. That will help narrow down what’s going on.

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

Great thanks Lisa! Any ideas why this doesn’t work

echo (date("d F Y"))

That was my test initially

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
18 years ago
Lisa Wess's avatar Lisa Wess

Well, I don’t actually program in PHP - but did you try this in a template with PHP on, not using the plugin but just straight code. You might also use the error showing to debug this, as I mentioned before. =)

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

Yeah on the template with this

<?php echo (date("d F Y")) ?>

It works fine. Hmm i’lll keep trying. Thanks for all your help. I’ll be back with the mammoth php page that I actually want to put in the page soon!

       
Mikee Bee's avatar
Mikee Bee
179 posts
18 years ago
Mikee Bee's avatar Mikee Bee

Hi again, here is the php file I am trying to get into my entry. I realise I need to take the opening & closing php tags off and have done (although I’ve left them in the main file I have attached). My knowledge of php is zero so I’ve no idea what to look for. The allowphp plugin is working fine.

Thanks everyone.

       
UFBH's avatar
UFBH
3 posts
15 years ago
UFBH's avatar UFBH

I can’t seem to get the {allowphp} plugin to work with a progress bar php code. I’m sure it must be something in graph php, not EE. But, I don’t really know much php to be able to figure out what is going wrong.

I’ve got the following in my template:

{exp:allowphp}
{piggybank}
{/exp:allowphp}

I’ve got the following graph php in my weblog:

include('graphs.inc.php');
$graph = new BAR_GRAPH("pBar");
  $graph->values = "26481;95000, 50549;95000";
  $graph->labels = "Income, Expenses";
  $graph->labelBGColor = "";
  $graph->labelBorder = "";
  $graph->labelColor = "#990000";
  $graph->labelFont = "Georgia";
  $graph->labelSize = "11";
  $graph->absValuesPrefix = "$";
  $graph->barBGColor = "#FFFFFF";
  $graph->barColors = "#84F869, #990000";
  $graph->barWidth = 10;
  $graph->barLength = .2;
  $graph->percValuesColor = "#990000"; 
  $graph->percValuesFont = "Georgia";
  $graph->percValuesSize = 11;
  echo $graph->create();

You can see what it should look like here: http://www.ufbh.org/donate.php

What I’m getting is absolutely nothing. No table or graph is created. It’s just blank in the div. I’ve tried all the combinations of suggestions I’ve found in the forums, wiki, etc. Nothing seems to work.

Any suggestions? And, I’d be happy to share the graph.inc.php file, but I can’t figure out how to attach it…

Thanks in advance!

Jennifer

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

You would need the full server path for your include line.

That said - I’m definitely not seeing why you would have this in an entry and not in the template….

       
UFBH's avatar
UFBH
3 posts
15 years ago
UFBH's avatar UFBH

By full server path, what do you mean? I’ve tried various ways of connecting to the file, including connecting to where I have it online currently. Nothing seems to work.

I considered having this in the template only, but I need to be able to change values in the code pretty frequently. Down the line, it might be another volunteer doing the website and I thought it better to have it in a weblog instead of a template where much more could get screwed up.

Jennifer

       
1 2 3 4

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.