How to get the cat_name
How to get the cat_name
Hi All,
In order to only make one or two templates, but having different images on top of it when someone navigates (no: not the random image tag), i'm seeking for the following solution:
suppose your structure is like:
- home
- services
- products
you'll make a template. In the header part, i want to show an image when someone clicks on services and a different one when products is chosen. In order to do so, i thought that:
- creating an services.jpg
- placing it in the pictures directory (/picture)
- adjusting the front.func.inc.php that it looks for picture/services.jpg
does anyone knows how to do this?
regards & thanks in advance
hidiho
In order to only make one or two templates, but having different images on top of it when someone navigates (no: not the random image tag), i'm seeking for the following solution:
suppose your structure is like:
- home
- services
- products
you'll make a template. In the header part, i want to show an image when someone clicks on services and a different one when products is chosen. In order to do so, i thought that:
- creating an services.jpg
- placing it in the pictures directory (/picture)
- adjusting the front.func.inc.php that it looks for picture/services.jpg
does anyone knows how to do this?
regards & thanks in advance
hidiho
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
LOL Oliver
Do you think i would ask this one here just for fun? I've to create 7 main entries in 3 languages = 21 templates. That's why CMS is in place -> easy the job. I was just wondering if there is such a thing like a 'global' $content["acat_name"] or something like that i can use to make it replace a variable.
Anyway, i'll try figuring out how,....
regards
hidiho
Do you think i would ask this one here just for fun? I've to create 7 main entries in 3 languages = 21 templates. That's why CMS is in place -> easy the job. I was just wondering if there is such a thing like a 'global' $content["acat_name"] or something like that i can use to make it replace a variable.
Anyway, i'll try figuring out how,....
regards
hidiho
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Hm, there is - you can choose from frontend structure array - this is always read totally. And this array can be used in own {PHP:check_my_image.php} script. All you have to create in this external script is:
Code: Select all
// where [cat_id] and value = img number
$cat_top_img[10] = 1;
$cat_top_img[2] = 1;
$cat_top_img[5] = 1;
$cat_top_img[12] = 2;
$cat_top_img[3] = 2;
$cat_top_img[6] = 2;
...
switch($cat_top_img[$GLOBALS['content']['cat_id']]) {
case 1: echo '<img src="my_image_1.gif" width="10" height="30">'; break;
case 2: echo '<img src="my_image_2.gif" width="50" height="30">'; break;
...
default: echo '<img src="my_default.gif" width="100" height="30">';
}
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
How do you use it.. I do not understand!! ; if you have time your are more then welcome to make an example!
http://www.studmed.dk Portal for doctors and medical students in Denmark
Frold
suppose the following
you've a template with the header/main/left etc
your sitestructure is:
- home [id=1]
--- about us [id=2]
- services [id=3]
--- special services one [id=4]
- products [id=5]
--- computers [id=6]
you want the header to show the image services.gif when services (or it's sublevel) is clicked and products.gif when products (or its sublevel) is clicked.
now: create your images [home.gif, services.gif, products.gif]. Place them somewhere in a directory: for the example the directory picture/header is used:
create a php file, call it e.g. "show_image.php"
in the file write the following:
Explanation:
case 1; means when either home or about us is selected,
case 2 means when either services or special services one is selected etc
In your template, in the header section, place somewhere where you want it to, a {PHP:show_image.php}.
Now upload your show_image.php to the root directory (otherwise change the path in the {PHP: statement}. Reload your page and see what happens.
regards
hidiho
suppose the following
you've a template with the header/main/left etc
your sitestructure is:
- home [id=1]
--- about us [id=2]
- services [id=3]
--- special services one [id=4]
- products [id=5]
--- computers [id=6]
you want the header to show the image services.gif when services (or it's sublevel) is clicked and products.gif when products (or its sublevel) is clicked.
now: create your images [home.gif, services.gif, products.gif]. Place them somewhere in a directory: for the example the directory picture/header is used:
create a php file, call it e.g. "show_image.php"
in the file write the following:
Code: Select all
<?php
$cat_top_img[1] = 1; //home
$cat_top_img[2] = 1; //about us
$cat_top_img[3] = 2; //services
$cat_top_img[4] = 2; //special services one
$cat_top_img[5] = 3; //products
$cat_top_img[6] = 3; //computers
switch($cat_top_img[$GLOBALS['content']['cat_id']]) {
case 1: echo '<img src="picture/header/home.gif" width="100" height="25" border="0">'; break;
case 2: echo '<img src="picture/header/services.gif" width="100" height="25" border="0">'; break;
case 3: echo '<img src="picture/header/products.gif" width="100" height="25" border="0">'; break;
default: echo '<img src="picture/header/home.gif" width="100" height="25">';
}
?>
case 1; means when either home or about us is selected,
case 2 means when either services or special services one is selected etc
In your template, in the header section, place somewhere where you want it to, a {PHP:show_image.php}.
Now upload your show_image.php to the root directory (otherwise change the path in the {PHP: statement}. Reload your page and see what happens.
regards
hidiho
thanks... you are my man (suppose you are)
http://www.studmed.dk Portal for doctors and medical students in Denmark
Hi,
I think I'll need a help on this one:
Is this maybe already possible and I'm missing something ? Anyone able to point me in the right direction ?
Many thanks in advance,
kippi
I think I'll need a help on this one:
It would be really nice if there were a possibility to use given aliases instead hard coded values in the php ... same actually applies for example to replacements tags: [ID 23]... is working, but something like [ID 'alias_value']... for a given article would be perfect.Oliver Georgi wrote:I have mixed a bit - the struct array is not neccessary for my code snippet.
But you can find the cat name in this array -
$content["struct"][cat_id][...
"acat_name"
"acat_info"
"acat_struct"
"acat_sort" ´
"acat_hidden"
"acat_regonly"
"acat_ssl"
"acat_template"...]
Is this maybe already possible and I'm missing something ? Anyone able to point me in the right direction ?
Many thanks in advance,
kippi
sometime, I'll promise ...
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact: