picture under menu

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

picture under menu

Post 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
Piratos

Re: picture under menu

Post 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='' />";
}
?>
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: picture under menu

Post 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?
Piratos

Re: picture under menu

Post by Piratos »

In what templzte
in that template you are using at the place you want.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: picture under menu

Post 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"}
Last edited by Gregor on Wed May 10, 2006 10:02 am, edited 1 time in total.
Post Reply

Return to “Layout and Design (CSS & HTML)”