Reputation: 2220
Good day all.
I've a little issue about creating https links and the only entry point I got is smarty, so my idea was to simply search and replace the string http
with https
, but, just to be sure, I'd like to convert also the string httpss
into https
to handle those links already served as https.
Actually I'm doing this:
{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )|replace:"http":"https"}
is there a way to add another string replace in the same row? I mean something like:
{($link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )|replace:"http":"https")|replace:"httpss":"https"}
I'm using smarty only twice a year, so I'm not so expert there and I don't want to add complexity (that I'll not be able to read the next year) ;)
Upvotes: 1
Views: 233
Reputation: 28272
There are better options in Smarty (regex_replace
for example), but for a more correct replacement, couldn't you just replace the whole protocol?
{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )|replace:"http://":"https://"}
That way you can be sure it won't replace a part of the link containing the word http
(not in the protocol), and only http://
links will be replaced
Upvotes: 1