Guest Posted March 19, 2006 Posted March 19, 2006 Hi, I tried to make this construction to work, but it just shows nothing. Here is the code I tried to put in product_listing.php: case 'PRODUCT_LIST_IMAGE': ... $lc_text_pref='<script><!--<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\')">' . tep_image(DIR_WS_IMAGES . 'enlarge.gif', 'Enlarge') .'</a>--></script><noscript><a href="' . tep_href_link(DIR_WS_IMAGES . $listing['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . 'enlarge.gif', 'Enlarge') . '</a></noscript>'; $lc_text=$lc_text_pref.$lc_text; ... break; Is it posible at all to make construction like : <?php <script><!--...--></script><noscript>...</noscript> ?> work in php. Is there a way to check from php if user's browser allows javascript? Thank you.
Guest Posted March 19, 2006 Posted March 19, 2006 you need the document.write function and in it you pass the link as the argument. See how the product_info.php does it.
Guest Posted March 19, 2006 Posted March 19, 2006 Hi, Yes, exactly. Originally I took this code from product_info.php, but there all the "<script><!--...--></script><noscript>...</noscript>" construction is outside of php code, it is in html part. I spent much time trying to make it work inside php, without luck. Finally I settled with: $lc_text_pref='<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\')">' . tep_image(DIR_WS_IMAGES . 'enlarge.gif', 'Enlarge') .'</a>'; ...but the feature I'm trying to implement won't work in javascript disabled browser. So I'm stuck here, just don't know how to make it work...
Guest Posted March 19, 2006 Posted March 19, 2006 whether is inside or outside you still need the document.write for the active scripting part. Otherwise it won't work lc_text_pref='<script><!--' . "\n" . 'document.write(\'<a href="java script:popupWindow.................. and terminate it of course.
Guest Posted March 19, 2006 Posted March 19, 2006 :D Whew! Thanks a lot. Here is the working code: $lc_text_pref='<script><!--' . "\n" . 'document.write(\'<a href="javascript:popupWindow(\\\''. tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . 'enlarge.gif', 'Enlarge') .'</a>\')'."\n".'--></script><noscript><a href="' . tep_href_link(DIR_WS_IMAGES . $listing['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . 'enlarge.gif', 'Enlarge') . '</a></noscript>'; What was missing is tripple slashes, that's why it did not work for me. I think I'll post it as a contribution. Best regards.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.