explode Alternative

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
reinhardl
Regular
Posts: 258
Joined: Wed Jun 20, 2007 8:54 am
Location: Germany

explode Alternative

Post by reinhardl »

Hallo,

if I use

Code: Select all

 {assign var=bildname value=".serendipityThumb.JPG"|explode:$entry.properties.ep_MimboImage} 
I will get this Message:
Smarty error: [in entries_single.tpl line 13]: [plugin] (secure mode) modifier 'explode' is not allowed (Smarty_Compiler.class.php, line 1934
is the an alternative funktion?

thanks
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: explode Alternative

Post by garvinhicking »

Hi!

You can disable the security mode in your template's config.inc.php.

However, the cleaner syntax would be to create your custom smarty modifier:

Code: Select all

<?php
function serendipity_smarty_bildname(&$var, $input) {
  $parts = explode(',', $input);
  foreach($parts AS $part) {
    $var .= $part . '.serendipityThumb.jpg';
  }
}

$serendipity['smarty']->register_modifier('serendipity_smarty_bildname', 'serendipity_smarty_bildname');
and in TPL:

Code: Select all

{$bildname|@serendipity_smarty_bildname:$entry.properties.ep_MimboImage}
(I don't know what you want to do do exactly, though, so you might need to use your own PHP function there :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply