how to menu item to individual sections?

Phoca Download - download manager
wolwes
Phoca Member
Phoca Member
Posts: 10
Joined: 29 Dec 2008, 13:51

Re: how to menu item to individual sections?

Post by wolwes »

Hallo,

Wie so oft findet man über einen komplizierten Weg plötzlich einen einfachen! Wir brauchen das Extrafeld "gid" gar nicht. Damit entfällt der Eingriff in MYSQL. Lediglich die Function muss ausgetauscht werden. Nur die vergebene "Gruppen ID" wird zum Gruppieren im Code benutzt.

Code: Select all

function _getSectionListQuery( $aid, $params ) {

                $display_sections = $params->get('display_sections', '');
                if ( $display_sections != '' ) {
                        $section_ids_where = " AND s.id IN (".$display_sections.")";
                } else {
                        $section_ids_where = '';
                }

                $hide_sections = $params->get('hide_sections', '');
                if ( $hide_sections != '' ) {
                        $section_ids_not_where = " AND s.id NOT IN (".$hide_sections.")";
                } else {
                        $section_ids_not_where = '';
                }

                 $GruppenID = $_GET["group"];

                $wheres[] = " s.published = 1";
                $wheres[] = " cc.published = 1";

               if ( $GruppenID != 0 ) {
                  $wheres[] = " s.id = $GruppenID";
                  $wheres[] = " cc.section = $GruppenID";
                  $Gruppieren=" GROUP BY $GruppenID";
               } else {
                  $wheres[] = " s.id = cc.section";
                  $Gruppieren=" GROUP BY s.id";
               }

                if ($aid !== null) {
                        $wheres[] = "s.access <= " . (int) $aid;
                }


                $query =  " SELECT s.id, s.title, s.alias, COUNT(cc.id) AS numcat, '' AS categories"
                                . " FROM #__phocadownload_sections AS s, #__phocadownload_categories AS cc"
                                . " WHERE " . implode( " AND ", $wheres )
                                . $section_ids_where
                                . $section_ids_not_where
                                . $Gruppieren
                                . " ORDER BY s.ordering";
                return $query;
        }
Grüße
Wolfgang
wolwes
Phoca Member
Phoca Member
Posts: 10
Joined: 29 Dec 2008, 13:51

Re: how to menu item to individual sections?

Post by wolwes »

Hallo,
Ich habe den Code noch einmal angepasst, weil ich festellen musste, dass nur 4 Menüpunkte wunschgemäß angezeigt wurden ( pro Menü eine Section). Ab dem 5. Menüpunkt klappte es nicht mehr! Da wurde nichts mehr angezeigt...

Mit dem jetzigen Code funktioniert es aber auch mit mit mehr als 4 Sections.

Alles andere bleibt wie in den anderen Beiträgen beschrieben: In MYSQL in genannter Tabelle die ID's der einzelnen Sections aufschreiben. Ändern bzw. Eintragen braucht man in MYSQL nichts mehr!

Menüpunkte zu den einzelnen Sektionen erstellen, Typ: externer Link, dann am Ende des jeweiligen Links anfügen: &group=X, wobei X die jeweilige ID aus der MySQL-Tabelle ist. 0 einsetzen, wenn man alle will (so, wie bisher)

Code: Select all

function _getSectionListQuery( $aid, $params ) {

                $display_sections = $params->get('display_sections', '');
                if ( $display_sections != '' ) {
                        $section_ids_where = " AND s.id IN (".$display_sections.")";
                } else {
                        $section_ids_where = '';
                }

                $hide_sections = $params->get('hide_sections', '');
                if ( $hide_sections != '' ) {
                        $section_ids_not_where = " AND s.id NOT IN (".$hide_sections.")";
                } else {
                        $section_ids_not_where = '';
                }

                $GruppenID = $_GET["group"];

                $wheres[] = " s.published = 1";
                $wheres[] = " cc.published = 1";

               if ( $GruppenID != 0 ) {
                  $wheres[] = " s.id = $GruppenID";
                  $wheres[] = " cc.section = $GruppenID";
               } else {
                  $wheres[] = " s.id = cc.section";
               }

                if ($aid !== null) {
                        $wheres[] = "s.access <= " . (int) $aid;
                }


                $query =  " SELECT s.id, s.title, s.alias, COUNT(cc.id) AS numcat, '' AS categories"
                                . " FROM #__phocadownload_sections AS s, #__phocadownload_categories AS cc"
                                . " WHERE " . implode( " AND ", $wheres )
                                . $section_ids_where
                                . $section_ids_not_where
                                . " GROUP BY s.id"
                                . " ORDER BY s.ordering";
                return $query;
        }
Ich bin sehr zufrieden mit diesem Modul. Arbeitet sehr schnell und sieht auch sehr ansprechend aus. Nochmals Vielen Dank.
Wolfgang
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48799
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: how to menu item to individual sections?

Post by Jan »

Ok, danke für die Information...

Jan
If you find Phoca extensions useful, please support the project
prhammer
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 09 Jan 2009, 01:31

Re: how to menu item to individual sections?

Post by prhammer »

While I was unable to follow much of this thread - it appears to offer a possible solution to those of us interested in having a menu item that links directly to the category listing. Is there any possibility that this will be incorporated into a new version in the near future?

Great component.

-Ron
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48799
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: how to menu item to individual sections?

Post by Jan »

Hi, yes I am working on it... it is very easy... but what is not easy is when user will enable SEF ... then you cannot use the back links because of Itemid (which is important becasue of settins) the next problem is creating links from modules, and from plugin (which I am working on it now) if SEF is enabled... if there is only one link, link to sections, it is only one Itemid there , so it is ok, because you can create links from everywhere (it is easy to get the Itemid from database, if it is only one)

Jan
If you find Phoca extensions useful, please support the project
Post Reply