Page 1 of 1
picture under menu
Posted: Tue Mar 28, 2006 2:45 pm
by Gregor
Hi,
How can I place a picture under the leftside menu? Just like in the home page of this side. Is there a possibility to have that picture change every time one comes to the side?
Thanks,
G
Re: picture under menu
Posted: Tue Mar 28, 2006 3:46 pm
by Piratos
Code: Select all
<?
/*
This is a normal smarty plugin
you must copy it to the smarty/plugins folder
params:
path - the path of the folder where the pictures are placed with ending slash
example path="images/"
pictures with , separated names of the pictures
example pictures="p1.jpg,p2.jpg,p3.jpg,p4.jpg"
It is a good choice to have pictures with the same width and height, but it must not
the width and height in the imagetag comes automatically from the picture itself
full example tag
{randompicture path='images/' pictures="b1.jpg,b2.jpg,b3.jpg,b4.jpg,b5.jpg,b6.jpg,b7.jpg,b8.jpg,b9.jpg,b10.jpg"}
This plugin take a picture by random and show it
have a lot of fun
piratos@coftware.de
*/
function smarty_function_randompicture($params, &$smarty)
{
$path = isset($params['path']) ? $params['path']:'';
$pictures=array();
if (isset($params['pictures'])) $pictures=explode(',',$params['pictures']);
$max=count($pictures);
if ($max==0) return '';
$x=rand (0,$max-1);
$info = getimagesize($path.$pictures[$x]);
$w_h_string = $info[3];
echo "<img src='$path".$pictures[$x]."' $w_h_string alt='' />";
}
?>
Re: picture under menu
Posted: Tue Mar 28, 2006 4:27 pm
by Gregor
Thanks for the code!
In what templzte or stylesheet do I put this code to have the pictres shown under the menu bar on the left side?
Re: picture under menu
Posted: Tue Mar 28, 2006 5:25 pm
by Piratos
In what templzte
in that template you are using at the place you want.
Re: picture under menu
Posted: Wed May 10, 2006 9:39 am
by Gregor
If have created a file called function.randompicture.php and copied the source into the file. Next I uploaded the file to the smarty/plugins folder. When looking through the extensions menu, I don't see this function. Is that correct?
The function shows a picture

{randompicture path='uploads/images/' pictures="thumb_logo1.gif,thumb_perry_hanse311_1_0302.gif"}