ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Looing for Joomla Categories list module

(1/1)

fenixproductions:
Hi all, long time no see

I am making a web page based on Joomla for a friend and I wonder did anyone found a free extension which could solve my problem:

I need to have Categories list with all articles assigned to them from current section only. I was trying dozen of existing modules and none of them have the simplicity I need. After few hours of trying to make them work my way I have enough, but promised deadline is coming. I believe it shouldn't be hard to code but, recently, I don't have enough nerves for that :(

The only thing I'd like to see is something like this generated:

--- ---<ul clas="xxx">
<li>Category name</li>
<li>
     <ul>
           <li id="art-$id"><a href="">Article name</a></li>
           <li id="art-$id"><a href="">Article name</a></li>
     </ul>
</li>
<li>Second Category name</li>
<li>
     <ul>
           <li id="art-$id"><a href="">Article name</a></li>
     </ul>
</li>
</ul>

Will someone give a little help for forgotten member? I would really appreciate any effort.

Thank you in advance.

P.S. If such module could work with JoomFish without glitches it would be pretty awesome.

fenixproductions:
I will answer myself :)


--- Code: PHP ---<?php function getSection($iId){        $database = &JFactory::getDBO();        if(JRequest::getVar( 'view', 0) == "section")        {                return JRequest::getVar( 'id', 0);        }        else if(Jrequest::getVar( 'view', 0) == "category")        {                $sql = "SELECT section FROM #__categories WHERE id = $iId ";                $database->setQuery( $sql );                $row=$database->loadResult();                return $row;        }        else if(Jrequest::getVar('view', 0) == "article")        {                $temp=explode(":",JRequest::getVar('id',0));                $sql = "SELECT sectionid FROM #__content WHERE id = ".$temp[0];                $database->setQuery( $sql );                $row=$database->loadResult();                return $row;        }} $section_id=getSection(JRequest::getVar('id',0)); ?> <?php function getSectionCategories($iId){        if ($iId == NULL)        {                return NULL;        }                $database = &JFactory::getDBO();        $sql = 'SELECT id, title FROM #__categories WHERE section = ' .$iId;        $database->setQuery( $sql );        $row=$database->loadRowList();        return $row;} ?> <?php function getCategoryArticles($iId){        if ($iId == NULL)        {                return NULL;        }                $database = &JFactory::getDBO();        $sql = 'SELECT id, title FROM #__content WHERE catid = ' .$iId;        $database->setQuery( $sql );        $row=$database->loadRowList();        return $row;} ?> <?php$categories_array = getSectionCategories($section_id); echo '<div id="menubox-right">';echo '<div id="menubox-right-top"><span class="header">&nbsp;</span></div>';echo '<div id="menubox-right-middle">';echo '<ul class="menubox-right-categories">'; for ($i=0; $i < sizeof($categories_array); $i++){        if((Jrequest::getVar('view', 0) == "category") && (JRequest::getVar('id',0) == $categories_array[$i][0]))        {                echo '<li><a href="' .$categories_array[$i][0] .'" class="right-category-active">' .$categories_array[$i][1] .'</a></li>';        }        else        {                echo '<li><a href="' .$categories_array[$i][0] .'" class="right-category">' .$categories_array[$i][1] .'</a></li>';        }                $articles_array = getCategoryArticles($categories_array[$i][0]);                if (sizeof($articles_array) > 0)        {                echo '<ul class="menubox-right-articles">';                for ($j=0; $j < sizeof($articles_array); $j++)                {                        if((Jrequest::getVar('view', 0) == "article") && (JRequest::getVar('id',0) == $articles_array[$j][0]))                        {                                echo '<li>!<a href="' .$articles_array[$j][0] .'" class="right-article-active">' .$articles_array[$j][1] .'</a></li>';                        }                        else                        {                                echo '<li><a href="' .$articles_array[$j][0] .'" class="right-article">' .$articles_array[$j][1] .'</a></li>';                        }                }                echo '</ul>';        }} echo '</ul>';echo '</div>';echo '<div id="menubox-right-bottom">&nbsp;</div>';echo '</div>'; ?>
Of course, it's not all but now it is pretty easy to finish.

Navigation

[0] Message Index

Go to full version