4images Forum & Community
4images Modifications / Modifikationen => Templates & Styles (Releases & Support) => Topic started by: SLL on January 14, 2003, 10:10:23 AM
-
I've got a number of emails asking how to add static icons in the Category frame. Below is my solution:
- Create icons for each category and name them category[cat_id].gif, for example category1.gif, category2.gif, etc.
This is according to your taste, of course. I'm using 40x40 gif's like this: (http://faces.dalnet.ru/templates/4blue_orange1/images_russian/category1.gif) (http://faces.dalnet.ru/templates/4blue_orange1/images_russian/category2.gif)
- Create the image joinbottom.gif for sub-categories or use mine:(http://faces.dalnet.ru/templates/4blue_orange1/images_russian/joinbottom.gif)
- Place them all into /templates/xxxx/images/ folder (or /templates/xxxx/images_lang/ if you are using multiple languages)
- Change your /templates/xxxx/category_bit.html as follows:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" rowspan="2" align="center" valign="top">
<a href="{cat_url}"><img src="{template_lang_image_url}/category{cat_id}.gif" border="1"></a></td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
</tr>
<tr>
<td align="left" valign="top">{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}</td>
</tr>
</table>
{if sub_cats}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center" valign="top"><img src="{template_lang_image_url}/joinbottom.gif"></td>
<td align="left" valign="top">{sub_cats}</td>
</tr>
</table>
{endif sub_cats}
- If you do not use multiple languages, change {template_lang_image_url} to {template_image_url}
That's it! Demo at http://faces.dalnet.ru/index.php?l=english (http://faces.dalnet.ru/index.php?l=english)
-
VERY nice.. my only question is how do I get it so the text isn't so close to the images?
-
ah, nevermind, just figured it out.. great mod!
-
ok now I got a problem..
Now my links are messed up, there trying to go to http://www.madfunny.com/{cat_url}
any ideas?
-
hmm, weird figured it out, I took the original <a href..... from another template and it works fine not. :idea:
-
Would be great if you can give me a idea how i impiment it into
the External Random Image from:
http://www.4homepages.de/forum/viewtopic.php?p=19135#19135
Thanks
-
How do I do it, that it will only show 1 Catimage not category1, category2, category3, categoryn ?
EDIT:
Thx, I figured it myself out!
Thx, Fuz
-
Hello,
it's me again!
What I do miss is that these subcategories are listed one by one. But I want it, like V@no @ gallery.vano.org, mutual.
How do I do this?
Thx, Fut
-
I don't wish to have images for every category. As I have 500+, is it possible to only have them where there are images? Can the clause be written 'if there is an image' then display it? I'm clueless about code, but I like how this mod works.
-
ah, nevermind, just figured it out.. great mod!
how did you do it i have the same problem?
-
hey thats great, but i have over 200 categorys...
i just need about 12 icons...i get a red x at the other categories. how do i change that? :?
:arrow: http://aaliyahlegacy.aa.funpic.de/4images/index.php
-
Great mod. It works as expected.
Luckily I only have 42 categories so far and not too much work creating those thumbs.
http://www.wydmuch.de/4images/index.php
It really improved the whole layout of the page, I think :)
But I still have to do a lot...
-
hey thats great, but i have over 200 categorys...
i just need about 12 icons...i get a red x at the other categories. how do i change that? :?
:arrow: http://aaliyahlegacy.aa.funpic.de/4images/index.php
Asuming you have allowed php execution in templates (controled by includes/constants.php)
Then try use in the template something like this:<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array(1,2,3,4)))
{
$icon = "category".val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_lang_image_url']."/".$icon."\" border=\"1\"></a>";
?>
Replace 1,2,3,4 with the categorie's IDs which you wish to be displayed with the custom icon.
folder.gif image will be used for the categories not from that list
P.S. make sure there is nothing on the same line with <?php and ?> not even a space!
P.P.S. I have not tested this code and typed it directly in the browser, so there is a possibility of an error... :oops:
-
Descent solution!
-
great MOD. My gallery is nicer. My members can choose baby through icon now! You can see in sub-cat at http://www.3xland.com :wink:
thanks SLL so much!
-
hi V@no
this code in which file I must put it?
<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array(1,2,3,4)))
{
$icon = "category".val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_lang_image_url']."/".$icon."\" border=\"1\"></a>";
?>
do you have had time to prove it to know if it works?
thanks man
saludos
emilio
-
in category_bit.html template
-
hola V@no
I´am sorry. I can´t do it, could you help me please?
this is the code of my category_bit.html:
table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" rowspan="2" align="center" valign="top">
<a href="{cat_url}"><img src="{template_lang_image_url}/category{cat_id}.gif" border="1"></a></td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
</table>
thanks
saludos
emilio
-
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" rowspan="2" align="center" valign="top">
<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array(1,2,3,4)))
{
$icon = "category".$this->val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_lang_image_url']."/".$icon."\" border=\"1\"></a>";
?>
</td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
</table>
-
hi V@no
I´m sorry, I know that I insist much :oops:
in my includes/constants.php I have this:
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);
this is ok.
but when put your code in category_bit.html, I see this:
Parse error: parse error in c:\appserv\www\comprar\includes\template.php(101) : eval()'d code on line 8
saludos
emilio
-
fixed now ;)
-
Thanks! This is exactly what I needed.
-
Vano.... can't you alter your code so, that it just shows the default folder icon if no dedicated icon for the specific category can be found? To avoid the need of filling the array with all the categories that should show a custom icon.....
<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array(1,2,3,4)))
{
$icon = "category".val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_lang_image_url']."/".$icon."\" border=\"1\"></a>";
?>
-
Hi! V@no
Kann man den Code so umstellen das nicht das Bild UND das folder.gif kommt.
Wenn ich die Kategorien ausblenden will, bei denen das folder.gif NICHT erscheinen soll, dann kommt das von mir erstellte Bild doppelt!
Hier ist mein Code im Moment:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" rowspan="2" align="center" valign="top">
<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array()))
{
$icon = "category".$this->val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_image_url']."/".$icon."\" border=\"1\"></a>";
?>
<a href="{cat_url}"><img src="{template_image_url}/category{cat_id}.gif" border="1"></a></td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
<td>
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
</td>
</tr>
<tr>
<td align="left" valign="top">{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}</td>
</tr>
</table>
{if sub_cats}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center" valign="top"><img src="{template_image_url}/joinbottom.gif"></td>
<td align="left" valign="top">{sub_cats}</td>
</tr>
</table>
{endif sub_cats}
Hier ein Bild:
-
Hi! V@no
Kann man den Code so umstellen das nicht das Bild UND das folder.gif kommt.
Wenn ich die Kategorien ausblenden will, bei denen das folder.gif NICHT erscheinen soll, dann kommt das von mir erstellte Bild doppelt!
Ok...hab das Problem selber gelöst....Hab den Code von ersten Autor noch mitübernommen => deswegen doppelt.
<a href="{cat_url}"><img src="{template_image_url}/category{cat_id}.gif" border="1"></a>
Wenn der ausgeklammert oder gelöscht wird und in in den "()))" die category ID reingeschrieben wird die ein selber erstelltes Bild besitzen,
dann funktioniert das alles wunderbar!
Hier mein aktueller Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" rowspan="2" align="center" valign="top">
<?php
$icon = "folder.gif";
if (in_array($this->val_cache['cat_id'], array(22,23,24,28,25,4,45,48,69,74,75,85,98,99,103,112,6,7,8,55,92,93,90,95,96,100,94,101,11,76,77,78,79,80,12,13,14,15,56,
100,106,110,109,17,18,19,104,105,32,34,35,40,89,27,26,29,46,49,51,82,87,91,102,111,113,43,44,63,72,1,5,10,16,30,37,53,70,41,71)))
{
$icon = "category".$this->val_cache['cat_id'].".gif";
}
echo "<a href=\"".$this->val_cache['cat_url']."\"><img src=\"".$this->val_cache['template_image_url']."/".$icon."\" border=\"1\"></a>";
?>
</td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
<td>
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
</td>
</tr>
<tr>
<td align="left" valign="top">{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}</td>
</tr>
</table>
{if sub_cats}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center" valign="top"><img src="{template_image_url}/joinbottom.gif"></td>
<td align="left" valign="top">{sub_cats}</td>
</tr>
</table>
{endif sub_cats}
-
How do I do it, that it will only show 1 Catimage not category1, category2, category3, categoryn ?
EDIT:
Thx, I figured it myself out!
Thx, Fuz
I have that problem but I couldn't figure it out. Can someone show me how I all the rest of category2, category3, etc. to show?
edit. heh, figured it out myself.
thanks.
-
Great mod. It works as expected.