Hi --- Hoping someone is working this Saturday, too, as I need someone to bounce this off of.
I have a content-type called informational that is to be used only for copy on my org's site that will be never removed or replaced, will not display on front page and a few other parameters. Point is: I don't want to break this into two or three other content-types, which I can now see I might be heading for. Reasons for that, too. :-)
OK.. So here's the problem.
In one instance, I want the content-type to be able to have a teaser image that is not used in the full node display.
In a second usage, I want this content-type to be able to have a teaser image that IS used in the full node display.
In a third usage, I want this content-type to be able to have a teaser image that IS used in the full node display, and other images could also be displayed for that same node.
If I was hand-coding, I know what I'd do. But with Drupal, well, the following is what I'm doing. Seems sludgy.
1. One cck imagefield I created has an imagecache preset ONLY for the teaser. Values set to 1, of course.
2. A second imagefield has an imagecache preset for the teaser, with full image use for the full node display. Value set to 1.
3. A third imagefield is set to unlimited for the value and is for full node display only.
Testing to see if this works.
But, hey, my heads getting messed up on this. Seems that there's got to be a better way. Anyone out there to discuss this with me; got a suggestion for a better way? (Using latest prod. quality versions of cck, imagecache, views, panels and a theme I built )
Comments
Another approach
This approach assumes the people making content of type 'information' understand how it work. With this approach you have one image field with multiple set to unlimited. You also have a integer input, radios for widget and allowed values something like
You could then make a custom node.tpl.php for the content type (node-{content-type}.tpl.php, replacing {content-type} with the machine name for the content type). Then use code that uses the integer field to determine how to display the image field.
Hi Steve -- Glad to see you
Hi Steve -- Glad to see you are working, too. Yeah, what you're saying re others making that content type went through my brain. But, I discounted it when I thought the usage for me is going to be highest (I am not only developing but also shooting the pics and writing the copy..sigh) . Because this is fairly "permanent" copy, I anticipate some edits to update by an admin assistant or faculty member but not content creation. Now, I hate to use the word "always" because it's rarely true.
So, I figured I'd put bold instructions there to make clear which is which. I'll be training the admin assist and others..but yeah...there's always down the road...
But, yeah, your point is well taken. Your idea is attractive and much cleaner. Nice and simple. I even like it for myself!
My learning of Drupal is far higher than it was (Ithankfully) but your pushing me into an area I have never been. OK..let's see...the biggest problem in your great idea is how to "use code that uses the integer field to determine how to display the image field." I have seen so much PHP that it no longer looks strange but I can't write it. Have a son who does C++ but he won't migrate to php or I'd ask him.
I can make the tpl file no problem. Hmmm... and then there's the issue of my using Panels for the landing page in question but, as I think on it, that shouldn't matter at all.
So with the following:
How would I get icon image for teaser that displays on landing page created in panels and two images on full node, with neither of them the icon image? Can you multi-select? like 1 plus 3 or 1 plus 2?
This would probably be simpler if I just create derivatives of the info content type, right? hmm
It would take less work if
It would take less work if you create multiple content types and since each can have its own description it should work. But it does make it hard change your mind once you have created content.
As for "multi-select", it would defeat the purpose of the integer field, lets call it "Layout Choice". Since its purpose is to drive theming it needs to only allow for a single choice, otherwise the theming code would not know what choice to use. Instead you could have two choices (fields). The first might be called "Show teaser image" and have choices like "No", "Teaser Only", "Full Only", "Teaser and Full" and another field call "Show additional images" which is just a check box.
Ahhh, your two choice option
Ahhh, your two choice option seems to be the solution. I could click teaser only and add images and get the icon for landing page and different images on full node. Nice. Logical. So, uh, know anywhere that such a snippet of php already exists? lol. got a solution and no code.
This almost feels like something that I wish was patched into cck. Not sure if there's a need...
POSTSCRIPT: Well, it appears that variations of this same question have been posed on the imagefield issues queue. The only form-based solution is to use two imagefields...one for the teaser and one for multiple images. I looked around over there and Nevets idea for code seems the best idea and would solve a lot of problems for a lot of other people.
Thanks for the help Nevet!