Announcement

Collapse
No announcement yet.

Adding Custom Php

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

    Adding Custom Php

    I am trying to add some php to the <head> tags of all my pages. However each page needs to be slightly different, as its for statistical analysis.

    Is what I am trying to do possible?

    I have tried adding it to the templates, but as you would expect most pages use the same template, so this will not work.

    Any help would be much appreciated

    Thanks
    Dave.

    www.xcelcius.com
    www.xcelcius.com
    Thermal Underwear thats gives protection down to -25c

    #2
    Assuming your pages are working with the PHP have you tried using a CUSTOMVAR in the <head> of the Act_Primary and Act_Brochure ... you can then specify which version of the code you require on a section (page) by section basis


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      Hi jont,

      Thanks for the quick response. I have added a customvar and tried it out. Had a few problems with the !!< >!! working with php, as they show on the page while being previewed but when the page is parsed on the website they disappear.

      One problem i have found is, i cannot find where to add it for pre-shop pages. There does not seem to be a properties section for these.

      Dave.

      www.xcelcius.com
      www.xcelcius.com
      Thermal Underwear thats gives protection down to -25c

      Comment


        #4
        i have found that its wiser to 'include' your php, by turning on shtml and ssi for your standard html in your .htaccess file.

        <!--#include virtual="/code.php" -->

        where code.php resides in the root. not the acatalog folder.

        also, you can use the pages url as reference?

        available in ssi as: <!--#echo var="DOCUMENT_URI" -->

        i'v used a false image call to trigger php previously, to great success.

        Code:
        <img src="code.php?url=<!--#echo var="DOCUMENT_URI" -->" width=1 height=1>

        Code:
        AddType text/x-server-parsed-html .htm
        AddType text/x-server-parsed-html .html
        adding these lines to your .htaccess makes all htm and html files act as if they are php.

        you can simply use php in your !!< <% php %> >!! then. I assume, lol.

        additionally, 'act_brochureprimary' i think is the out of shop pages main template, um, i thnk.

        Comment


          #5
          The php i added works fine, so there is no need to alter the .htaccess file. The problem i have is if i just "edit" the template for pre-shop pages, the php code i put in, will be the same for all pages. Whereas i need it to be different for every page.

          The properties tab for shop pages works great, as i can put my own code in for every page, but this is not possible for pre-shop pages.

          Dave.
          www.xcelcius.com
          Thermal Underwear thats gives protection down to -25c

          Comment


            #6
            You can

            1) Use different Primary Templates for each brochure page (via Page Details / Layout)

            2) Your PHP can examine it's own URL and respond differently depending on that.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment

            Working...
            X