Page 1 of 1

How to put {ANY_ALIAS_IMG} into header of template?

Posted: Tue 4. May 2004, 20:48
by jo
Hi all,
It is my first post and first question.

Is there a way to put dynamic image {placeholder/replacement} in the header part of template?

Let’s say if I go to url index.php?contact I will have image contact.jpg
displayed in header and if I go to index.php?any_alias I will see anyaliass.jpg in a header part of the page?

Posted: Tue 4. May 2004, 22:57
by Pappnase
hello

there are two ways! one you create for each its own template!
or you ask jan212 for his script! or you wait for the next release.*smile*

Posted: Tue 4. May 2004, 23:57
by jo
Pappnase wrote:hello

there are two ways! one you create for each its own template!
or you ask jan212 for his script! or you wait for the next release.*smile*
ye, the first one sounds good -- but why would I need a CMS for? :)

if anybody know the answer, please help.
What I need is just a {IMAGE:$alias} :lol:

Posted: Wed 5. May 2004, 11:36
by pSouper
Hi Jo,m
here is a little code that will help you out for now. it is a bit sloppy as it is tied to the category_ID and NOT the alias: i will have a quick look later for the alias solution.

for this code you will new to....
create a dir in you img folder called 'cat_images' and place within all the images you require, these must be named the same as cat_image_(cat_id).gif (example: cat_images_1.gif)
then place this code where ever you would like, whether it be in the template or in an article.

Code: Select all

[PHP]echo "<img src=\"img/cat_images/"."cat_image_".$GLOBALS['content']['cat_id'].".gif\">";[/PHP]
some changes you may wish to make:
change this to any path you choose: "img/cat_images/"
change this to any prefix you choose: ."myFileNamePrefix".
change this to any .extension you choose: .gif

you may also change the code in various ways to create a link of the image, add ALT tags etc.
hope it helps.

ps: to have the image reflect the article_id instead of the cat_id you should do something like this...

Code: Select all

[PHP]echo "<img src=\"img/article_images/"."article_image_".$GLOBALS['content']['article_id'].".gif\">";[/PHP]
very simmiler ;)

Posted: Wed 5. May 2004, 12:30
by Jan212

Code: Select all

<?php 

switch($GLOBALS['content']['cat_id']) { 

 // BOF 1=Your cat with ID 1
case 1: echo '<img src="img/head/my_img_1.jpg" alt="alt">'; break; 
 // EOF 

 // BOF 2=Your cat with ID 2
case 2: echo '<img src="img/head/my_img_2.jpg" alt="alt">'; break; 
 // EOF 
// to be continued...

default:    echo '<img src="img/head/my_def_img.jpg" alt="alt">'; 

} 

?>
Desc:
case "cat_id_int":echo '<img src>'; break;

Save the code from the code block below uner a new file. place it in the inc_ext folder in a new folder and call it like

{PHP:include/inc_ext/myfolder/myexample.php}

Posted: Wed 5. May 2004, 12:33
by pSouper
all clean a pretty jan ;)

Posted: Wed 5. May 2004, 12:54
by Pappnase
yes jan is a good boy!*smile*

i had thios script in my site!
i had it also post! but i didn't can discribe it! :oops:

Posted: Wed 5. May 2004, 16:24
by jo
thx all of you for fast respond.
I’ll try jan212 coding, because of a default img.

Posted: Wed 5. May 2004, 20:03
by Jan212
SORRY TO ALL - I WAS ILL LAST WEEK AND COULDN'T SUPPORT THE COMMUNITY - and was busy all the time too...
now i am back on the track - regards to oliver, pappnase, frold, psouper, jérôme, snobba and all others...

Posted: Wed 5. May 2004, 20:14
by pSouper
Hi J,
phew! I can go to bed now, i have been up 24/7 covering you here :shock:

:D

Posted: Wed 5. May 2004, 20:22
by Jan212
hi p,

thx to you and nice sleep :wink: - 24/7 support - we should work together...

|°~-| RAZZRRRRRRRRRRR....