Hi,
I would like to output all the images from a certain folder into a div so i can fade through them with jQuery
so, for example, if i am in the 'about us' page the function looks in the images/about-us folder and returns all the images. And if i am in a different section it looks in that section folder (i.e. services section looks in images/services folder.)
Is there something that already does this or does someone have some sample code ?
Thanks in advance
output all images from certain folder
Re: output all images from certain folder
create user defined tag and use it in the template.
here is my code for doing this
$files = glob("uploads/images/".$params['id']."/*.*", GLOB_BRACE);
print '';
$folder = $params['id'].'/';
$i=1;
foreach($files as $file)
{
if(!preg_match('/thumb/',$file))
{
$image = explode('.',$files[$i]);
$im = explode($folder,$image[0]);
$thumb = explode($folder,$file);
$path = $thumb[0].$folder.'/thumb_'.$thumb[1];
print"";
print"";
print" ";
print " ";
print"";
}
}
where $params['id'] is the get or post parameter from page visited
{userdefinedtagname id=$smarty.get.page}
here is my code for doing this
$files = glob("uploads/images/".$params['id']."/*.*", GLOB_BRACE);
print '';
$folder = $params['id'].'/';
$i=1;
foreach($files as $file)
{
if(!preg_match('/thumb/',$file))
{
$image = explode('.',$files[$i]);
$im = explode($folder,$image[0]);
$thumb = explode($folder,$file);
$path = $thumb[0].$folder.'/thumb_'.$thumb[1];
print"";
print"";
print" ";
print " ";
print"";
}
}
where $params['id'] is the get or post parameter from page visited
{userdefinedtagname id=$smarty.get.page}
Re: output all images from certain folder
Thanks alot, that worked great.
Just one other question.
How could i get the alias of the parent page ?
I can get the current alias like : {$page_alias} so i am hoping there is a simple way like this to get the parent alias
Thanks
Just one other question.
How could i get the alias of the parent page ?
I can get the current alias like : {$page_alias} so i am hoping there is a simple way like this to get the parent alias
Thanks
Re: output all images from certain folder
you can try this one
{get_root_page_alias assign="root_page_alias"}
you can use in your template or in udt as $root_page_alias.
cheers
{get_root_page_alias assign="root_page_alias"}
you can use in your template or in udt as $root_page_alias.
cheers