Guest Posted March 4, 2007 Posted March 4, 2007 I was trying to validate my site at http://validator.w3.org, but noticed the Ampersands (&'s) in the URLs was causing me problems. I read the article below & did what it said to do. http://www.htmlhelp.com/tools/validator/problems.html#amp I changed this code below in this file: catalog/includes/html_output.php Changed from this if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } To this if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } That took away those errors that http://validator.w3.org/ site was showing & my site seems to function properly, but I want to know if that actually has any bad effects that I just can't see?
Guest Posted March 4, 2007 Posted March 4, 2007 I was trying to validate my site at http://validator.w3.org, but noticed the Ampersands (&'s) in the URLs was causing me problems. I read the article below & did what it said to do. http://www.htmlhelp.com/tools/validator/problems.html#ampI changed this code below in this file: catalog/includes/html_output.php Changed from this if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } To this if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } That took away those errors that http://validator.w3.org/ site was showing & my site seems to function properly, but I want to know if that actually has any bad effects that I just can't see? yes, unfortunately with some forms this won't work very well and you probably going to have problems with gateways passing parameters with your store's links. You have to do it conditionally and pass an extra parameter to the tep_href_link function to specify when to execute the original osc code.
Guest Posted March 4, 2007 Posted March 4, 2007 Replace : & with &Yea...I have that here on my sever, but I just didn't copy that into the code I posted. yes, unfortunately with some forms this won't work very well and you probably going to have problems with gateways passing parameters with your store's links. You have to do it conditionally and pass an extra parameter to the tep_href_link function to specify when to execute the original osc code.I know how to pass parameters, but how would I pass these parameters so that it will ignore the standard & & use &?
Guest Posted March 4, 2007 Posted March 4, 2007 I know w3c is a pain. Please send me the w3c.org link for your site and I will look and see what I can do. Yea...I have that here on my sever, but I just didn't copy that into the code I posted.I know how to pass parameters, but how would I pass these parameters so that it will ignore the standard & & use &?
Jan Zonjee Posted March 4, 2007 Posted March 4, 2007 That took away those errors that http://validator.w3.org/ site was showing & my site seems to function properly, but I want to know if that actually has any bad effects that I just can't see? What about using Easy validate osC HTML? Never found any problem with that.
Guest Posted March 4, 2007 Posted March 4, 2007 I know how to pass parameters, but how would I pass these parameters so that it will ignore the standard & & use &? to avoid breaking the whole store that uses the tep_href_link function you specify an extra argument at the end pre-initialzed. So after the search_engine_safe you specify another one with a default value. And you base your conditional conversion by checking that parameter.
Guest Posted March 4, 2007 Posted March 4, 2007 to avoid breaking the whole store that uses the tep_href_link function you specify an extra argument at the end pre-initialzed. So after the search_engine_safe you specify another one with a default value. And you base your conditional conversion by checking that parameter.Like this? tep_href_link(FILENAME_DEFAULT,'abcd=5555','NONSSL','true','&') function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $ampersands = '&') { global $request_type, $session_started, $SID; if (!tep_not_null($page)) { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>'); } if ($connection == 'NONSSL') { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } elseif ($connection == 'SSL') { if (ENABLE_SSL == true) { $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG; } else { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } } else { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>'); } if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); if ($ampersands == '&') { $separator = '&'; } else{ $separator = '&'; } } else { $link .= $page; $separator = '?'; }
Guest Posted March 4, 2007 Posted March 4, 2007 I know w3c is a pain. Please send me the w3c.org link for your site and I will look and see what I can do.I am only working on this blank About Us page trying to get it to work on this page then I will adapt it to the rest of the site... This is just a Testing Server & not a live site. http://www.hostwithgold.com/osc/about_us.php http://validator.w3.org/check?uri=http%3A%...%2Fabout_us.php
Guest Posted March 4, 2007 Posted March 4, 2007 yes, better like: function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $ampersands = true) { ............ if ($ampersands) { $link = str_replace('&', '& amp;', $link); } And for the gateways links you pass with the forms like with paypal, you call the tep_href_link function with the $ampersands flag to false to use the old osc approach. This way you only need to change it in few places. (just added space around amp to display it here.)
Guest Posted March 5, 2007 Posted March 5, 2007 yes, better like: function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $ampersands = true) { ............ if ($ampersands) { $link = str_replace('&', '& amp;', $link); } And for the gateways links you pass with the forms like with paypal, you call the tep_href_link function with the $ampersands flag to false to use the old osc approach. This way you only need to change it in few places. (just added space around amp to display it here.) Thanks...it work just fine, but I was thinking. I would have to go over my entire site where ever I call the tep_href_link() & modify each one to use the new method. That is going to be time consuming & something I might do at a latter date. Does it actually effect how any browser displays the site using the old OSC method? I am asking because I would like to make my site W3C compliant, but it isn't my top priority at this time.
Guest Posted March 5, 2007 Posted March 5, 2007 Thanks...it work just fine, but I was thinking. I would have to go over my entire site where ever I call the tep_href_link() & modify each one to use the new method. That is going to be time consuming & something I might do at a latter date. Does it actually effect how any browser displays the site using the old OSC method? I am asking because I would like to make my site W3C compliant, but it isn't my top priority at this time. no because the default will use the amp. So only some links like those related with gateways you need to modify. For example if you look the paypal.php it has a line like this: tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . that line you need to modify and fill in the extra arguments in because you dont want to use the amp in that case.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.