Jump to content

php inside tpl


Recommended Posts

ok,

I'm trying to do this:

 

foreach($a as $b ){

 

$c = $b; // if I do an echo here I have string insede $c

 

}

$d = 'abcde'.$c // if I do echo here I have the same string inside $d

 

$smarty->assign('url',$d);

 

the result I'm geting is just abcde

 

any idea why?

 

pleaseeee

Edited by nil2567 (see edit history)
Link to comment
Share on other sites

$a is an array.

 

but I discover another problem.

 

the problem is:

 

when i do a scandir I get an array.

 

Ex:

 

$a = scandir($directory);

 

if I now do :

 

$smarty->assign('variable',$a)

 

I don't get nothing in the tpl file and I shoud get array.

 

 

If I do

 

$smarty->assign('variable',$a.'hello');

 

I will get outpu of just hello

Link to comment
Share on other sites

the code is:

 

global $smarty;

 

$dir = "../modules/folder/upload/images/";

$images = scandir($dir);

$ignore = array('.','..');

foreach($images as $image){

if(!in_array($image,$ignore){

$a = $image

}

}

 

echo $a; // here I have the file

 

 

 

$smarty->assign('image',$a.'aaaa'); I'm just having the aaaa tring

Edited by nil2567 (see edit history)
Link to comment
Share on other sites

at first I simplifyed the code, now I post the real code.

it is streng, it looks like a bug to me.

1º I'm reading the files from a directorie

2º I'm doing a foreach to get out of the array

3º I'm trying to output.

 

I can see the variable hava a value but when I pass it to the tpl file the value wont appear

Link to comment
Share on other sites

×
×
  • Create New...