Ampersand in page title

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
oliver341
Forum Members
Forum Members
Posts: 89
Joined: Sat Feb 23, 2008 3:51 pm

Ampersand in page title

Post 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.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Ampersand in page title

Post 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
oliver341
Forum Members
Forum Members
Posts: 89
Joined: Sat Feb 23, 2008 3:51 pm

Re: Ampersand in page title

Post 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.
Pierre M.

Re: Ampersand in page title

Post 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.
oliver341
Forum Members
Forum Members
Posts: 89
Joined: Sat Feb 23, 2008 3:51 pm

Re: Ampersand in page title

Post 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.
Post Reply

Return to “CMSMS Core”