Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23
  1. #21
    Join Date
    Nov 2009
    Location
    California
    Posts
    2
    Plugin Contributions
    0

    Default Re: Error coming from additional_images.php

    Quote Originally Posted by TheOracle View Post
    Excellent. Glad to know this problem was about a typo query.
    I'm hoping TheOracle can help with a similar problem as above. I did the exact same fixes you prescribed but now I get a third additional error message: [09-Nov-2009 21:33:25] PHP Parse error: syntax error, unexpected ')' in /home/anima/public_html/includes/modules/additional_images.php on line 189

    We are using Zen Cart 1.3.7 Patch: 1:: Database Patch Level: 1.3.7 PHP Version 5.2.6 with Server OS: Linux 2.6.18-53.1.14.el5.

  2. #22
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Error coming from additional_images.php

    TheOracle has not been active for a couple of years.
    The "fix" in post #4 may have stopped some error from occurring, but it can cause an error at least in some circumstances.
    The only change was to move a ) from near the end of the statement to near the beginning (red = removed, green = inserted):
    Code:
    $noscript_link = '<noscript>' . ($flag_display_large) ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular ) . '</noscript>';
    The new location is harmless though not necessary, but the original location was necessary to distinguish the scope of the ternary operator.
    This takes the form
    x ? a : b
    where if x (any expression that can be evaluated) is true, then a is performed, and if it is false, b is performed.
    Without the last ) to define where the effect of the ternary operator stops, the . '</noscript>' is part of the alternate output and will not occur if $flag_display_large is true.
    This is a problem, because we then have an unclosed <noscript> tag in the output.
    I had observed numerous times when TheOracle gave incorrect advice while seeming extremely knowledgeable.

  3. #23
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Error coming from additional_images.php

    Actually, it is possible that there is another error introduced by the change, which would partially counteract or at least overlap with the previously described error.

    The beginning of the ternary operator is originally defined by the ( to evaluate only the $flag_display_large after outputting the <noscript> tag.

    The change may well allow the entire first part of the statement to be evaluated instead of part of it being output. It would probably work thus:
    '<noscript>' . ($flag_display_large)
    evaluates to a string like
    '<noscript>1'
    '<noscript>TRUE'
    or
    '<noscript>0'
    '<noscript>FALSE'
    none of which will be read as equalling false, so the first ("a") output will be processed and the second ("b") output will be ignored. There will be neither opening nor closing <noscript> tags, eliminating a syntax error but leaving output in the form of the standard link to a larger image whether or not that setting was active.
    For a user with javascript enabled, there would possibly be two larger image links, one to a popup and one to a new window. Users with js disabled would see only the normal version of the link which <noscript> is supposed to display.
    Last edited by gjh42; 11 Nov 2009 at 04:51 AM.

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 2
    Last Post: 12 Jun 2015, 10:11 PM
  2. v151 query from a category its products name, price, image, description and attributes
    By cmsdeployed in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 19 Jul 2013, 07:21 PM
  3. Image Handler 4.1 and zen lightbox additional_images conflict
    By oavs in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 13 May 2013, 07:01 AM
  4. Hide attributes dropdown when using attribute images and Element Below Image and Opt
    By mattys in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 13 Jun 2011, 03:11 PM
  5. function.preg-match error with additional_images.php
    By DigitalShadow in forum General Questions
    Replies: 5
    Last Post: 26 Jan 2011, 10:27 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR