Strip ccm_paging_p from getLinkToCollection
PermalinkI'm using matogertel's Tag Cloud addon (from within Search Tools), but I think the API calls are universal to C5. The addon creates tag URLs using the current page's location, but when the user has clicked onto a secondary page using a pagelist, they get a URL like this:
http://www.website.com/a-page/?&cloudID=285&tag=My%20Tag&ccm_paging_p_b496=4
Note the ccm_paging_p_b496=4. This is only appended to the URL when the user is on a numbered pagelist page other than the first one (i.e. has clicked Prev/Next or one of the numbers at the bottom).
My issue is that this breaks the tag links. They work fine when the ccm_paging_p### variable isn't in the address, but when it's there that variable gets passed on and breaks the search results page list. This is what a broken link looks like:
http://www.website.com/a-page/?&ccm_paging_p_b496=4&cloudID...
(note the ccm_paging_p## var comes first in these generated URLs)
Basically, what I need to do is strip it from the links which are generated in the tag cloud.
I think the piece of code which generates the link is this (from its controller.php):
if ($this->link_to_cID>0) { $nh = Loader::helper('navigation'); $sc = Page::getById($this->link_to_cID); if ($sc->getCollectionId()>0) { $path = $nh->getLinkToCollection($sc); $url = Loader::helper('url'); foreach ($myCloud as $i=>$word) { //note tag search is buggy in 5.3.3, so this feature is disabled until 5.4 $myCloud[$i]['link'] = $url->setVariable(array('cloudID'=>$this->bID,'tag'=>$word['word']),null,$path); } } }
and the offending line is
$path = $nh->getLinkToCollection($sc);
Is this a case of using regular expressions, or is there a better way to do it? I need to retain the two other variables which are passed (cloudID and tag).
Anyone have any thoughts? Any help much appreciated!