Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-11-02 14:31:40
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Image depending on category/section
Hi everyone,
I hope I’m not bothering you with stupid questions, but I wasn’t able to find anything suitable for my needs, not with google, not at textpattern.org, not here.
I want a image to be displayed depending on which section is active. I would appreciate it, if this image would be set as css-property and not displayed by html-<img>-tag.
I could hardcode a form, where I am using conditional tags, to use the right image for every section, but I don’t like that idea, because I’d like to have a menu or something in the backend,
where users can choose certain images they’ve uploaded using the textpattern image-upload-tab.
Is there any plugin (or idea) to solve this?
as always, thanks for your time, sorry for my weird english, best regards,
ripvanfish ;)
Offline
#2 2009-11-02 14:39:08
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Image depending on category/section
You can always put a section or a category tag inside normal html tags: <div id="contentdiv-<txp:section />">
, thus it renders as e.g. <div id="contentdiv-about">
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#3 2009-11-02 15:14:28
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Re: Image depending on category/section
Hi uli,
My aim is to set an background-image depending on the active section, but I have to use the same image for more then one section in some cases.
I need something like a tagging-function, so every image with tag “x” will be displayed, then i could use something like <txp:image tag='<txp:section />'>
to display the image.
Imagecategorys doesn’t work for me, because you can’t put an image in more then one category. :(
Offline
#4 2009-11-02 15:37:44
- phuture303
- Member
- Registered: 2008-09-14
- Posts: 127
Re: Image depending on category/section
RipvanFish schrieb:
<txp:image tag='<txp:section />'>
But that’s not the CSS-way you demanded!
Why not using uli’s idea and tweaking your CSS like this
#contentdiv-section1,
#contentdiv-section2 {
background: image-a.jpeg ...
}
#contentdiv-section3 {
background: image-b.jpeg ...
}
Offline
#5 2009-11-02 16:28:55
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Re: Image depending on category/section
Ok, now I understood ulis intention, but how will users be able to attach an certain image to some sections?
I don’t want them to play around with my CSS.
regards,
ripvanfish
Offline
#6 2009-11-02 17:17:08
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Image depending on category/section
Imagecategorys doesn’t work for me, because you can’t put an image in more then one category.
where users can choose certain images they’ve uploaded using the textpattern image-upload-tab
but I have to use the same image for more then one section in some cases.
how will users be able to attach an certain image to some sections?
I don’t see all these loose ends coming together. Could you weave a tissue of them, please ;) It’s you who defines the rules, even randomness.
The pictures, do they already exist or are these future images?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Image depending on category/section
Possibly they don’t need to mess with the CSS. You can for example tell them to upload all images to specific directory with the name of the category.
You can generate code that creates the CSS:
<style type="text/css">
#contentdiv-<txp:category /> {
background: url(<txp:site_url />categoryimages/<txp:category />.png);
}
</style>
Or alternatively you can set the code to get the images from TXP’s image db. For example, you could name images with the name of the category or arrange images to the category of the page and by that filter fetch the image to the dynamic CSS.
Offline
#8 2009-11-03 09:51:21
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Re: Image depending on category/section
Hey,
thanks for your answers.
I could name images, but then i would have to upload an image more then once, if i want to use it for more then one category.
Isn’t there any plugin, that allows tagging images (like on delicious links e.g.) and displaying them by tags?
Offline
Re: Image depending on category/section
There is this tip for section images which also works for categories
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#10 2009-11-03 16:51:49
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Re: Image depending on category/section
You guys get me wrong (what is my fault, im sorry for my english again)
I want to set a background-image for a certain div via css.
This image should be choosen depending of the sectionname.
It should be possible to use the same image for more then one section. (so creating images with <txp:section />.jpg doesn’t work here)
For this 3 things now, i do have a solution. Thank you for that at first!
But the problem now is, that i don’t want to hardcode that image-to-section-relation, because i want users, that will 100% kill my CSS or HTML-Layout if i let them, to decide:
- which image should be used for which section
- upload new images
(If you already gave me a solution for this problem, then repeat it please, my english-skills might let me overread something)
thank you for reading and helping,
regards,
ripvanfish
Offline
#11 2009-11-03 23:24:19
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Image depending on category/section
Rip, have another look at Gocoms proposal in #7.
It’s you who’ll define the category names.
It’s you who’ll define the CSS rules.
If there are any tags that don’t fit in your concept … change them. Or tell us your concept, e.g. which images go where?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#12 2009-11-04 15:56:03
- RipvanFish
- Member
- Registered: 2009-07-09
- Posts: 35
Re: Image depending on category/section
But then i would have to save the same picture n times, when i want to use it for n categorys/sections.
depending on the active section, i want to have another backgroundimage.
Thats no problem, but i want users to be able to decide (in the backend) which image to use for which category and to use the same image for more then just one category.
so the thing with just naming them like the sections doesn’t work here.
Offline