4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Jan on September 12, 2002, 12:07:48 PM
-
This mod allows you to use different category templates. Templates will be inherited on subcategories.
----
Diese Modifikation erlaubt es, verschiedene Templates für Kategorien zu verwenden. Dabei wird ein Template auf seine Unterkategorien vererbt.
Installation:
1. Open "includes/functions.php" and add after:
if (!defined('ROOT_PATH')) {
die("Security violation");
}
this code:
function get_cat_template($tpl_name, $cat_id = 0) {
global $cat_cache;
if (!$cat_id) {
$new_tpl_name = $tpl_name;
}
elseif (file_exists(TEMPLATE_PATH."/".$tpl_name."_".$cat_id.".html")) {
$new_tpl_name = $tpl_name."_".$cat_id;
}
else {
$new_tpl_name = get_cat_template($tpl_name, $cat_cache[$cat_id]['cat_parent_id']);
}
return $new_tpl_name;
}
2. Open "categories.php" and add before:
$site_template->print_template($site_template->parse_template($main_template));
this code:
$main_template = get_cat_template($main_template, $cat_id);
3. Create a new template for a specific category (you may duplicate "categories.html" and modify it) and save it under this name:
categories_<cat_id>.html
Replace <cat_id> with id of the category.
This category and all subcategories will now use this template.
If you want to use a different template for the details page , do step 2 for "details.php". Then create a new template for the details page (you may duplicate "details.html" and modify it) an save it under this name:
details_<cat_id>.html
Replace <cat_id> with id of the category.
This category and all subcategories will now use this template for the details page.
-
Hi,
das ist klasse
werde es gleich heute abend testen !!
Grüße
-
Hi,
wenn man aber verschiedene CSS Einstellungen benötigt, dann gaht das ganze ja nicht oder ? Weil die CSS Datei ist ja in der header.html eingebunden. Kann man auch noch unterscheidliche css Dateien verwenden ?
Grüße Basti
-
Oder geht es vielleicht mit unterschiedliche Headern ?
-
Soweit ich weiss, kannst Du css-Dateien auch ausserhalb des Headers einbinden.
Gruß Jan
-
Hi Jan,
also es ist ja so, daß ich im header die css Datei eingebunden habe und die steuert ja das ganze Design (Farben, Hintergrund). Kann man dem 4images- script nicht auch sagen, daß man z.B. den Header_1.html nehmen soll, wenn die category_1 ausgewählt ist ? Oder geht so was nicht ?
Grüße Basti
-
Schwierig, mir ist jetzt auf Anhieb keine Lösung eingefallen. Entweder Du ziehts den Header mit in die Haupt-Templates hinein (muss Du dann allerdings bei allen machen, home.html, member.html etc.) oder Du versuchst es irgendwie mal selbst. Header und Footer werden in "includes/page_header.html" geparsed.
Jan
-
Hi,
wenn ich die drei Domains auf einem Server liegen habe, dann geht es, indem ich die CSS so einbinde:
<link rel=stylesheet type="text/css" href="http://<!--#echo var="SERVER_NAME" -->/css1.css">
Das Problem ist da dann nur, daß man die header.html, dann in header.shtml umbenennen muss, aber dann wird diese logischerweise nicht mehr gefunden, kann man das auch irgendwo umstellen ?
Grüße
-
In .shtml umzubennen würde nichts bringen, da die Templates ja nicht direkt angezeigt werden, sondern vom Script geparsed werden.
Probiers mal mit:
<link rel=stylesheet type="text/css" href="http://<?php echo $SERVER_NAME; ?>/css1.css">
Gruß Jan
-
Hi Jan,
wenn ich die ganzen Dateiendungen auf shtml änder und dann in der template.php die Dateiendung auf shtml stelle, müsste es doch gehen oder ?
Habe es getestet, das funzt irgednwie auch nicht.
-
Hi,
habe nun mal deine Variante getestet, da kommt folgender Fehler:
Parse error: parse error in /home/www/web487/html/pepsi/images/includes/template.php(133) : eval()'d code on line 6
Wat is das nu ?
Grüße Basti
-
Warum benutzt Du eigentlich nicht:
<link rel=stylesheet type="text/css" href="/css1.css">
Jan
-
Hi Jan,
weil ich doch drei verschiedene CSS Dateien verwenden will (drei Homepages mit drei verschiedenen Designs), aber das ganz mit einem Scritp und nicht mit drei Scripten managen will.
Grüße Basti
-
Deine Variante ergibt aber dasselbe wie meine. Entweder Du willst für jede Domain eine eigene css Datei verwenden oder für alle Domains eine css Datei. Dann kannst Du die URL auch fest reinschreiben.
Jan
-
Hmmmm,
irgendwie stehe ich auf dem Schlauch, ich habe doch meine ganzen Templates in einem Ordner, z.B. default. Dort liegt doch auch die css Datei. Wenn ich nun mit /*.css verlinke, nimmt er doch genau aus diesem Ordner (in diesem Fall default) die css. Oder sehe ich da was falsch ?
Wenn ich richtig liegen würde, dann wäre doch die css Datei für alle Haupt / Unterkategorien gleich.
Ich will ja aber für meine drei Hauptkategorien
- categories.php?cat_id=1 (domain1)
- categories.php?cat_id=2 (domain2)
- categories.php?cat_id=3 (domain3)
Und die jeweils entsprechenden Unterkategorien jeweils eine andere css Datei habe. Wenn ich von domain1 komme, soll die css1.css Gültigkeit habe und wen ich von domain3 komme, soll die css3.css Gültigkeit haben.
Ich will eben für jede Domain eine eigene css Datei habe.
Oder geht so was nicht ?
-
Da wärst Du aber mit Deiner Lösung nicht weit gekommen. Die hätte ja vorrausgesetzt, dass im root Verzeichnis jeder Domain die Datei css1.css liegt.
Warum lädst Du in die entsprechenden Templates nicht einfach eigene Stylesheets rein?
in categories_1.html
<link rel="stylesheet" href="{template_url}/style_1.css" />
usw.
Wenn diese Datei zusätzlich nach Standarddatei reinlädst und in dieser die gleichen Styles hast, werden die Styles mit gleichem Namen in der Standarddatei überschrieben.
Jan
-
Hi Jan,
warum einfach, wenn es auch kompliziert geht, das war natürlich die Lösung ! Dachte nur, daß die header css Einstellung überwiegt.
Grüße Basti
-
danke für dieses feature. hat mir sehr geholfen.
:lol: :lol: :lol:
0711concept
-
Hallo Jan,
Der mod ist ja Suuuuuuuuuuuper, geht einwandfrei :) Trotzdem hab ich noch ne Zusatzfrage dafür:
In das neu erstellte Template categories_<cat_id>.html wird ja die thumbnail_bit reingeparst. Gibts noch ne Möglichkeit auch für die thumbnail_bit eine thumbnail_bit_<cat_id> zu erstellen, die dann auch in die entsprechende categories_<cat_id>.html geparst wird.
Möchte nämlich in dem einen Template der neuen Kategorie den <autor_link> draußen haben, aber eben nur in dieser einen Kategorie.
Hab zwar schon versucht das irgendwie hinzukriegen, ist aber alles fehlgeschlagen :(
Gruß
tommy
-
Siehe: http://www.4homepages.de/forum/viewtopic.php?t=2218
Jan
-
Hallo Jan,
ich möchte für eine Categorie ein bestimmtes Template category_bit.html ein gefügt haben, um diese farblich hervorheben zu können. Ist das machbar?
Danke!
Michael
http://www.community.fotoforum24.de es handelt sich um die Categorie
TOP FOTO GALERIE
-
Probiere folgendes. Suche in inlcudes/functions.php diese Zeile
$categories .= $site_template->parse_template("category_bit");
und ersetze sie mit
$cat_tpl = get_cat_template("category_bit", $category_id);
$categories .= $site_template->parse_template($cat_tpl);
Dann ein neues Template category_bit_<cat_id>.html erstellen.
Jan
-
sorry war keine Absicht mit dem Doppelposting! hatte vergessen das ander zu löschen :-(
Danke für den Tipp, werde ich heute abend probieren!
-
Das ist die Fehlermeldung die kommt!
Fatal error: Call to undefined function: get_cat_template() in
Beste Grüße Michael
-
Achso, Du musst natürlich noch Punk 1 von meinem ersten Postimg ausführen.
http://www.4homepages.de/forum/viewtopic.php?p=7781#7781
Jan
-
He Jan SUPER!
Ich Depp habe gestern diese Zeilen wieder entfernt als es nicht geklappt hatte und heute schnell schnell und vergessen.
Jetzt funktioniert es !
Siehe http://www.community.fotoforum24.de
Besteb Dank Michael
-
Koennte man sowas nicht mit Hilfe von Referern loesen?
Die Galerie koennte dann abfragen woher ein Besucher kam.
Kommt er von Domain 1 dann gilt CSS1 etc.
Kommt er von einer fremden Page muss ein Standard CSS herhalten.
Du koenntest aber doch sicher auch eine If Abfrage in die Kategoriewahl einbauen sofern du die nicht aenderst muesste das gehen.
also ich dachte da an sowas wie if cat=1 lade css1 etc.
Sind nur Ideen und keine Loesungen ich weiss aber ich habe in diesen Bereich zu selten reingesehen um da was genaueres zu zu sagen. Vielleicht hat das aber auch schon wenigsten ein bisserl geholfen
-
Hallo zusammen,
geht es das man dieses Skript ändert um damit nicht die templets zu ändern sondern das ich damit auf der "home.html" verschiedene Bilder zu den Kategorieen anzeigen zu lassen anstatt des "folder.gif" ein Beispielbild zu jeder Kategorie???????
lg
Gabi
-
Interessante Frage Gabi. Waere jedenfalls ne tolle Sache wenn man Bilder pro Kategorie festlegen koennte oder jeweile ein Random Bild aus dieser Kategorie als kleines Thumbnail davor stehen wuerde.
Bin gespannt auf weitere Antworten
-
Interessante Frage Gabi. Waere jedenfalls ne tolle Sache wenn man Bilder pro Kategorie festlegen koennte oder jeweile ein Random Bild aus dieser Kategorie als kleines Thumbnail davor stehen wuerde.
Bin gespannt auf weitere Antworten
Naja ganz so aufwändig hatte ich es mir nicht gedacht :-) Ich wollte eigentlich nur ein "festes Bild" jeder Kategorie zuordnen.....ich glaube das ist auch etwas einfacher zu realisieren....
lg
Gabi
-
Der Code für ein Zufallsbild neben dem Kategorienamen steht auskommentiert im Template category_bit.html.
Für ein festes Bild kann man z.B.
<img src="/images/{cat_id}.gif" border="1">
einfügen und dann im Ordner "images" für jede Kategorie ein Bild <cat_id>.gif hinterlegen.
Jan
-
Hallo Jan,
danke für deine schnelle Antwort. Wie müßte der Cod
Code:
<img src="/images/{cat_id}.gif" border="1">
denn aussehen wenn ich 20 verschieden Kategorien habe und wie sieht die genaue Benennung der "images" denn aus ???? Sorry falls dir diese Frage dumm erscheint, aber ich bin in Sachen php noch Anfänger. Deshalb frage ich manchmal lieber etwas genauer bevor ich etwas kaputt mache :oops:
lg
Gabi
-
Hallo Jan,
habe den Cod der category_bit.html wie folgt verändert :
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<img src="/images/Cat-Images/{cat_id}.gif" border="1">
<!-- {if random_cat_image_file}<a href="{cat_url}"><img src="/images/Cat-Images/{cat_id}.gif" border="1">-->
</td>
<td>
<a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
</td>
</tr>
</table>
{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}
{if sub_cats}{sub_cats}{endif sub_cats}
aber die bilder werden nicht angezeigt. Die Bilder habe ich unter /images/Cat-Images abgespeichert und wie folgt benannt hier 2 Beispiele :
32.gif und 19.gif wird nicht angezeigt
<32>.gif und <19.>gif wird auch nicht angezeigt
<cat_id32>.gif und <cat_id19>.gif wird auch nicht angezeigt
Kannst du mir vieleicht sagen wo ich einen Fehler mache???? Platzhalter erscheinen nämlich an den Stellen wo die Bilder sein sollten...
Wäre echt toll wenn du eine Lösung hättest.
M.f.G.
Gabi
-
How can user to chose diferent templates on the same site.??
-
categories works well - however, the Details pages don't "take" -
If you want to use a different template for the details page , do step 2 for "details.php". Then create a new template for the details page (you may duplicate "details.html" and modify it) an save it under this name:
Code:
details_<cat_id>.html
Replace <cat_id> with id of the category.
This category and all subcategories will now use this template for the details page.
basically, I want to hide the "uploaded by" lines in certain categories in the Details pages. When I make the change mentioned above, create my new template and upload, *all* details pages are using the new template...
Anything I missed :?: :?: :idea: :?:
-
Can you show an example?
-
sure - click my sig.
I basically want to hide everyone's name who uploads something to the "Challenge" category (http://digiart.graficalicus.com/categories.php?cat_id=52) (which is category #52), and everything underneath it -- The category template ("Categories_52.html") works well - everywhere in the challenge cat & all sub & sub-sub categories hide the user name on the thumbnail. It also has a red bar across the top with a menu in it.
- Clicking a thumbnail from any of the challenge categories opens the Details_52.html template, which ALSO has a red bar across the top and "[*User Name Hidden*]" in the "uploaded by: " section - but this template is used throughout the whole site on every details page, not just the ones beneath the challenge cat.
- Try this category (http://digiart.graficalicus.com/categories.php?cat_id=96) to see what I mean - it reverts back to the "standard" categories template (no red bar & uploader name is shown), but clicking an image opens the "Red Bar" details template.
For some reason, it's not reverting to the standard details template for non-challenge images...?
thanks for any help - -
-
If i click on this image (http://digiart.graficalicus.com/details.php?image_id=1937) for example, there is no "red bar". Seems to work perfect :roll:
-
Ack!
I changed it back this morning when some users emailed me about a "bug".... - sorry!
Let me change the template again (& irritate visitors!) so you can see what I mean - - - it's changed... try this image (http://digiart.graficalicus.com/details.php?image_id=1937) again - - you'll see a red bar now...
-
I think its because of your "recent comments" feature, which probably changes value of $cat_id variable.
-
hmm.... thx - -
time to actually think now, instead of waiting for someone else to do it for me 8) (I hate when that happens....)
[thinking out loud..] so I have to somehow readjust the $cat_id to look at templates.......
-
if anything in details.php is altering $cat_id variable, just replace it with another variable ($catid)
-
how/where? I've replaced (in the three files used in this MOD - details.php, categories.php, functions.php) the seven instances of $cat_id with $catid .
No luck. Works great still with the category pages, but details pages are still not responding.... :cry:
-
I was only refering to the code for your "recent comments" (unless ofcourse it's in page_header.php)
-
AArrggghhh! still can't figure out what's not working or what's interfering.
Simple thing - all I want is users to not see who uploaded images in one category, plus its sub-categories!
"recent comments" code is in Details.php - but shouldn't "unset($cat_id);" work to turn it off, if I place this snippet before it arrives at the category selection piece of code? (tried - didn't work, either... but maybe I'm not placing it in the right place. I placed it just above "// Print Out" section....)
8O
Any & all help is much appreciated - my php is still not too good (but I'm learning!) :oops:
:arrow:should I post my details.php here?
-
"recent comments" code is in Details.php - but shouldn't "unset($cat_id);" work to turn it off, if I place this snippet before it arrives at the category selection piece of code? (tried - didn't work, either... but maybe I'm not placing it in the right place. I placed it just above "// Print Out" section....)
actualy unset() will destroy the variable, but we need it!
:arrow: should I post my details.php here?
before u do that replace $main_template = get_cat_template($main_template, $cat_id);
with$main_template = get_cat_template($main_template, $image_row['cat_id']);
If that wont help, then attach your details.php to your reply (dont post the code, please)
-
no luck :(
details.php attached...
-
OK - let's actually attach the file, then.... :oops:
attached as a .txt file........
-
as I expected, u had $cat_id overwritten by some other code.
attached the corrected version.
-
thank you - - but still no joy.... :(
it's still grabbing the "red bar" template for every details page.
-
Hey!
I undid this step from above - Code:
$main_template = get_cat_template($main_template, $cat_id);with
Code:
$main_template = get_cat_template($main_template, $image_row['cat_id']);
and it's all happy! :D
Thanks!
(Ok - next project - hide user names for the red challenge categories when a challenge thumbnail shows up in random images, new images, on my main site, etc.... - - )
-
This mod allows you to use different category templates. Templates will be inherited on subcategories.
----
that's great but how can i make it work with language select?? that is when a user chooses any other available language he'll get a different template!
p.s: hope that i'm asking in the right thread coz i've asked in Language Select Mod thread but my question got ditched :(
-
Any way to modify this so that the sub-categories won't inherit the redesigned template?
Other than creating a new HTML for each separate category?
Thanks.
-
in includes/functions.php find:
$new_tpl_name = get_cat_template($tpl_name, $cat_cache[$cat_id]['cat_parent_id']);
replace it with: $new_tpl_name = $tpl_name;
-
Thanks V@no, works great!
-
Hallo hätte da mal ne Frage, und zwar ich habe das Aussehen meiner Galerie verändert, läuft auch alles prima, nur wenn man auf die unterkategorien klickt,sind diese Seiten rechts daneben, wie kommt das und wie kann ich das ändern.
ich füge mal den link zum Nachschauen mit rein
http://galerie.sylvia-s.de
LG Sylvia
-
$main_template = get_cat_template($main_template, $cat_id);
so for details will be :
1) $main_template = get_details_template($main_template, $cat_id);
or
2) $main_template = details_template($main_template, $cat_id);
:?:
-
No, its the same:
$main_template = get_cat_template($main_template, $cat_id);
-
this is possible for member_profile(s) ???, make each member make your own profile(page) style ?
not only a content , but whole page (without affect others member.php pages (editprofile,upload...) ) !?
-
Why not just create many templates and let members chose which one they like to use when they visit? ;) (there is a mod for that)
-
i just need for member_profile ;) , it's more easy making users create your own template, than i :mrgreen:
do some like member_profile_3.html for User3 ..etc ;)
each user make your own template and upload to path of templates ..... :?:
i.e :
$main_template = get_cat_template($main_template, $user_id); <=== Like this on member.php ??
member_profile_1.html
member_profile_2.html
member_profile_3.html
etc... :wink:
-
Wie man verschiedene Templates für (member_uploadform.html )
machen kann
-
Jeb..
Würde mich auch interessieren, wie oder was ich machen muss, damit ich auch verschiedene Uploads (je Kategorie) verwenden kann...
-
How can I extend this mod to also support different media templates? (/templates/foobar-template/media/)
-
How can I use this mod to have different thumbnail_bits depending on the catogory?
thanks in advance.
-
@ impss;
try this: http://4homepages.de/forum/index.php?topic=2218.0 (http://4homepages.de/forum/index.php?topic=2218.0)
-
Thanks manurom
I will give that a shot.
-
Hallo zusammen,
geht es das man dieses Skript ändert um damit nicht die templets zu ändern sondern das ich damit auf der "home.html" verschiedene Bilder zu den Kategorieen anzeigen zu lassen anstatt des "folder.gif" ein Beispielbild zu jeder Kategorie????
-
Hallo maus,
deine Anfrage hat aber mit diesem Mod fast nicht zu tun...
Eher dieser Mod:
http://www.4homepages.de/forum/index.php?topic=6922.0 (http://www.4homepages.de/forum/index.php?topic=6922.0)
Es gibt aber noch einige andere, die dieses Thema behandeln...
Gruß
Kurt
-
Hallo maus,
deine Anfrage hat aber mit diesem Mod fast nicht zu tun...
Eher dieser Mod:
http://www.4homepages.de/forum/index.php?topic=6922.0 (http://www.4homepages.de/forum/index.php?topic=6922.0)
Es gibt aber noch einige andere, die dieses Thema behandeln...
Gruß
Kurt
Hallo Kurt,
danke für deine schnelle Antwort. Leiter kann ich kein Wort englisch.
Gruß
Maus
-
Hallo,
das ist natürlich schlecht... aber,
wenn du z.B. für die folder.gif folgendes in die thumbnail_bit.html einträgst:
<img src="{template_url}/images/folder_{cat_id}.gif" alt="" />
und nun in templates/default/images/
für jede Kategorie ein Bild hochlädst (folder_2.gif z.B. für Kat 2)
haste im Prinzip das Gewünschte.
Bei dem angesprochenen Mod wäre es halt ein Zufallsbild aus der jeweiligen kat ohne Arbeit für dich durch
das Erstellen und Hochladen der kat Images
Gruß
Kurt
-
can someone mabe enhance the category_bit part so, that I can assign a different caregory_bit to all subcategories of cat_id=12 while category_bit_12 is not the same as the category_bit for the subcategories. This way I don't have to create a seperate category_bit for each subcategory seperately. That means.... for example... I have category 12, and 3 subcategories under cat_id 12... with IDs 13,14,15.... so, now I have category_bit_12.html for the look of category 12... and one new category_bit for all the subcategories...like category_bit_12_sub.html. All subcategories now use this new category bit.... instead of needing it's own bits like category_bit_13, category_bit_14 etc.....
Would be cool... :)
-
Is it possible to edit the category.php file so I can choose the template for a specific category on the admin panel?
Thanks
-
Yes Yes Yes that's the point.What albertpr9 said.
Is there any possibility to add this function to the Admin Control Panel ???
differnet themes for Categorie Details etc.
-
ok, nice! thanks very much!
But I want admin choose template for each category !
mean: member profile, details, uploadform... is changed
EX: I have a site. have 2 CAT: Images and Download file
Cat Images as a site
Cat Download as a site
each category have a template
Help me Please !
-
It is possible to adapt this mode to be use for search function?
I'd like to show the search result in different template than normal images.
details.php?image_id=51&mode=search to be parsed in details1.html ...
-
Danke für die Mod
-
Hallo zusammen...!
Genau so eine MOD habe ich gesucht.
Kann es sein, das es mit 1.7.7 nicht läuft......oder bin ich einfach zu blöd...????
Gruß
Ralf
:idea: Ich war zu blöd...!
-
Hallo Jan,
ein toller MOD. Ist es auch möglich bestimmten Kategorien eine separate member_uloadform.html zuzuordnen?
Gruß Steffen
-
is there any demo of this mod, where i can see how it looks like..
this mod looks intresting.. but it will be better to see working demo of this mod?
so please any one used this mod can post their demo or site link?