Adding an Alphabetical Search Filter to a Directory or Membership List

Mar 9, 2011 4:25 pm

This tip lets you add a search layout to a directory or membership list to filter the list of items by the first letter of one of the fields. For example, in a business directory, you could click on the "D" link to show only the businesses that start with the letter "D".

To set up:

1. Create a new search layout for the directory or membership list.
2. In the Fields List field, enter the field you want to filter by. Usually name or a misc field.
3. In the Output Method drop-down, choose the Select-Search the first field only option.
4. Paste the supplied code below in the Item field.
5. For each letter link, change the "src=directory&view=business" to whatever the link you are using for the list view of the directory or membership list.
6. For each letter link, change the "misc1" to whatever field you entered in step 2.
7. Save the search and embed it in the list view of the directory/member list.

<p class="searchAlpha">
  <a href="index.php?src=directory&view=business&query=misc1.starts.A">A</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.B">B</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.C">C</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.D">D</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.E">E</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.F">F</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.G">G</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.H">H</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.I">I</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.J">J</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.K">K</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.L">L</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.M">M</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.N">N</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.O">O</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.P">P</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.Q">Q</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.R">R</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.S">S</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.T">T</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.U">U</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.V">V</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.W">W</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.X">X</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.Y">Y</a>
  <a href="index.php?src=directory&view=business&query=misc1.starts.Z">Z</a>
</p>