Results 1 to 4 of 4
  1. #1
    Newbie
    Join Date
    August 19th, 2005
    Posts
    4
    PHP code in AE Templates or Formats?
    Is there any way to include a PHP code inside a AE Templates or Formats?

    I modified one of the formats and wrote some php code in it, but the result page can't read my php code. The view source still shows <?php ?>

    Javascript works but I also want the search engine spider to read the content generated by the code.

    Any help or advice is appreicated. Thank you!

  2. #2
    Newbie
    Join Date
    August 19th, 2005
    Posts
    4
    I forgot to mention that I've already tried ssi such as <!--#include virtual="/phpscript.php"--> to pull out another file with my script. But if I use a file like this and not AE Templates or AE Formats, I can't use "AE defined" variables such as {details.ourprice}, {title}, {details.manufacturer} in that new file.

    I would like to use those AE-defined variables inside my php code. Is this posssible?

  3. #3
    ABW Ambassador cusimano's Avatar
    Join Date
    January 18th, 2005
    Location
    Toronto, Canada
    Posts
    1,369
    (I haven't tried this myself so I could be wrong) Short answer: product variables {details.*}, yes via the formatting codes; page/script variables, yes via template or formmatting codes

    ae.pl is a perl program. So you cannot put raw PHP statements in the template since it is the server's Perl interpreter that is processing ae.pl -- not the server's PHP interpreter. As you've indicated, the way to include PHP output (not PHP statements) is to use an SSI that calls your PHP script.

    You can pass variables to your PHP script via parameters of the SSI virtual= value, e.g.:

    virtual="/phpscript.php?title={title+}"

    The + is required so that the value of {title} is converted for use in a URL (the value of virtual= is a URL). Your PHP script would then take the parameter and use it. You can pass any number of variables that way; just seperate each with the standard & parameter separator: ?abc={var1+}&def={var2+}&...

    However, the {detail.*} variables are only accessible inside the cell formatting codes. They are not accessible at the time of SSI processing. SSI processing is the last substitution performed; no other substitutions are done after it. So you have to put the SSI inside the cell formatting code (e.g.: format.list1.cell or format.grid.cell). Note that if there are 10 products shown on the page, then your PHP will be called 10 times.

    Yours truly,
    Cusimano.Com Corporation
    per: David Cusimano

  4. #4
    Newbie
    Join Date
    August 19th, 2005
    Posts
    4
    It worked beautifully! Passing variables to a file was my solution.

    Thank you!

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Possible to put php in dyse templates?
    By jazzylee77 in forum Cusimano.com Scripts
    Replies: 4
    Last Post: December 28th, 2007, 10:00 AM
  2. php code
    By tvcrazyman in forum GoldenCAN
    Replies: 4
    Last Post: January 19th, 2006, 05:22 PM
  3. Will WebMerge work with PHP Templates
    By aprillougheed in forum WebMerge (Fourthworld.com)
    Replies: 4
    Last Post: February 16th, 2004, 08:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •