Announcement

Collapse
No announcement yet.

Using php to write to a variable

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

  • Using php to write to a variable

    Client uses a lot of inline styles but we need a stripped version for Feefo

    If I write this:

    Code:
            <actinic:block php="true">        
            $prodinput = '<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />';
            $bareproductdescr = str_replace("!!","",$prodinput);
            echo strip_tags($bareproductdescr);
            $bareproductdescr = '<actinic:variable encoding="perl" name="BareProductDescription" selectable="false" />';
            echo ('<actinic:variable encoding="perl" name="BareProductDescription" selectable="false" />');
            </actinic:block>
    The stripped description prints but how can I get <actinic:variable name="BareProductDescription" />'; to hold the value so I can use it in the feed xml files instead of prodyct description?

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

  • #2
    SellerDeck variables are read-only within the inbuilt PHP. You cannot assign anything to them without directly manipulating the database. And the way user variables are held is rather complex. Search the forum for "odbc_connect" and you should find some examples.

    Why not look at whatever generates the Feefo code and modify that.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


    • #3
      Got this far:

      Code:
          $connect = odbc_connect("ActinicCatalog16","","");
          $query = "SELECT [Product Description] FROM [Product] WHERE [Product Reference]=<actinic:variable name="ProdRef" />";
      Don't know what to do with it. The examples are lists of items rater than extracting one.
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


      • #4
        I am trying to avoid the client having to write two product descriptions. one plain and one with whistLes and bells.
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


        • #5
          If you are able to get BareProductDescription to show in the feed then you don't need to fiddle with the database. Just use the code in your post #1 in the feed generation.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


          • #6
            Rather than SELECT I think you want to be doing an UPDATE. As an example, I do the following to set the stock quantity in an excel macro (not in PHP so don't copy and paste .)

            Code:
             stSQL1 = "UPDATE Product SET Product.[nStockOnHand] = " & AvailableStock & " WHERE Product.[Product Reference] = '" & ProductItem & "'"
            
            ' execute the sql
            
            .Execute stSQL1
            I agree with Norman though. The best approach would be to run your stripping code in the feed generation if you can. I haven't used the Sellerdeck generated feed yet, I've always created my own.
            -----------------------------------------

            First Tackle - Fly Fishing and Game Angling

            -----------------------------------------

            Comment

            Working...
            X