Functions in UDTs

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Functions in UDTs

Post by psy »

I knew this before but forgot and wasted a lot of time wondering why my UDT kept crashing on the 2nd iteration.

Functions declared in UDT's are remembered. Wrap them in the PHP function:

Code: Select all

if (!function_exists ('myfunction') {
  function myfunction (){
  ...
  }
}
That way when it's called again, eg in a {foreach} loop, all will go well.

hth
psy
Post Reply

Return to “Tips and Tricks”