V
V
viktorross2019-11-01 22:46:10
PHP
viktorross, 2019-11-01 22:46:10

How to replace space in smarti with %20 in a link?

hello, can you tell me how

<a href="{if $settings.enable_locations && in_array($v.depending.caption1, $location_fields)}javascript:;" onclick="changeLocation('{$live_site}', '{$v.depending.caption1}|{$t.name|rawurlencode}'){else}{if $seo_settings.enable_mod_rewrite}{$constructed_url|replace:$sfield:$field_string}{else}{$constructed_url}{$separator}{$v.depending.caption1}={$t.name|replace:'/':'_'}{/if}{/if}">{$t.name|capitalize}{if $t.count>0}&nbsp;({$t.count}){/if}</a>

in href replace spaces in link with %20? so that the validator does not give a bunch of errors about this,
I tried this
href="{if $settings.enable_locations && in_array($v.depending.caption1|replace:' ':'%20', $location_fields)}javascript:;"

so
href="{if $settings.enable_locations && in_array({$v.depending.caption1|replace:' ':'%20'} , $location_fields)}javascript:;"

does not work ..

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2019-11-01
@viktorross

{$var|escape:'url'}
https://www.smarty.net/docs/en/language.modifier.e...

L
Lazy @BojackHorseman PHP, 2019-11-01
Tag

Probably there is some function in puff for this. what could it be called...

S
Sergey Bro, 2019-11-01
@ssenj

urlencode()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question