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.

Allow PHP plugin and PHP includes

July 11, 2007 8:48pm

Subscribe [0]
  • #1 / Jul 11, 2007 8:48pm

    Geof Harries

    109 posts

    I’d like to use (and have tried with no success) the Allow PHP plugin with a PHP include statement that calls an external file from another host. Problem is, I can’t get the include statement to parse. I just end up with a blank area.

    My very simple include statement looks like:

    <?php include ("http://nameofservice.com/3LTBDARBEO.html"); ?>

    So then when I apply the Allow PHP it turns into this, or at least I assume this is correct:

    {exp:php}include ("http://nameofservice.com/3LTBDARBEO.html");{/exp:php}

    But as I said, it doesn’t parse. I have to the use the much slower Javascript option that they provide. Is my syntax wrong or am I missing something?

    thanks

    geof

  • #2 / Jul 11, 2007 8:54pm

    Lisa Wess

    20502 posts

    2 things here -

    1) The plugin tags go around the custom field in your template.

    2) Make sure you test this first in your template, many hosts do not allow php includes of full URLs.

  • #3 / Jul 11, 2007 10:36pm

    Geof Harries

    109 posts

    Hmm, I am not using a custom field. I am simply placing the include directly in the template code. What do you suggest for a custom field?

    Just so you have a reference, the website is Urban Yukon. On the homepage is where the 3rd party include is located but on the members pages, say for instance, mine , I use the Magpie plugin with its own unique parameters. I can’t use Magpie on the homepage because it pulls in feeds from 40 different URLs.

    thanks

    geof

  • #4 / Jul 11, 2007 10:49pm

    Sue Crocker

    26054 posts

    Geof, if you are wanting to do a simple PHP include, make sure PHP parsing is turned on and set to parse on input.

    I’ve done an example here:

    EEHowTo:// Sitemap

    <? include("http://www.liveinlaurel.com/index.php/share/index/"); ?>
    
    {exp:weblog:entries  show_pages="only"}
    <a href="http://{page_url}">{title}</a>
    
    {/exp:weblog:entries}

    (Testing showing my Pages links as well.)

    Disclaimer: This is a testing page. It may not stay where it is at.

  • #5 / Jul 18, 2007 11:47am

    Geof Harries

    109 posts

    Thanks, I’ll try both out and see what happens.

  • #6 / Jul 19, 2007 1:39pm

    Geof Harries

    109 posts

    Lisa,

    I have encountered a very weird problem.

    On my test page I’m successfully using the PHP plug-in like this with the feed output exactly how I want it:

    {exp:php}include ("http://app.feeddigest.com/digest3/3LTBDARBEO.html");{/exp:php}

    Then, on the current homepage I’m using the javascript option.

    All looks fine, so I copy + paste the PHP version into my index template and…nothing happens. The data disappears on both index and index2.

    If I switch the homepage back to the Javascript option, the data re-appears in both locations. So it seems that I can’t have the plug-in active on multiple pages, I think.

    Do you have any idea of what could be going on?

  • #7 / Jul 19, 2007 2:02pm

    If you’re entering the code directly into the template, rather than as a custom field in an entry, why use the php plugin at all?

    Simply enable php for your template, and go back to using the normal <?php and ?> codes rather than the plugin tag.

    Is there something I’m missing here?

  • #8 / Jul 19, 2007 2:15pm

    Geof Harries

    109 posts

    I’ve tried the custom field route with “aggregateurl” between the exp:php tags, the method in my post above plus the normal PHP style and it all has the same result. I’m wholly stumped.

  • #9 / Jul 19, 2007 2:27pm

    Lisa Wess

    20502 posts

    Geof, I’m really lost as to what is happening, but you’re calling in a third party service, with a third party plugin, and many hosts do not support includes with full URLs.  I might suggest you post a detailed question in the how-to forum to see if anyone has any input on this for you.

  • #10 / Jul 19, 2007 6:46pm

    Sue Crocker

    26054 posts

    Geof, see this link. Embed PHP

    I turned on PHP in my template set to parse on input.

    <? include("http://www.liveinlaurel.com/index.php/share/index/"); ?>
    
    <? include("http://app.feeddigest.com/digest3/3LTBDARBEO.html"); ?>

    I used PHP directly, not via {exp:php}. You shouldn’t have to use it.

    NOTE: It very well could be your host. This sample is hosted on EngineHosting, and it works as it should.

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

ExpressionEngine News!

#eecms, #events, #releases