I have a URL like this
http://subdomain.domain.com/xyz-开发者_JAVA技巧200_some_information
I want to convert this URL to following URL using smarty.
http://www.domain.com/xyz-200_some_information
That is, need to replace subdomain
with www
subdomain
is not fixed, there may be more more subdomains. I'm looking for a smarty based solution instead of a PHP one, as I don't have to acc change
You can use a regex_replace
{$var|regex_replace:"/http:\/\/.*?\./":"http://www."}
This matches a region from http://
to the first dot and replaces it with http://www.
精彩评论