Announcement

Collapse
No announcement yet.

Parse error:

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

    Parse error:

    Ive had this error a few times on different sites
    Parse error: parse error in main on line 4
    it shows in the text for best seller/new products lists and can be seen on the test site bellow:

    cheapmowers2.co.uk/acatalog/test/acatalog/index

    Its totally random as far as I can see and can be removed by doing a manual selection of another product but if you use the auto generation it can be thrown up at any time. Could it be due to using the text reduction patch.

    #2
    Malcolm,

    Do you have any PHP blocks round the text? We had a number of problems with parse errors on PHP blocks which took a bit of working to get rid of!

    David
    Cheers

    David
    Located in Edinburgh UK

    http://twitter.com/mcfinster

    Comment


      #3
      Do you have any PHP blocks round the text
      Not that I know of but I will double check. All my text is the same so this should not affect it.

      Comment


        #4
        Malcolm,

        Now I actually bother to read your original post properly you must have php blocks around it to use the text reduction patch. PHP does not seem to like some of the html that Actinic generates and can throw up these errors. the solution (or hack dependant on how you want to phrase it) is remove the html before it reduces the text length. This code below should remove (or replace with normal text) most html (i may have missed some) and then reduce it to your desired length:-

        [EDIT] I have attached the code as a text file as the forum messes it up!

        Perhaps someone from Actinic could comment on if there is an easier way to resolve this.
        Attached Files
        Cheers

        David
        Located in Edinburgh UK

        http://twitter.com/mcfinster

        Comment


          #5
          Interesting - why would it only throw an error on certain products and not all as they are all the same layout etc

          Perhaps someone from Actinic could comment on if there is an easier way to resolve this
          If they can it should be added to the AUG to patch the code there.

          Comment


            #6
            Im not 100% sure, seems to be a combination of where the html occurs in the text and where the text is cut off (if it's cuts off have way through a &#149 or something this also causes problems). Playing with the encoding produces some different results but ultimately I have found the above works best.
            Cheers

            David
            Located in Edinburgh UK

            http://twitter.com/mcfinster

            Comment


              #7
              Its never easy is it!

              Comment


                #8
                Well it would be boring if it wasn't a challenge!!!
                Cheers

                David
                Located in Edinburgh UK

                http://twitter.com/mcfinster

                Comment


                  #9
                  im getting the following error when i go to the disign tab.

                  Parse error: parse error, expecting`',"or`';" in main on line 563

                  I have looked at your solution but cannot make heads or tails of it as I'm not an expert in design or html. Can you give me an easy solution to this problem.

                  Thanks
                  Last edited by Petertorry; 22-Jan-2008, 01:38 PM. Reason: adding text

                  Comment


                    #10
                    That big lump of PHP could be simplified and speeded up by using str_replace with array arguments.
                    Code:
                    $sOriginal = '<actinic:variable encoding="actinic" name="ProductName" selectable="false" />';
                    $old = array('&#38;#47;', '&#38;#44;', '&#38;#38;', '&#38;#149;', '<br>', '&#38;#13;');
                    $new = array('/',     ',',     '&');
                    $sShort = str_replace($old, $new, $sOriginal);
                    Vakues from old will be replaced by values from new. When the values in new run out nulls are used instead.
                    Arrays aren't complete. I've only put 3 replacement by text , then 3 replace by null entries in.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Another tack would be to use the unescaped text, via encoding="perl" and use PHP's strip_tags to remove any HTML.
                      Code:
                      $sOriginal = '<actinic:variable encoding="perl" name="ProductName" selectable="false" />';
                      $sShort = strip_tags($sOriginal);
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Originally posted by NormanRouxel
                        Another tack would be to use the unescaped text, via encoding="perl" and use PHP's strip_tags to remove any HTML.
                        Code:
                        $sOriginal = '<actinic:variable encoding="perl" name="ProductName" selectable="false" />';
                        $sShort = strip_tags($sOriginal);
                        The forum presents the nut, the members present the hammer and then Norman tweaks it into a miniature, ergonomic, self-operating nut-cracker to do the job with less mess all round
                        Fergus Weir - teclan ltd
                        Ecommerce Digital Marketing

                        SellerDeck Responsive Web Design

                        SellerDeck Hosting
                        SellerDeck Digital Marketing

                        Comment


                          #13
                          I also ahve to mention that Actinic sometimes screws up the preview, but correctly renders the content on a site upload. Never trust the preview window, especially for PHP.

                          Comment

                          Working...
                          X