Gazley Posted August 11, 2012 Share Posted August 11, 2012 Hi there, I want to create a drop down list so that I can filter queries by common values. I was surprised to not be able to find a combo or drop down list and after reading some threads in here, I came across this Page concept. At the risk of sounding really thick, I don't really understand it. I want to have some cross template common categories in a list. Is there a tutorial or anything that shows how to do this? Thanks. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted August 11, 2012 Share Posted August 11, 2012 Lists, It's just a mindset. ( selects grouped checkboxes, radios etc ) are just groups of pages. For example: Make a template without file called: "checkboxes" and put children in it with a template "checkbox" with only the title field. Name of the title is being used for the select value. Now from every other template you can add a field page to it and select "checkboxes" as parent. Link to comment Share on other sites More sharing options...
Gazley Posted August 11, 2012 Author Share Posted August 11, 2012 Thanks Martijn. I can't see how I could do this and get the Dropdown list into a repeater. Is this possible? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted August 11, 2012 Share Posted August 11, 2012 Thinkso, but never tried.... maybe you should try. ( repeater is just a collection of fields which you can repeat ) Link to comment Share on other sites More sharing options...
Gazley Posted August 11, 2012 Author Share Posted August 11, 2012 >Make a template without file called: "checkboxes" and put children in it with a template "checkbox" I've made the template using the "basics" section of the template editor. How do I put "children" in it? Link to comment Share on other sites More sharing options...
Soma Posted August 11, 2012 Share Posted August 11, 2012 Gazley, if you provide us with more details of what you want to archive we could help more finding good solutions. The concept of this is to create a set of pages under a tree branch using certain template or different templates. Then use rules/filters/queries (parent, template, etc) in a page reference field, to select from the set of pages through that page reference field. Link to comment Share on other sites More sharing options...
Gazley Posted August 11, 2012 Author Share Posted August 11, 2012 Hi Soma I want to provide a set of categories for images. An image may have one or more categories. So, an image may be categorized "carousel". This means that in a collection of a pages images, I can filter out images that can be displayed in the page's carousel. Another example is where a single image in collection of a pages images can be categorized as "summary". This means if the page containing the images is summarized on, say, the home page, I can identify which image should be used as the summary image. My main page template contains a repeater called "image_meta" that contains an image and additional fields for image based meta data. I want to add my multi-select drop-down list to this repeater so that consistent categorization can be applied to the images. Does this make sense? Link to comment Share on other sites More sharing options...
Soma Posted August 11, 2012 Share Posted August 11, 2012 You can't with the default image field add categories to it. I thought somebody was doing something to add creating a custom image fieldtype but can't find it currently. If you use repeaters, I'm not really thinking it all through and not sure this is the best way to go, it is possible. You then can create branch using a "category" template. Categories - Summary - Carousel Then you create custom page fieldtype "categories_selected" that has set /Categories as the parent and allow multiple pages. Then make the inputfield of the page fieldtype either checkbox or the asm select. Then after saving you see additional options depending on the inpufield. Now add that page field to the repeater or template you want to define categories. Then you should be able to select images using one or multiple categories. I'm not sure but it should be possible to select images (repeater elements) using ->find("selector") I haven't really extensively used repeaters yet other than little testing. You would have to test yourself. Maybe there's alternatives. $cat = $pages->get("/categories/summary/"); $images = $page->repeaters->find("categories_selected=$cat"); Thinking about alternatives: You could also create a image field called "image_summary" and use that, or create a image field "carousel" specially for carousel. Another option would be to create dedicated pages holding the image for a carousel and then make them selectable through a page field (same as with categories). Like a centralized repository of image galleries. Almost endless possibilities once you get the hang of it combine fields and pages. 1 Link to comment Share on other sites More sharing options...
Gazley Posted August 11, 2012 Author Share Posted August 11, 2012 Soma "Then you create custom page fieldtype "categories_selected" that has set /Categories as the parent and allow multiple pages" This was when the "penny dropped"! It appears exactly how I want it to in my "image_meta" repeater field! Now just some playing around with the querying and I'm done. Thank you so much! You too Martijn! --Gary 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now