Zen Cart Logo
Forums / General Questions / ampersands in URLs

ampersands in URLs

Locked

Views: 5,017

Results 21 to 28 of 28
This thread is locked. New replies are disabled.
27 Sep 2007, 2:29 AM
#21
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

ampersands in URLs

Thank you DrByte, I followed your instruction and make this fix:

<a href="<?php echo zen_href_link(isset($_GET['main_page']) ? $_GET['main_page']: 'index', zen_get_all_get_params(array('main_nav')));?>&main_nav=1">

zen_href_link now should take of the &
That reduces the errors from 25 down to 7, I'll check the rest to see how to fix them.

27 Sep 2007, 2:39 AM
#22
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: ampersands in URLs

I noticed something weird:

  1. zenid is automatically appended to The link to my "shine" livehelp link:
?department=2&pingtimes=15&zenid=dcd0b589f91ed7

This link is in includes/templates/mytemplate/sidebox/tpl_shine.php

$content = '<div style="margin-bottom: 10px;"><a href="/livesupport/livehelp.php?department=2&pingtimes=15" target="_blank" ><img src="/livesupport/image.php?department=2&what=getstate" border="0" alt="live support" /></a>
              </div>';

How can I prevent Zen from doing this?

  1. When the product's name contain &, it is not encoded as expected
27 Sep 2007, 2:44 AM
#23
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: ampersands in URLs

There's a $add_session_id parameter to the zen_href_link() function which allows you to bypass the setting of a zenid for external links if you set it to false when sending your parameters to zen_href_link.

The rest of your questions appear to be related to general validation issues, and not to ampersands in URLs, which this thread is about.

27 Sep 2007, 8:42 AM
#24
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: ampersands in URLs

Ya know, just because you expect the ZC code to change the & in your product names to & doesn't mean that's the way it is designed to work...
You need to edit your product names yourself, in the product name entry field. I did it, and it reads correctly as & in all displays, and validates.

27 Sep 2007, 11:21 AM
#25
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: ampersands in URLs

Right as Kim , Dr byte have said all my ampersands was code I changed.

And probably still is !, can you help me fix the final few im down to 5 from 230 !

the site is my tapes-direct one the validation link if easier : http://validator.w3.org/check?uri=http%3A%2F%2Fwww.tapes-direct.co.uk

one of the lines it is complaing about is one I added to tpl_categories to add my own link in.

	//mark added this for Td News link START
	$content .= '<div class="betterCategories"><a class="category-links" href="index.php?main_page=page&id=4&chapter=0;">';
	 $content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_cat_boxes.gif') . $spacer;
        $content .= 'Tapes-Direct News</a></div>';
	//mark added this END

Something is adding a & after the chapter=0 without escaping it correctly

Thanks for help !

27 Sep 2007, 11:31 AM
#26
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: ampersands in URLs

crazycucumber:

$content .= '<div class="betterCategories"><a class="category-links" href="index.php?main_page=page&id=4&chapter=0;">';

Change that line to this:


$content .= '<div class="betterCategories"><a class="category-links" href="' . zen_href_link(FILENAME_EZPAGES, 'id=4&chapter=0') . '">';

27 Sep 2007, 11:34 AM
#27
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: ampersands in URLs

Thankyou , I knew my code was cumbersome ... I love the Zen way of doing it ! Just need to learn how !

Thanks again

19 Mar 2008, 8:00 AM
#28
w2e avatar

w2e

Zen Follower

Join Date:
Oct 2007
Posts:
103
Plugin Contributions:
0

Re: ampersands in URLs

I have a similar problem when I am trying to create an RSS feed for my site.

In my feed.xml, I have:
<item>

<title>Laptop AC adapters</title> <link> <http://techawave.jitbid.com/techawave/index.php?main_page=index&cPath=8> </link> <description>Laptop AC adapters for a variety of laptop computer models</description> </item>

When the feed is added to iGoogle, I click on the link, the URL will become:
http://techawave.jitbid.com/techawave/index.php?main_page=index=8

"&cPath" is completely left off. I also tried to change the ampersand to "&" but it didnt help.

This also happens when I added the RSS feed to MyYahoo, so I dont believe this is Google or Yahoo's problem.

How do I fix this?

Thanks