[ic] Results.html help

Caleb Phillips interchange-users@icdevgroup.org
Sat Apr 5 19:27:00 2003


> Hello all, please help this is killing me. In the results.html file there is the following code within the [search-list] tags:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [item-change 1][condition][item-field category][/condition]
> 
> <tr class="contentbar1"> 
>   <td colspan="6">&nbsp;[either][value banner_text][or][item-field category][/either]</td>
> </tr>
> 
> [/item-change 1]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> I want to be able to replace the word next to 'item-field' in this case 'category' with a variable that stores the item-field that the user selected from the list displayed in category_vertical. I am able to store the selection to a variable but don't know how to place the variable next to 
> 'item-field' so it works (i.e. [item-field [scratch usr_selection]] )
> Another approach I was going to take was to make a different results page for all possible item-fields but when I do that the category_vertical search results display garbage.
> Thanks for any help...Bill

Like this?

<td colspan="6">&nbsp;[either][value banner_text][or][scratch
usr_selection][/either]</td>

Realize that the either/or struct works something like:

($banner_text)?print banner_text:print usr_selection;

Or...

if(!$banner_text){ print $usr_selection; }
else{ print $banner_text; }

So...the right hand side of the tag can be whatever alternative you
want. Also, realize that the item-field tag returns the value in the
database for the current item, under the field specified in the
argument. So, another alternative would be to create a column in your
database called, say usr_selection...then you would be able to:

[item-field usr_selection]

if you do this:

[item-field [scratch usr_selection]]

you are trying to print the value of a column in the inventory table
named what is stored in $Scratch->usr_selection...this is probably not
what you want.

It seems to me, that the problem you are trying to solve, is creating a
layer of naming abstraction between the category name, and what is
aesthetic to the user. For example, you may call your category 'clothes'
but the specific item may be under a 'link' called 'T-Shirts'. Perhaps I
am way off and have misunderstood your question, but doing something on
the DB side seems most logical.

Good Luck.

-- 
-------------------------------------------
| Caleb Phillips                          |
| The Studio Resource                     |
| IT Specialist                           |
|                                         |
| Handcrafted for you in Ximian Evolution |
-------------------------------------------