test
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • jooservices Friend
    #167568

    Ref this source post: http://www.joomlart.com/forums/topic/k2-category-in-ja_bulletin/
    I’ve patched this module to allow
    – display K2 Categories
    – link to K2 Categories

    Unzip

    default.php will need copy to mod tmpl folder ( or override tmpl folder )
    helper.php will need copy to module folder

    Thank you
    Viet Vu


    1. mod_jabulletin.zip
    mpiper Friend
    #406994

    I have replace the files. The k2 categories shows normaly but with no link.

    jooservices Friend
    #406996

    Hi there,
    Please make sure default.php copied into template override if you have.
    With Teline IV it would be:

    templates/ja_teline_iv/html/mod_jabulletin
    I’ve added code like this


    <?php
    if ( isset($item->categoryname)) {
    echo '<a href="'. $item->categorylink.'">'.$item->categoryname.'</a>';
    }

    ?>

    In helper.php i’ve added code like this


    if ($using_mode == "com_k2") {
    $lists [$i]->link = urldecode ( JRoute::_ ( K2HelperRoute::getItemRoute ( $row->id . ':' . urlencode ( $row->alias ), $row->catid . ':' . urlencode ( $row->categoryalias ) ) ) );
    require_once (JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php');
    require_once (JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'utilities.php');
    $categoryLink = urldecode ( JRoute::_ ( K2HelperRoute::getCategoryRoute ( $row->catid . ':' . urlencode ( $row->categoryalias ) ) ) );
    $lists [$i]->categoryname = isset ( $row->categoryname ) ? $row->categoryname : "";
    $lists [$i]->categorylink = $categoryLink;
    } else {

    It should work with this 🙂
    Thank you
    Viet Vu

    mpiper Friend
    #407025

    OK i was place default.php in wrong place. everything its ok now. i think the next release of ja_bulletin it must have this option in backend.

    jooservices Friend
    #407027

    Hi
    I’ve forwarded this suggestion to developer team 🙂
    Thank you
    Viet Vu

    mpiper Friend
    #407544

    Hello again

    Two questions.

    (a) Now the code above displays k2 subcatecory. If i want to display the root k2 categorys what i have to do ?

    ex.

    Football (root catecory) – this i want to display
    – Subcategory 1
    – Subcategory 2
    – Subcategory 2

    Voley (root catecory) — this i want to display
    – Subcategory 1
    – Subcategory 2
    – Subcategory 2

    (b) How can the format of k2 catecory is the same with the date in the left. small font and grey ?

    jooservices Friend
    #407546

    Hi there,
    Allow me a day to patch this function and update to you.
    Thank you
    Viet Vu

    mpiper Friend
    #407547

    ok i will wait.

    jooservices Friend
    #407784

    Hi there,
    This’s another patch allow display K2 Category as pathway.
    In helper.php i’ve added these codes:


    $lists [$i]->k2Pathway = $this->getK2Pathway ( $row->catid, true );

    and function

    function getK2Pathway($cid, $reset = false) {
    static $pathWay;
    if ($reset)
    $pathWay = array ();
    $db = & JFactory::getDBO ();

    $query = ' SELECT * FROM #__k2_categories WHERE id = ' . ( int ) $cid;
    $db->setQuery ( $query );
    $result = $db->loadObject ();
    $result->link = urldecode ( JRoute::_ ( K2HelperRoute::getCategoryRoute ( $result->id . ':' . urlencode ( $result->alias ) ) ) );
    $pathWay [] = $result;

    if ($result->parent > 0)
    $this->getK2Pathway ( $result->parent );
    return $pathWay;
    }

    and in template.php


    <?php
    if (isset ( $item->k2Pathway )) {
    $pathWays = array_reverse ( $item->k2Pathway );

    $index = 0;
    foreach ( $pathWays as $pathWay ) {
    $html = '<a class="joopathway" href="' . $pathWay->link . '">' . $pathWay->name . '</a>';
    if ( $index == 0 ) {
    $html = '<strong>' . $html . '</strong>';
    }
    if ( $index < count($pathWays)-1 )
    $html .= ' - ';
    echo $html;
    $index ++;
    }
    }
    ?>

    Please note this patch will override above patched by using pathway instead a category.

    Note: for stylesheet i’ve added classname .joopathway.
    If you need use it, please add
    .joopathway {}
    and update with your own css.
    Thank you
    Viet Vu


    1. default.zip
    mpiper Friend
    #407803

    Please tell me the exact directory where each file must be placed.

    OK everything its ok. thanks a lot. i believe in next version of ja_bulletin all this will included in the backend.

    jooservices Friend
    #407832

    Hi,
    I’ll foward this patch to dev for take look 🙂
    Thank you
    Viet Vu

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

This topic contains 11 replies, has 2 voices, and was last updated by  jooservices 13 years, 4 months ago.

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