Jump to content

jorcom

Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Location
    Barcelona
  • Activity
    Developer

jorcom's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. I finally found the error... another line was calling the same function with another path, the problem is that the line is commented with html tags <!-- and --> smarty comments must be {* *} well, this will not forget
  2. Hi Everyone, i'm working with smarty by first time and i need your help. I created my own smarty plugin, this plugin only gets one param, with a path. Then, checks if there are any image (with .jpg extension) inside this path, and put all images found into another array. Then, assign the second array into smarty, and i want it to use in a .tpl file, but when i do a foreach in tpl, the plugin works fine, but is checking a sibling folder, not the folder that set into a param when call the function. I paste my code below to help you understand. Smarty Plugin: function smarty_function_getImages($params, &$smarty){ if(!isset($params['directory'])) { trigger_error("Error, path is needed.", E_USER_NOTICE); return; }else{ if(is_dir($params['directory'])){ $aux = scandir($params['directory']); $aux2 = array(); for($i = 0; $i<sizeof($aux); $i++){ if(!is_dir($aux[$i])){ if(substr($aux[$i], -3) == "jpg"){ echo $aux[$i]; array_push($aux2, $aux[$i]); } } } $smarty->assign('rightItems',$aux2); }else{ trigger_error("Invalid folder.", E_USER_NOTICE); return "Invalid folder."; } } return; } tpl file {getImages directory="img/cms/$path/rightItems"} {foreach from=$rightItems item=foo} {$foo}<br /> {/foreach} Someone has had this problem? I'm sure that will be a little mistake, but by the moment i don't found the solution
×
×
  • Create New...