Jump to content
PsyCh

Hello A-Z Help

Recommended Posts

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!!!

Share this post


Link to post
Share on other sites

try

foreach (range('A','Z') as $alpha) {
    echo "<li data-text='$alpha'>$alpha</li>\n";
}

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.