Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Dynamic argument in template


Reply


4 Posts   491 Views

Avatar
bubu333

Community Member, 8 Posts

28 November 2012 at 3:42pm

Hi,I have a Title but it's so long,i want to cut string with 40 character and i write a function for do it.
function cutString($name,$limit)
{
....write code
}

And in template,i want to insert $Name and $Description(two field in database) into argument of cutString function
But it's not work.
I write <% control cutString($Name,40) %><% end_control %> not work
I write $cutString($Name,40) not work
I write $cutString(Name,40) not work
I don't know how can implement function with dynamic argument in template :(

Avatar
swaiba

Forum Moderator, 1805 Posts

28 November 2012 at 7:34pm

SS2.x.x or SS3.x.x?

Avatar
bubu333

Community Member, 8 Posts

28 November 2012 at 7:46pm

Version 2.4.7.Please help

Avatar
swaiba

Forum Moderator, 1805 Posts

28 November 2012 at 7:53pm

Answer is *not possible* sorry.

If you are using SS3 answer is - yes - possible.

Best I can advise in SS2.x.x is this http://www.silverstripe.org/template-questions/show/13619#post304007#post304007

Good luck!