Announcement

Collapse
No announcement yet.

bug: simple php crashes actinic making it unusable.

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

    bug: simple php crashes actinic making it unusable.

    consider the following:
    PHP Code:
        $arrStr explode("\\""<actinic:variable name="ProductImageFileName" />");
        
    $arrStr array_reverse($arrStr);
        echo 
    $arrStr[0]; 
    this crashes my V8, and the only way i can get back into the design tab, is to edit it out of the templates section of the database by hand.

    can anyone else {dare to try to} confirm?

    #2
    Gabriel,

    Works fine for me. What layout are you using it in?
    Cheers

    David
    Located in Edinburgh UK

    http://twitter.com/mcfinster

    Comment


      #3
      in a latest products item.

      and... you're brave.

      Comment


        #4
        Stupid is probably more accurate!!!

        Works in there for me too, layout 'Standard new Products Item'
        Cheers

        David
        Located in Edinburgh UK

        http://twitter.com/mcfinster

        Comment


          #5
          Add encoding="perl" selectable="false" to that variable definition.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            It's generally best to single quote Actinic Variables if you're passingt them to PHP as as strings.

            E.g.

            Code:
            "<actinic:variable name="ProductImageFileName" />"
            should be

            Code:
            '<actinic:variable name="ProductImageFileName" encoding="perl" selectable="false" />'
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              excellent help mr norm.

              but even though these items are highlighted in red, is this ok?

              Comment


                #8
                HTML Code:
                				<actinic:block php="true">
                					$max_words = 9;
                					$titletext = '';
                					$titletext = '<actinic:variable name="ProductName" encoding="perl" selectable="false" />';
                					$titletext = str_replace("-", "", $titletext);
                					$titletext = str_replace(",", "", $titletext);
                					$titletext = str_replace(".", "", $titletext);
                				
                					$phrase_array_title = explode(" ",$titletext);
                					if(count($phrase_array_title) > $max_words && $max_words > 0)
                					$phrase_final = "";	
                					$phrase_final = implode(" ",array_slice($phrase_array_title, 0, $max_words));  
                					echo $phrase;
                				</actinic:block>
                well norm, i'd be heppy if you could take a look at this block for me.

                essentially, its shortening a variable to a number of words. it does display fine, but its repeating the incorrect product, throughout the items.

                now i'm using this block on the new products in type block, so the block is being repeated. is there a better way of shortening text to a number of pre-defined words?

                Comment


                  #9
                  Sorry, but I cannot help debug partial code. Also I've no free time for such stuff.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Does this perhaps help fro mthe AUG:
                    Code:
                    <actinic:block php="true" >
                    $sShort = "";
                    $nCount = 0;
                    $sOriginal = '<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />'; 
                    foreach(explode(" ", $sOriginal) as $sWord)
                    	{
                       if ($nCount > 10)
                       	{
                       	$sShort .= "...";
                       	break;
                       	}
                       $sShort .= $sWord . " ";
                       $nCount++;
                       }
                    echo $sShort;
                    </actinic:block>

                    Comment


                      #11
                      thats excellent dunc, splendid.

                      Comment

                      Working...
                      X