Tuesday 13 July 2004 1:22:31 pm
I'm trying to set up a 'canned' advanced search page to force users to choose from existing values within a specific attribute across a class. ie:
Class: Article Attributes: Title, Intro, Body
sample data:
Title: Dog
Intro: About a Dog Body: Body
Title: Cat
Intro: About a Cat Body: Body
Title: Dog
Intro: About a Cat Body: Body I want to create a search form that grabs the desired attributes (Title, Intro), places them into a select box, populates another select box existing attribute values (Dog, Cat for one, About a Dog, About a Cat for the other), and then implements the search on those selections. My code for the select boxes is: <select name="Content_search_attribute_fulltext_value[]">
<option value="dog">dog</option>
<option value="cat">cat</option>
</select>
<select name="Content_search_attribute_fulltext_classattribute_id[]">
<option value="163">Title</option>
<option value="165">Intro</option>
</select>
So, I need a fetch that will that will populate the select box with the values (dog, cat) of the attribute (Title, Intro) within the specific class (Article).
Edit: I _have_ spent a lot of time searching for the proper code, and what I have found has gotten me close,
{section loop=fetch( 'content', 'class_attribute_list', hash( 'class_id', 14 ) )}
{$:item.name|wash}
{/section}
{let class_attribute=fetch( 'content', 'class_attribute', hash( 'attribute_id', 163 ) )}
{$class_attribute.name|wash}
{/let}
The first of which gets me a list of the attributes from the class_id, and the second which gets me the name of the attribute from the attribute_id. There's 'object_by_attribute' as well, but I'm looking for something that fetches all values of an attribute. I'm beginning to question whether this is possible?!
|