Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • pferrol Friend
    #144371

    In frontpage i need view all catgories for secction, i can select all by de usertool but i need this by default, is posible??

    Anonymous Moderator
    #321675

    Open modules/ja_news2/helper.php file, find following code:


    function loadCategories($sid) {
    $categories = array ();
    $catids = $this->getUserSetting ( $sid, 'categories' );

    $where = '';
    $limit = 0;
    if ($catids) {
    if (is_array ( $catids ))
    $where .= " AND `id` in (" . implode ( ',', $catids ) . ")";
    } else {
    if (is_array ( $this->getUserSetting ( $sid ) ))
    $where = " AND 0";
    else
    $limit = ( int ) $this->get ( 'cols', 2 );
    }

    $db = & JFactory::getDBO ();
    $query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where;
    $db->setQuery ( $query, 0, $limit );
    $rows = $db->loadObjectList ( 'id' );
    foreach ( $rows as $cid => $row ) {
    $obj = new stdclass ( );
    $obj->category = $row;
    $categories [] = $obj;
    }
    return $categories;
    }

    and change to:


    function loadCategories($sid) {
    $categories = array ();
    $catids = $this->getUserSetting ( $sid, 'categories' );

    $where = '';
    $limit = 0;
    if ($catids) {
    if (is_array ( $catids ))
    $where .= " AND `id` in (" . implode ( ',', $catids ) . ")";
    } else {
    if (is_array ( $this->getUserSetting ( $sid ) ))
    $where = " AND 0";
    else
    $limit = ( int ) $this->get ( 'cols', 2 );
    }

    $db = & JFactory::getDBO ();
    $query = "SELECT `id`, `title`, `description`, CASE WHEN CHAR_LENGTH(`alias`) THEN CONCAT_WS(":", `id`, `alias`) ELSE `id` END as `slug` FROM `#__categories` s WHERE published = 1 and section=" . ( int ) $sid . $where;
    $db->setQuery ( $query );
    $rows = $db->loadObjectList ( 'id' );
    foreach ( $rows as $cid => $row ) {
    $obj = new stdclass ( );
    $obj->category = $row;
    $categories [] = $obj;
    }
    return $categories;
    }

    idsfac Friend
    #323553

    Great that I can increase the number of categories showing under each ja_news2 section.

    Question: Can I choose to show all categories for only some sections or do I have to have the code change apply to all?

    i.e. – I want:

    SECTION 1
    category 1 category 2 category 3

    SECTION 2
    category 1 category 2 category 3
    category 4 category 5 category 6

    SECTION 3
    category 1 category 2 category 3

    Thanks.

    sjmorris Friend
    #323805

    I would love to do this as well. Thoughts?

    Anonymous Moderator
    #323941

    Hi sjmorris

    This module does not support your idea. I am sorry for not being of much help in the case.

    Fokstrot Friend
    #331436

    Very good. It works.

    nawdin Friend
    #350038

    Well this works. It shows all categories in a section by default. Thanks for that.

    Now I need another help, just little expansion of the code above, I think. 😀

    In my section I have the following categories.
    1,2,3,4,5,6,7,8,9

    I would like to only show my choice of categories for eg. 1,3,4,7,8 etc…
    How would this possible?

    I found another good solution here, but it doesn’t solve the way I want yet.
    http://www.joomlart.com/forums/topic/ja-news-2-multiple-rows/

    Thanks

    PS. I’m using JA News II 1.0.1

    Saguaros Moderator
    #350789

    ok, pls make done with my solution in there http://www.joomlart.com/forums/topic/ja-news-2-multiple-rows/

    2) and then you try to re-sort order of categories with your expeclty order . 1,3,4,7,8 etc…

    GOodluck

Viewing 8 posts - 1 through 8 (of 8 total)

This topic contains 8 replies, has 7 voices, and was last updated by  Saguaros 13 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum