Announcement

Collapse
No announcement yet.

Sticking Code into Templates?

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

    Sticking Code into Templates?

    Hello,

    I was wondering if I could stick code into the productline.

    I was thinking of allowing my server to parse html files as php files and then inserting the following code into the productline template so that a link would be generated for each item.

    I havnt really thought much about it - I just came up with it now. Would this work?

    PHP Code:
    $offer_id 'NETQUOTEVAR:PRODUCTREF';
    $ignore  'this';

    $query sprintf("SELECT name, product_url FROM clproducts WHERE offer_id='%s'",
       
    mysql_real_escape_string($offer_id),
       
    mysql_real_escape_string($ignore));

    // Perform Query
    $result mysql_query($query);


    // Use result
    while ($row mysql_fetch_assoc($result)) {
    $name $row["name"];
    $product_url $row["product_url"];

    echo( 
    "<p>$name<br></br>" .
    "(by <a href='$product_url'>$name</a>)</p>" );

    mysql_free_result($result);

    #2
    You can embed PHP in Actinic generated pages.

    There are some things to be aware of.

    You should go to View / Search Settings / Results and turn off "Highlight Located Text". Failing to do this will pass pages accessed via the search results through a Perl script and PHP code won't be interpreted.

    Use (undocumented) NETQUOTEVAR:PRODUCTREFERENCE instead of NETQUOTEVAR:PRODUCTREF, as the latter contains formatting and isn't the plain reference code.

    P.S. See http://www.drillpine.biz/v7php-test/...c_Products.php where I'm using PHP to provide alternative and filtered views of the catalog pages.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Ah Norm,

      You seem to have all the skills!

      Ok I tried it out but it had no effect. I put the code into act_productline.htm but it made no difference to the site. Where would I stick this code to have a link displayed above my buy it now button?

      M.

      Comment


        #4
        You may not be passing the page through PHP at all.

        Put a few echo "Hello World"; type statements into your code so you can see if it's executing.

        Anywhere in the Product Template that's within <span> ... </span> tags should do.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X