PsyCh Posted February 16, 2017 Share Posted February 16, 2017 Hello everyone im new here and im very happy that i found smth good here (just a think). im trying to create alphabetic power search module for joomla my web test is this ->http://vps365826.ovh.net/index.php/africa as you can see the alhabetic line ( A B C D E G I K L M N R S T U Z ) as you see some words missing well thats cause i dont have articles with words ex (F) photo ex. ( http://prntscr.com/e9j9iu ) well i want to create it with all alphabetic words even if we dont have article with that word i've created with my friend that code <div class="ordered"> <ul> <?php $db = JFactory::getDBO(); $query = 'SELECT count(*) as nm, SUBSTR(title,1,1) as alpha FROM #__content WHERE catid = '.$catid.' GROUP BY SUBSTR(title,1,1)'; $db->setQuery($query); $mostIng = $db->loadObjectList(); foreach ($mostIng as $row) { echo '<li data-text="'.$row->alpha.'">'.$row->alpha.' '.'</li>'; } ?> </ul> </div> but i want it somethink like that <div class="ordered"> <ul> <li class="orderedLabel closed">Αναζήτηση αλφαβητικά ></li> <li>A</li> <li>B</li> <li>C</li> <li>D</li> <li>E</li> <li>F</li> <li>G</li> <li>H</li> <li>I</li> <li>J</li> <li>K</li> <li>L</li> <li>M</li> <li>N</li> <li>O</li> <li>P</li> <li>Q</li> <li>R</li> <li>S</li> <li>T</li> <li>U</li> <li>V</li> <li>W</li> <li>X</li> <li>Y</li> <li>Z</li> </ul> </div> well thanks for your time and sorry for my bad english im trying to learing btw thank you very much!!! Quote Link to comment https://forums.phpfreaks.com/topic/303206-hello-a-z-help/ Share on other sites More sharing options...
Solution Barand Posted February 16, 2017 Solution Share Posted February 16, 2017 try foreach (range('A','Z') as $alpha) { echo "<li data-text='$alpha'>$alpha</li>\n"; } 1 Quote Link to comment https://forums.phpfreaks.com/topic/303206-hello-a-z-help/#findComment-1542826 Share on other sites More sharing options...
PsyCh Posted February 16, 2017 Author Share Posted February 16, 2017 thank you !!! works perfect! Quote Link to comment https://forums.phpfreaks.com/topic/303206-hello-a-z-help/#findComment-1542828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.