1
xsell
Assign for loop with Smarty
  • 2010/2/20 6:10

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

this is Simple Code i use , it Prints Ball Image equal to $image Value ..

if $image=3 that mean the Image will be printed 3 times ..

i need to assing it to Smarty to use it in template.
$image =2;
for(
$i=1;$i<=$image$i++){

echo 
'.XOOPS_ROOT_PATH.'/modules/test/images/ball.png" />';

}


i could do it by Number Just like
$xoopsTpl->assign('image'$image);

this will print the Number .. but i need to print out the Image . so i tried something like
$xoopsTpl->assign('image''.XOOPS_ROOT_PATH.'/modules/test/images/ball.png" alt="" />');


but this printed Out only One image regards to $image Value..

any idea?
Thx

2
trabis
Re: Assign for loop with Smarty
  • 2010/2/20 6:47

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


$count =2
$image '';
for(
$i=1;$i<=$count$i++){ 

$image .= '.XOOPS_ROOT_PATH.'/modules/test/images/ball.png" />'

}
$xoopsTpl->assign('image'$image);





3
xsell
Re: Assign for loop with Smarty
  • 2010/2/20 7:10

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thank You Trabis .. Perfect ..!

Login

Who's Online

375 user(s) are online (214 user(s) are browsing Support Forums)


Members: 0


Guests: 375


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits