Подскажите модуль вывода категорий

Тема в разделе "Неразобранное", создана пользователем alxndr, 03.10.2007.

  1. Offline

    alxndr Недавно здесь

    Регистрация:
    03.02.2007
    Сообщения:
    5
    Симпатии:
    0
    Пол:
    Мужской
    Подскажите модуль вывода категорий. В Joomla 1.0.13 стандартный mod_sections делает то что нужно но выводит разделы.
    Очень нужен аналог, но чтобы выводил список категорий раздела.
     
  2.  
  3. Offline

    alxndr Недавно здесь

    Регистрация:
    03.02.2007
    Сообщения:
    5
    Симпатии:
    0
    Пол:
    Мужской
    Ответ: Подскажите модуль вывода категорий

    Вопрос снят по причине его решения, путем небольшой переработки mod_sections.php
     
  4. OlegM
    Offline

    OlegM Russian Joomla! Team Команда форума

    Регистрация:
    12.04.2007
    Сообщения:
    4 311
    Симпатии:
    375
    Пол:
    Мужской
    Ответ: Подскажите модуль вывода категорий

    alxndr, поделиться не желаешь? ;)
     
  5. GOoDm@n
    Offline

    GOoDm@n Недавно здесь

    Регистрация:
    30.05.2007
    Сообщения:
    17
    Симпатии:
    1
    Пол:
    Мужской
    Ответ: Подскажите модуль вывода категорий

    Здравствуйте!

    С Джумлой работаю недавно. Прпобовал своими силами изменить mod_sections.php что б вместо разделов выводились категории. Joomla! 1.0.12 RЕ + JaclPlus

    вот изначальный код

    Код (CODE):
    1. <?php
    2. /**
    3. * This file has been modified by Vincent Cheah, ByOS Technologies 2006-12-28 12:07
    4. * for integration with JACLPlus Component
    5. */
    6. /**
    7. * @version $Id: mod_sections.php 5970 2006-12-10 21:58:09Z friesengeist $
    8. * @package Joomla
    9. * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
    10. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
    11. * Joomla! is free software. This version may have been modified pursuant
    12. * to the GNU General Public License, and as distributed it includes or
    13. * is derivative of works licensed under the GNU General Public License or
    14. * other free or open source software licenses.
    15. * See COPYRIGHT.php for copyright notices and details.
    16. */
    17. global $mosConfig_offset;
    18.  
    19. /// no direct access
    20. defined( '_VALID_MOS' ) or die( 'Доступ запрещен' );
    21.  
    22. $count      = intval( $params->get( 'count', 20 ) );
    23. $access     = !$mainframe->getCfg( 'shownoauth' );
    24. $now        = _CURRENT_SERVER_TIME;
    25. $nullDate   = $database->getNullDate();
    26.  
    27. $query = "SELECT a.id AS id, a.title AS title, COUNT(b.id) as cnt"
    28. . "\n FROM #__sections as a"
    29. . "\n LEFT JOIN #__content as b ON a.id = b.catid"
    30. //. ( $access ? "\n AND b.access <= " . (int) $my->gid : '' )
    31. . ( $access ? "\n AND b.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    32. . "\n AND ( b.publish_up = " . $database->Quote( $nullDate ) . " OR b.publish_up <= " . $database->Quote( $now ) . " )"
    33. . "\n AND ( b.publish_down = " . $database->Quote( $nullDate ) . " OR b.publish_down >= " . $database->Quote( $now ) . " )"
    34. . "\n WHERE a.scope = 'content'"
    35. . "\n AND a.published = 1"
    36. //. ( $access ? "\n AND a.access <= " . (int) $my->gid : '' )
    37. . ( $access ? "\n AND a.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    38. . "\n GROUP BY a.id"
    39. . "\n HAVING COUNT( b.id ) > 0"
    40. . "\n ORDER BY a.ordering"
    41. ;
    42. $database->setQuery( $query, 0, $count );
    43. $rows = $database->loadObjectList();
    44.  
    45. if ( $rows ) {
    46.     // list of sectionids, used to find corresponding Itemids
    47.     for( $i=0, $n=count( $rows ); $i<$n; $i++ ) {
    48.         $sids[] = (int) $rows[$i]->id;
    49.     }
    50.     // add 0 to the list, to get the Itemid of a global blog section item as a fallback
    51.     $sids[] = 0;
    52.    
    53.     // get Itemids of sections
    54.     $query = "SELECT m.id AS Itemid, m.componentid AS sectionid"
    55.     . "\n FROM #__menu AS m"
    56.     . "\n WHERE ( m.type = 'content_section' OR m.type = 'content_blog_section' )"
    57.     . "\n AND m.published = 1"
    58.     //. ( $access ? "\n AND m.access <= " . (int) $my->gid : '' )
    59.     . ( $access ? "\n AND m.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    60.     . "\n AND ( m.componentid=" . implode( " OR m.componentid=", $sids ) . " )"
    61.     . "\n ORDER BY m.type DESC, m.id DESC"
    62.     ;
    63.     $database->setQuery( $query );
    64.     $itemids = $database->loadObjectList( 'sectionid' );
    65.     ?>
    66.     <ul>
    67.     <?php
    68.         foreach ($rows as $row) {
    69.             if (isset( $itemids[$row->id] )) {
    70.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogsection&id=". $row->id . "&Itemid=" . $itemids[$row->id]->Itemid );
    71.             } else if (isset( $itemids[0] )) {
    72.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogsection&id=". $row->id . "&Itemid=" . $itemids[0]->Itemid );
    73.             } else {
    74.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogsection&id=". $row->id );
    75.             }
    76.             ?>
    77.             <li>
    78.                 <a href="<?php echo $link;?>">
    79.                     <?php echo $row->title;?></a>
    80.             </li>
    81.             <?php
    82.         }
    83.         ?>
    84.     </ul>
    85.     <?php
    86. }
    87. ?>


    а вот что я пытался изменить

    Код (CODE):
    1. <?php
    2. /**
    3. * This file has been modified by Vincent Cheah, ByOS Technologies 2006-12-28 12:07
    4. * for integration with JACLPlus Component
    5. */
    6. /**
    7. * @version $Id: mod_sections.php 5970 2006-12-10 21:58:09Z friesengeist $
    8. * @package Joomla
    9. * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
    10. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
    11. * Joomla! is free software. This version may have been modified pursuant
    12. * to the GNU General Public License, and as distributed it includes or
    13. * is derivative of works licensed under the GNU General Public License or
    14. * other free or open source software licenses.
    15. * See COPYRIGHT.php for copyright notices and details.
    16. */
    17. global $mosConfig_offset;
    18.  
    19. /// no direct access
    20. defined( '_VALID_MOS' ) or die( 'Доступ запрещен' );
    21.  
    22. $count      = intval( $params->get( 'count', 20 ) );
    23. $access     = !$mainframe->getCfg( 'shownoauth' );
    24. $now        = _CURRENT_SERVER_TIME;
    25. $nullDate   = $database->getNullDate();
    26.  
    27. $query = "SELECT a.id AS id, a.title AS title, COUNT(b.id) as cnt"
    28. . "\n FROM #__categories as a"
    29. . "\n LEFT JOIN #__content as b ON a.id = b.catid"
    30. //. ( $access ? "\n AND b.access <= " . (int) $my->gid : '' )
    31. . ( $access ? "\n AND b.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    32. . "\n AND ( b.publish_up = " . $database->Quote( $nullDate ) . " OR b.publish_up <= " . $database->Quote( $now ) . " )"
    33. . "\n AND ( b.publish_down = " . $database->Quote( $nullDate ) . " OR b.publish_down >= " . $database->Quote( $now ) . " )"
    34. . "\n WHERE a.scope = 'content'"
    35. . "\n AND a.published = 1"
    36. //. ( $access ? "\n AND a.access <= " . (int) $my->gid : '' )
    37. . ( $access ? "\n AND a.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    38. . "\n GROUP BY a.id"
    39. . "\n HAVING COUNT( b.id ) > 0"
    40. . "\n ORDER BY a.ordering"
    41. ;
    42. $database->setQuery( $query, 0, $count );
    43. $rows = $database->loadObjectList();
    44.  
    45. if ( $rows ) {
    46.     // list of sectionids, used to find corresponding Itemids
    47.     for( $i=0, $n=count( $rows ); $i<$n; $i++ ) {
    48.         $sids[] = (int) $rows[$i]->id;
    49.     }
    50.     // add 0 to the list, to get the Itemid of a global blog section item as a fallback
    51.     $sids[] = 0;
    52.    
    53.     // get Itemids of sections
    54.     $query = "SELECT m.id AS Itemid, m.componentid AS catid"
    55.     . "\n FROM #__menu AS m"
    56.     . "\n WHERE ( m.type = 'content_category' OR m.type = 'content_blog_category' )"
    57.     . "\n AND m.published = 1"
    58.     //. ( $access ? "\n AND m.access <= " . (int) $my->gid : '' )
    59.     . ( $access ? "\n AND m.access " . ( isset($my->jaclplus) ? "IN ( $my->jaclplus )" : "<= " . (int) $my->gid ) : '' )
    60.     . "\n AND ( m.componentid=" . implode( " OR m.componentid=", $sids ) . " )"
    61.     . "\n ORDER BY m.type DESC, m.id DESC"
    62.     ;
    63.     $database->setQuery( $query );
    64.     $itemids = $database->loadObjectList( 'catid' );
    65.     ?>
    66.     <ul>
    67.     <?php
    68.         foreach ($rows as $row) {
    69.             if (isset( $itemids[$row->id] )) {
    70.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogcategory&id=". $row->id . "&Itemid=" . $itemids[$row->id]->Itemid );
    71.             } else if (isset( $itemids[0] )) {
    72.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogcategory&id=". $row->id . "&Itemid=" . $itemids[0]->Itemid );
    73.             } else {
    74.                 $link = sefRelToAbs( "index.php?option=com_content&task=blogcategory&id=". $row->id );
    75.             }
    76.             ?>
    77.             <li>
    78.                 <a href="<?php echo $link;?>">
    79.                     <?php echo $row->title;?></a>
    80.             </li>
    81.             <?php
    82.         }
    83.         ?>
    84.     </ul>
    85.     <?php
    86. }
    87. ?>


    Что не так делаю?
    Может ли это сделать мамбот CONTENT TEMPLATER?
     
    Последнее редактирование: 25.10.2007
  6. Offline

    agapoff.a Недавно здесь

    Регистрация:
    26.12.2007
    Сообщения:
    30
    Симпатии:
    0
    Ответ: Подскажите модуль вывода категорий

    выложите plz код этого модифицированного и наверняка рабочего mod_sections
     
  7. buro3v.ru
    Offline

    buro3v.ru Недавно здесь

    Регистрация:
    08.05.2008
    Сообщения:
    36
    Симпатии:
    3
    Пол:
    Мужской
    Долго искал, не нашел, пришлось самому написать - Модуль отображение категорий раздела.

    Вот что получилось, там и скачать можно. http://buro3v.ru/content/view/69/57/
     

Поделиться этой страницей

Загрузка...