I do not hav experience with UDT, and now my brain is off
Really I thing that this is simple but however I need your help, please.
pagealias is "string-string-string"
gallery dir is "string_string_string"
I try to call page alias inside gallery tag as this:
{Gallery dir="$page_alias"}
It works, but...
But it fails when the alias have "-" and the created gallery dir have "_"
I think that I need an UDT that use this php function:
$alias2dir = str_replace('-', '_', $page_alias);
This is where my brain fails.
I do not understand how to complete my udt.
udt input: page_alias
udt output: alias string converted to dir string
My suggested UDT name is: alias2dir
Thanks in advance for all your help.
How to: create UDT to convert $page_alias string to...
-
- Forum Members
- Posts: 57
- Joined: Fri Nov 04, 2011 10:10 pm
Re: How to: create UDT to convert $page_alias string to...
You don't need an UDT for that. Just use some Smarty magic:
That should do the trick.
Code: Select all
{Gallery dir=$page_alias|replace:"-":"_"}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
-
- Forum Members
- Posts: 57
- Joined: Fri Nov 04, 2011 10:10 pm
Re: How to: create UDT to convert $page_alias string to...
Thanks very much.