Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: How to include php code into a product description

    There are many ways to get around without putting php code inside product description. Please provide these info:
    1. Does this flash appear on all product desc, or just some?
    2. Do you currently use product model (or have plan to use)? (I ask this question for a specific reason)
    3. Can you provide a sample description? (with flash)
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  2. #2
    Join Date
    Oct 2006
    Posts
    149
    Plugin Contributions
    0

    Default Re: How to include php code into a product description

    Here is the whole story.

    1) I am using tabbed products, while one of the tabs is the flash movie with the specific xml file (different for different products) here is an example of such a code via object tag:

    Code:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="test3" align="middle">
    <param name="allowScriptAccess" value="sameDomain" /><param name="flashVars" value="currxml=flash/sample.xml" />
    <param name="movie" value="flash/~main.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="flash/~main.swf" quality="high" flashVars="currxml=flash/sample.xml"  bgcolor="#ffffff" width="550" height="400" name="test3" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    here is the "flash/sample.xml" variable, which is unique for each product

    2) What I need is to make it more simple on the end-user side - just to include something like "myfunction('flash/sample.xml')" instead of the whole object

    3) the easiest way woud be to make a jscript function, which writes the whole object, but I cannot use jscript directly, because each priduct page is loaded via ajax. This means that all the jscript write directive are not executed before the browser renders the ajax generated code

    One of the solutions would be to delay that jscript execution (what I have to do for other functions) or do it on a server-side via php.

    NOTE. I do not use a product model. What is your idea? to use that field?

  3. #3
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: How to include php code into a product description

    Yes, to use that field.
    Say you have product A, and we give that product the model: abc.xml.

    Now in your product_info template:

    We can do something like this (Im writing in pseudo code here)
    PHP Code:

    // checking if the product has model
    if(exist($pmodel) && strlen(trim($pmodel))>0){
    $flash_obj '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="test3" align="middle">
    <param name="allowScriptAccess" value="sameDomain" /><param name="flashVars" value="currxml=XML_LINK" />
    <param name="movie" value="flash/~main.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="flash/~main.swf" quality="high" flashVars="currxml=XML_LINK"  bgcolor="#ffffff" width="550" height="400" name="test3" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>'
    ;
    $flash_obj str_replace('XML_LINK'$pmodel$flash_obj);

    echo 
    $flash_obj;

    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  4. #4
    Join Date
    Oct 2006
    Posts
    149
    Plugin Contributions
    0

    Default Re: How to include php code into a product description

    Thank you. It makes sense. The only problem here is that I am using tabbed product mod and the object output needs to be entered after a certain tab.

    I am thinking about some other solution (Joomla mambot like). Let's say the whole product description is a string like xxxxx{php code}yyyyyy. We can first extract a substring {php code} and then make something like:

    echo $str1;//$str1 = xxxxx
    eval($str2); //$str 2 = php code
    echo $str3; //$str3 = yyyyy

    In this case, we could easily make a library of different functions to be inserted into prod descr.

 

 

Similar Threads

  1. How do I insert PHP code into 'define_page_x.php'?
    By oavs in forum General Questions
    Replies: 1
    Last Post: 7 Nov 2011, 09:46 AM
  2. How Do I Format A Product Description to include line breaks and bullet points?
    By mike373 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Apr 2011, 07:44 PM
  3. Input PHP into Product Description
    By todoonada in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 23 Jun 2009, 12:08 PM
  4. Using PHP "include" in category & product description
    By g6enterprises in forum General Questions
    Replies: 4
    Last Post: 30 Jan 2009, 09:14 PM
  5. How to include other page to product description
    By marksu in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 11 Dec 2008, 12:47 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
  •  
disjunctive-egg