Announcement

Collapse
No announcement yet.

Using php in Actinic 10

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using php in Actinic 10

    Hello wonder if anyone can help.

    We want to use some of the dynamic menus from our wordpress site in the outer template of our actinic site.

    So we have created a customized .php file called snip-right-sidebar.php which does what we want and added this line of code into our actinic outer template ...

    block <?php require("/home/indigohe/public_html/snip-right-sidebar.php");
    ?> /block

    The block is set to php=false (because we want it parsed each time when served not by Actinic before upload)

    However when uploaded it doesn't work. If I view source then I can see the php code appearing there, not parsed?

    Presumably there is a setting or .htaccess command I need to make it work but can't suss it out.

    Any ideas?
    Steve Indigo

    Indigo Herbs of Glastonbury

    Indigo Herbs Blog

    #2
    Steve,

    Which php code is 'appearing there'? I'd imagine it's the code you've given above rather than the content of snip-right-sidebar.php.

    I haven't played with this in Actinic, but it doesn't sound like it would work. Actinic publishes .html files, so unless you've configured your web server to treat .html files as script files, then it wouldn't parse the <?php within then, which in your case wouldn't initiate the 'require' command. (edit: unless you're setting your page names with .php within actinic of course - which seems to cause problems previewing them within actinic according to the v9 forum.)

    Also, I think, by setting php=false, you might be letting Actinic html-encode the php command, so it's not even a command any longer, just a string of text.

    What was the url of the site?

    Comment


      #3
      Assuming you're running on Apache, you can add a line to your htaccess to parse html files as php.

      AddType application/x-httpd-php .php .html

      However, this will only work in the non-cgi parts of the site, so you'll have to use a different outer template for the checkout, etc.

      Comment


        #4
        You don't need any block around an external PHP link. Just the plain <?php ... ?> inside a layout is enough.

        Of course, you need to be able to parse whatever pages this appears on as PHP as per the posts above.

        Note (again mentioned above) that many pages (Search, Cart, etc) are served from cgi-bin Perl scripts and parsing PHP there will be tricky.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          First off thanks for the replies...really useful pointers there

          The URL is www.indigo-herbs.co.uk

          The code that was appearing there was
          PHP Code:
          <?php require("/home/indigohe/public_html/snip-right-sidebar.php");?>
          (ie un-parsed php)

          I tried adding

          Code:
          AddType application/x-httpd-php .php .html
          to the .htaccess file but that didn't work. However this was the right approach and eventually after trying a number of possibilities it turned out that the correct code for our Apache server is

          Code:
          AddHandler application/x-httpd-php5 .html .htm
          Hooray!!!

          So it was now producing errors because Actinic is appending the path in the php statement such that it appeared on the server as

          PHP Code:
          <?php require("acatalog//home/indigohe/public_html/snip-right-sidebar.php");?>
          We couldn't work out how to stop Actinic from doing this so we have simply moved snip-right-sidebar.php to the acatalog file and changed the path in the code (in actinic) so it all comes out ok ... go check it out on our live site www.indigo-herbs.co.uk Actinic-Wordress integration.

          Of course this is not really the perfect solution. Does anyone know how to make actinic leave the path alone?

          Also as above, it doesn't work in the search results or cart pages... how would we go about making this work?
          Steve Indigo

          Indigo Herbs of Glastonbury

          Indigo Herbs Blog

          Comment


            #6
            I'd imagine your problem is the actinic basehref getting involved, only way you generally get round that is to hard code the full url. I think you will need Javascript to get the php on the cart pages, i'd give that one a miss if i were you. Can you just blockif the sidebar on these pages instead to remove them?

            Comment


              #7
              Does anyone know how to make actinic leave the path alone?
              Try (as Lee suggests):
              Code:
              <?php require("http://www.indigo-herbs.co.uk/home/indigohe/public_html/snip-right-sidebar.php");?>
              Note that the URL above may be wrong and "http://www.indigo-herbs.co.uk/snip-right-sidebar.php" may be enough.


              Alternatively you could try stripping out an inadvertant acatalog/ via something like:
              Code:
              <?php require(str_replace("acatalog/", "", "/home/indigohe/public_html/snip-right-sidebar.php"));?>
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Hi ... thanks again for the feedback.

                Tried the different path options but the presence of http:// seems to break the php ... ie the server is not parsing it.

                However it works now so although my geeky tendencies would like me to invest more time in finding the perfect solution, theres not really a business case...

                Unlike the CGI bin problem. There is no mess created as the code seems to be just ignored. So if it were just for the checkout and search pages we would not be bothered but it also means it won't work for logged in users! D'oh.

                Of course if they follow any of our static links they get served non-CGI pages and all is ok but if they click through Actinic generated links (like best sellers) the menus don't appear.

                This is kind of a major issue for us as we may want to use other PHP applications in future and want to integrate them into Actinic...

                Need to come back to this once the home page refresh is finished and newsletter sent.

                Any ideas appreciated

                www.indigo-herbs.co.uk
                Steve Indigo

                Indigo Herbs of Glastonbury

                Indigo Herbs Blog

                Comment

                Working...
                X