Hey David,
I have an interactive selection script, which lists the alphabet and when a user clicks on a letter the categories beginning with this letter will slide down and be displayed. I'm using this to avoid a big long list of categories, as this way only the categories beginning with the letter the user wants to see are displayed and the rest are hidden.
Heres the layout code for the script:
<h2 class="canitberecycled">Compare products</h2>
<div id="accordion">
<h3 class="toggler atStart">LETTER A</h3>
<div class="element first atStart">
<ul>
<li><a href='".$item["href"]."'>".$item["name"]."</a></li>
</ul>
</div>
<h3 class="toggler atStart">LETTER B</h3>
<div class="element atStart">
<ul>
<li><a href='".$item["href"]."'>".$item["name"]."</a></li>
</ul>
</div>
Code repeated for letters C, D, E etc...
</div>
I've used this code to display the categories:
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."category/".tapestry_hyphenate($row["category"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=category:".urlencode($row["category"]).":";
}
print "<a href='".$href."'>".$row["category"]."</a><br />";
}
}
Could you help me integrate this code into my script? I have tried and have problems when it comes to categorising by letter. Thanks for your help! Steven
Cheers David, I thought it was pretty simple just didn't explain it very well the first time! Thanks for sorting that via email. Works beautifully.
For others who might be interested. This is a javascript menu and is a great way to display your categories in an attractive list, split up into the letters of the alphabet. Each category is hidden behind it's letter, and when you click a letter the categories scroll down. For sites that have many many categories this avoids have an incredibly long dull list.
Heres an example of a similar one im using, http://www.stickmanlabs.com/accordion/. I have changed the design entirely to match my site and is much narrower, as I am displaying the categories in a side section. But you get the idea.
david and steve,
this seems to be a nice mod for very long list categories, david, is it possible to hav a copy of the full version working copy via email?
thanks in advance as always.
regards,
atman
Hi all
Could I also request to see how this was implemented?
Thanks
Mally
Hello Steven,
I'm not totally sure from the above where you want to incorporate this etc.; or exactly what it is supposed to do...could you perhaps drop me an email with more details and any files you have tried to modify attached and I'll take a look...
Cheers,
David.