- Posts: 8
COMMUNITY FORUM
index items, alphabet letter links to items
- Sue
-
Topic Author
- Offline
- New Member
Less
More
12 years 10 months ago #66699
by Sue
index items, alphabet letter links to items was created by Sue
I would like to have an index of my K2 items where the alphabet is listed across the top of the module/page and all of my items are listed below it. Then, if a viewer clicks on a letter, it brings them to the spot in the list that begins with that letter.
Any help or suggestions would be very much appreciated!
Thanks
Any help or suggestions would be very much appreciated!
Thanks
Please Log in or Create an account to join the conversation.
- Ryan
-
- Offline
- New Member
Less
More
- Posts: 8
12 years 10 months ago #66700
by Ryan
Replied by Ryan on topic Re: index items, alphabet letter links to items
I second this. The ability to create an Alpha index would create many benefits (Zoo does this). That way you can create a proper directory style category system, similar to Mosets Tree and Zoo.
Ie:
Filter: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Main promotion Block
Categories...
I am researching CCK's at the moment and which one to choose, so hopefully there is a way to achieve this from K2, as i'm loving the system.
Ie:
Filter: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Main promotion Block
Categories...
I am researching CCK's at the moment and which one to choose, so hopefully there is a way to achieve this from K2, as i'm loving the system.
Please Log in or Create an account to join the conversation.
- Ryan
-
- Offline
- New Member
Less
More
- Posts: 8
12 years 10 months ago #66701
by Ryan
Replied by Ryan on topic Re: index items, alphabet letter links to items
here's some test code, it is not smart, but i just wanted to print out all links alphabetical from all items in the database.
You'd need to be able to refine the category, and link to a new list view which would be articles, with pagination.
I may need to send this to odesk or similar, unless someone can make a simple plugin for the community.
heres some test code if anyone wants to print out results
yes yes yes, i know this is not how you create plugins/modules, nor use the MVC, so i put this into components/com_ks/templates/default/item.php just to view.
You'd need to be able to refine the category, and link to a new list view which would be articles, with pagination.
I may need to send this to odesk or similar, unless someone can make a simple plugin for the community.
heres some test code if anyone wants to print out results
<?php
$hostname = "localhost";
$database = "adddbname";
$username = "adddbusername";
$password = "addpassword";
$connection1 = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
$table = "oanfc_k2_items";
//Data Extraction
mysql_select_db($database, $connection1);
$query = "SELECT DISTINCT UPPER(LEFT(title,1)) as letters FROM $table ORDER BY letters";
if ($result = mysql_query($query)) {
while ($row = mysql_fetch_array($result)) {
$letter_string .= $row["letters"];
}
}
$letter_array = range('A','Z');
foreach ($letter_array as $letter) {
if (stristr($letter_string, $letter) === FALSE) echo $letter . " | ";
else echo '<a href="index.php?option=com_k2&view=itemlist&layout=category<r="'.$letter.'" rel="nofollow">"'.$letter.'"</a> | ';
}
; ?>
yes yes yes, i know this is not how you create plugins/modules, nor use the MVC, so i put this into components/com_ks/templates/default/item.php just to view.
Please Log in or Create an account to join the conversation.