dynamic change top_picture

General questions about CMSimple
Post Reply
noit
Posts: 9
Joined: Mon Jul 14, 2008 5:27 pm

dynamic change top_picture

Post by noit » Mon Jul 14, 2008 5:39 pm

Hi,

I dunno where to put this one, so forgive if im posting the wrong place..

I want to make a template where the top_picture is changing to another picture for different menus.

is it possible and doesany one have a example that i can use and learn from ?

Thanks in advance

Noit

Connie
Posts: 282
Joined: Thu May 22, 2008 10:11 am
Location: Hamburg
Contact:

Re: dynamic change top_picture

Post by Connie » Mon Jul 14, 2008 10:26 pm

Noit,

this is possible and as I remember it is explained here in the forum or in the old one, www.cmsimple.dk/forum

but unfortunately I do not know the exact syntax, you must do it with cmsimple scripting

I am sure you will get better info soon

Connie
|---
Connie Müller-Gödecke, http://www.webdeerns.de

ZiPs
Posts: 633
Joined: Thu May 22, 2008 6:17 pm
Location: Faxe, Denmark
Contact:

Re: dynamic change top_picture

Post by ZiPs » Mon Jul 14, 2008 11:04 pm

Preben Dahl | Webmaster cmsimple.dk | Projekt-og domæne ejer Gert Ebersbach

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: dynamic change top_picture

Post by Holger » Tue Jul 15, 2008 6:45 am

Hi,

there are some solutions explained on the wiki:
http://cmsimplewiki.com/doku.php/tips_a ... tion/start

Holger

noit
Posts: 9
Joined: Mon Jul 14, 2008 5:27 pm

Re: dynamic change top_picture

Post by noit » Fri Jul 18, 2008 8:42 pm

Hi,

Thanks :-)

I found a lot of goodies to work on :-) which soluton ill use i dunno yet...

Thanks again

harteg
Posts: 27
Joined: Wed May 28, 2008 11:55 am

Re: dynamic change top_picture

Post by harteg » Fri Aug 29, 2008 9:09 am

Put in top of template:

Code: Select all

function image(){global $title,$s,$u,$pth,$l;
if(isset($l[$s])){
$c=explode(':',$u[$s]);
$t=count($c)-1;
for($i=$t;$i>-1 ;$i--){
$c[$i]=preg_replace("/\%../is","",$c[$i]);
if(is_file($pth['folder']['images'].$c[$i].'.jpg')){$img=$c[$i];break;}
}}
if(!isset($img)){if($title!='')$img=$title;else $img='default';}
if(!is_file($pth['folder']['images'].$img.'.jpg'))$img='default';
return '<img src="'.$pth['folder']['images'].$img.'.jpg" width="190" height="190">';}
When naming the images, remove all special charts form the larst part of the URL and use that for filename - on Linux remember, it is case sensitive.

For http://www.cmsimple.com/?Installer%27s_Manual the file name would be Installers_Manual.jpg

Insert the image using:
<?php echo image();?>

Post Reply