Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-01-29 21:07:50

slabanosa
Member
From: Belgium
Registered: 2004-06-01
Posts: 49
Website

filtering custom field duplicates in list query

hi,

not sure how I should tackle this and keep it simple.
For a film website I’m using a pseudo search/filtering page involving custom fields and categories.
RSS_UC for categories was a must and GLZ_CF is a no go since I’m using MLP translation pack.
Here’s what I’m doing so far: filtering films by genre or screening dates using categories and this works fine.
Filtering films by director or title using custom field, this also works fine as all value are unique and result in a single article/film page.
Now I also use custom fields for countries and this is where I stall: many different film articles have the same country value in their CF and this results in my dropdown list holding many country duplicates all of which relating to one single article. I’d need to remove duplicates and consolidate them in one single link and accommodate my landing page for either CF list of single articles
How should I consolidate that ?

here’s my dropmenu code

<h3>##By country##</h3>
<form action=""> <select onchange="document.location=options[selectedIndex].value;"> 
<option value="" selected="selected">Select</option> 
<txp:article_custom form="jump_country" limit="99" pgonly="0" section="programme" sort="custom_2 asc" status="4" /> 
</select> 
</form>

here’s my jump form code

<option value="<txp:permlink />"><txp:custom_field name="Country" /></option>

would obviously need to change that

and here is my landing page which would need accommodation for landing multiple multiple articles based on CF

<txp:if_individual_article>
 <txp:if_custom_field name="Movie_file" >
    <txp:output_form form="film_object" />
 </txp:if_custom_field>
<txp:if_custom_field name="Director" >
    <txp:article form="filmprog" /> 
  <txp:else />
    <txp:article status="sticky" form="inside_one" />
  </txp:if_custom_field>
<txp:else />
  <txp:if_category>
    <txp:rss_uc_article_list form="listfilms" sortby="title" />
  <txp:else />
    <txp:article limit="1" status="sticky" form="inside_one" sort="Posted desc"/>
  </txp:if_category>
</txp:if_individual_article>

any hint appreciated

{Edited to make @‘s into bc.. for having line breaks and indented code, as intended. -Uli}

Last edited by slabanosa (2012-01-29 22:13:02)

Offline

#2 2012-01-29 22:13:55

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,384
Website

Re: filtering custom field duplicates in list query

Hi Mickael, just a quick idea, I don’t have the time to test it. Maybe something like this:

<form method="get" action="">
   <select onchange="submit(this.form);" name="country">
      <option value="" selected="selected">Select</option>
      <txp:article_custom form="jump_country" limit="99" section="programme" sort="custom_2 asc" />
   </select>
</form>

And in the jump_country form:

<txp:if_different>
   <option value="<txp:custom_field name='Country' />"><txp:custom_field name="Country" /></option>
</txp:if_different>

Then use adi_gps for the output pages.

Note: watch the limit in article_custom, if_different will only display all countries once, but all articles will still be counted.
And again: not tested!

Last edited by Els (2012-01-29 22:14:38)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#3 2012-01-29 22:23:17

slabanosa
Member
From: Belgium
Registered: 2004-06-01
Posts: 49
Website

Re: filtering custom field duplicates in list query

thanks Els, had been looking into that direction instinctively but could not wrap my head around adi_gps, will try again in the morning, Mondays can sometimes bring unexpected discernment ;-)

Offline

Board footer

Powered by FluxBB