Page 1 of 1

Ampersand in page title

Posted: Sat Mar 22, 2008 9:40 am
by oliver341
I've noticed that if I use an ampersand (&) in a page title on page 5, XHTML validation breaks on page 4 and page 6 for the "previous" and "next" links at the bottom of the page because the ampersand is not being XHTML encoded by CMSMS. The rel="prev" and rel="next" links at the top of the page also do not encode the ampersand.

Can this be fixed? Can I modify my code to fix this in the meantime? Thanks.

Re: Ampersand in page title

Posted: Sat Mar 22, 2008 7:15 pm
by RonnyK
A quote from a search....
To avoid problems with both validators and browsers, always use & in place of & when writing URLs in HTML
Ronny

Re: Ampersand in page title

Posted: Sat Mar 22, 2008 7:39 pm
by oliver341
I fixed this myself by doing the following:

Code: Select all

Edit plugins/function.cms_selflink.php

Line 383: change $name to htmlspecialchars($name)
Line 394: change $name to htmlspecialchars($name)
Line 438: change $linktext to htmlspecialchars($linktext)
This was the minimum amount of editing I needed to fix my site.

Re: Ampersand in page title

Posted: Tue Mar 25, 2008 9:27 pm
by Pierre M.
oliver341 wrote: I fixed this myself by doing the following:
Edit plugins/function.cms_selflink.php ...
Please file this as a bug report with suggested solution in the forge. The dev team can't track bugs here in the forum. They like them reported in the forge. Thanks.

Pierre M.

Re: Ampersand in page title

Posted: Tue Mar 25, 2008 9:32 pm
by oliver341
Hi, this solution doesn't work because sometimes these variable actually are meant to contain unencoded HTML. I'll put it in the correct forum all the same.