Zen Cart Logo
Forums / General Questions / Ampersands in links and EZpages xHTML validation

Ampersands in links and EZpages xHTML validation

Locked

Views: 2,254

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
6 Apr 2009, 4:52 AM
#1
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Ampersands in links and EZpages xHTML validation

Hi All,
Here's what's happening:
I am using an EZpage for my faq page. There are many links on this page that have to use the ampersand "&" within the link.
I can go through my EZpage and properly escape all the ampersands like so "&"
Once I do that, I can validate the page, no problem.

However, here is where the trouble starts:
The next time I go to edit something on the EZpage, all the ampersands are unescaped again. Unless I go through and fix them all again, the page will not validate.

It's apparent that the "amp;" is being properly stored, so I'm assuming that the "amp;" must be stripped when the data is retrieved from the database.

The problem is, I don't know where to start looking. could someone point me to the right place?

Here is a link to my faq page:
http://thetoolspot.us/index.php?main_page=page&id=4
If you scroll to the footer, you can find a link to the W3C validator.

Thanks

10 Apr 2009, 2:22 AM
#2
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Re: Ampersands in links and EZpages xHTML validation

It was becoming increasingly frustrating to have to recode all those ampersands every time I wanted to edit something on the FAQ page. So, after enough digging I finally found the source. Although after looking at the code, I'm still not sure why it was stripping the entities from the ampersands. In any case here is how I solved the problem in case anyone else is as retentive as I am and want their EZpages to validate:

In admin/ezpages.php line 440
I changed:

echo zen_draw_textarea_field('pages_html_text', 'soft', '100%', '40', $ezInfo->pages_html_text);

to:

echo zen_draw_textarea_field('pages_html_text', 'soft', '100%', '40', htmlspecialchars($ezInfo->pages_html_text));

It seems to work fine now.

10 Apr 2009, 2:30 AM
#3
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Ampersands in links and EZpages xHTML validation

Nice bit of troubleshooting and thanks for sharing.

I'm sure those of us where Validation is important will find it very handy to apply your elegant solution.

10 Apr 2009, 10:49 PM
#4
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Re: Ampersands in links and EZpages xHTML validation

Thanks, just trying to save someone else the trouble. :smile:

28 Jan 2010, 12:42 PM
#5
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Re: Ampersands in links and EZpages xHTML validation

Thanks for posting this, helped me figure out how to keep my entities for the ezPages titles. In admin/ezpages.php on line #383, I changed:

$ezInfo->pages_title,
```to:

htmlspecialchars($ezInfo->pages_title),