Hello,
I need your comment/advice for another canonical link version I’m adressing, in Evo 1.0.5, and thanks for the code examples in that tread.
I’m using friendly url (with .php suffix) so
<link rel="canonical" href="[(site_url)][~[*id*]~]" />
is doing fine for most of my sites and pages.
There is one situation where I need somethimg in addition, as I’m adding a parameter with an integer value behind an alias, let’s say an url like www.domain.com/nice-page.php?parameter=8
I’ve done it with a snippet that is getting the parameter named [!getParam!] and added Phx to the above code example:
<link rel="canonical" href="[(site_url)][~[*id*]~][+phx:if=`[!getParam!]`:isnot=`0`:then=`?reg=[!getParam!]`:else=``+]" />
Unfortunately the if/then in the Phx (2.1.4) part does not work, even if the get parameter is 0 the then part will appear. The snippet is giving the right values, from 0 to n. Is there an issue with comparisons in Phx?
The snippet i use is
<?php
$region_id = $_GET['reg'];
if($region_id > 0) {print $region_id;}
else print "0";
?>
I know, it’s more a Phx question with comparison issues but maybe you find it useful here (if it works) and you can help.
Thanks!