1770 Posts in 495 Topics by 531 members
|Go to End|
19 January 2012 at 10:31am
I have a site where I'd like one of the tags to have an apostrophe (ie, What's Cooking). For any normal tag (that has no apostrophe) clicking on the tag will show you all of the posts with that tag. But my tag with the apostrophe won't pull up any results.
Any suggestions for correcting this would be great.
20 January 2012 at 4:03pm
Sounds like a bug - it should encode the tag text to format it using HTML entities (i.e ' for '). If you can, dig down into the template that outputs the tags and find the variable, rather than $Something should be $Something.XML to ensure it's escaped.
1 February 2012 at 3:35pm
7 February 2012 at 12:37pm Last edited: 7 February 2012 1:09pm
It is indeed a bug. I too had this problem with needing to use an apostrophe in a tag. Since single quotes ( ' ) are allowed in URL's, trying to format with htmlentities or urlencode in the controller (or the template $Link.XML method) had no effect on the actual URL being generated by the link.
Instead, I found that the tag code was being converted to it's HTML entity (') prior to the SQL query being run:
In BlogTree_Controller::SelectedTag() (Convert::raw2xml() - BlogTree.php line #300).
My simple solution was to edit BlogTree.php line #300 to remove the raw2xml conversion as below:
return ($this->request->latestParam('Action') == 'tag') ? $this->request->latestParam('ID') : '';
It's perhaps a temporary solution, but it certainly worked for me.
On second thought, it's probably best to keep the raw2xml conversion in the SelectedTag() function, as this function is also used for template output. Instead, edit BlogTree.php line #160 to revert the xml conversion back to raw for the purpose of escaping for the query:
$SQL_tag = Convert::raw2sql(Convert::xml2raw($tag));
This is probably the better solution.
|Go to Top|