Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • wombat1 Friend
    #152138

    i was wondering why the user settings allow certain configurations unavailable to the administrator.
    For example in one section i wish to use show 6 categories default however the default is 3 and cannot be changed by admin must be changed by user.

    Any possibility to edit specific sections in JA News from the back end so that it will display 6 or 9 categories instead of 3.

    Thank you

    Sherlock Friend
    #348599

    <em>@wombat1 184486 wrote:</em><blockquote>i was wondering why the user settings allow certain configurations unavailable to the administrator.
    For example in one section i wish to use show 6 categories default however the default is 3 and cannot be changed by admin must be changed by user.

    Any possibility to edit specific sections in JA News from the back end so that it will display 6 or 9 categories instead of 3.

    Thank you</blockquote>

    Dear wombat1,

    Did you want to set the number of categories display per section on the back-end of the ja news2 moudle ?

    If that please kindly try as follows steps

    Step 1 ) Adding the categories number field on the ja news2’s back-end
    Go to modules/mod_janews2/mod_janews2.xml file ,Look for this xml tag
    <param name=”cols” type=”text” default=”2″ label=”COLUMNS” description=”HOW MANY COLUMNS PER ROW (SET TO ZERO IF YOU WANT TO DISABLE OTHER NEWS ITEMS)” />
    add below it this tag
    <param name=”catnumber” type=”text” default=”3″ label=”CATEGORIES NUMBER” description=”HOW MANY CATEGORIES DISPLAY PER SECTION” />

    also open language/en-GB/en-GB.mod_janews2.ini adding at it’s bottom these lines
    CATEGORIES NUMBER=Categories Number
    HOW MANY CATEGORIES DISPLAY PER SECTION=How many categories display per section

    Step 1 ) Changing the logic code
    Go to modules/mod_janews2/helper.php file and Look for this function
    [PHP]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 .’ ORDER BY s.ordering’;
    $db->setQuery ( $query, 0, $limit );
    $rows = $db->loadObjectList ( ‘id’ );
    foreach ( $rows as $cid => $row ) {
    $obj = new stdclass ( );
    $obj->category = $row;
    $categories [] = $obj;
    }
    return $categories;
    }[/PHP]

    Replace to

    [PHP]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 if ($this->get ( ‘catnumber’, 3 )) { $limit = ( int ) $this->get ( ‘catnumber’, 2 ); }
    else {
    $limit = ( int ) $this->get ( ‘cols’, 2 );
    }
    }
    //echo $this->get ( ‘catnumber’, 2 );die();
    $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 .’ ORDER BY s.ordering’;
    $db->setQuery ( $query, 0, $limit );
    $rows = $db->loadObjectList ( ‘id’ );
    foreach ( $rows as $cid => $row ) {
    $obj = new stdclass ( );
    $obj->category = $row;
    $categories [] = $obj;
    }
    return $categories;
    }[/PHP]

    Now you can go to the ja news2’s back-end and set the number of categories display as you want

    I hope these will help !

    wombat1 Friend
    #348740

    Thank you very much, this worked, it does set all sections to have the same number but this is all i needed.

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

This topic contains 3 replies, has 2 voices, and was last updated by  wombat1 14 years, 5 months ago.

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