0

ok I had view like this

<?php
foreach ($categories as $category)
{
    if (!$config->show_empty_cat && !count($category->events))
    {
        continue ;
    }
    ?>
    <div class="row-fluid jakis <?php echo $clearfixClass; ?>">
        <h3 class="eb-category-title">
            <a href="<?php echo JRoute::_(EventbookingHelperRoute::getCategoryRoute($category->id, $Itemid)); ?>" class="eb-category-title-link">
                <?php
                    echo $category->name;
                ?>
            </a>
        </h3>
        <?php
            if($category->description)
            {
            ?>
                <div class="<?php echo $clearfixClass; ?>"><?php echo $category->description;?></div>
            <?php
            }

            if (count($category->events))
            {
                $user = JFactory::getUser();
                $bootstrapHelper = EventbookingHelperBootstrap::getInstance();

                echo EventbookingHelperHtml::loadCommonLayout('common/events_table.php', array('items' => $category->events, 'config' => $config, 'Itemid' => $Itemid, 'nullDate' => JFactory::getDbo()->getNullDate(), 'ssl' => (int) $config->use_https, 'viewLevels' => $user->getAuthorisedViewLevels(), 'categoryId' => $category->id, 'bootstrapHelper' => $bootstrapHelper));
            }
        ?>
    </div>
<?php
}
?>

I try to add tab code but it always show all categories in first tab how to solve this?

1
  • Welcome to JSE, please take our tour while you wait for support. – mickmackusa Jan 5 at 1:07
0

Assuming your template is using bootstrap 2, and assuming you want horizontal tab panels, then the following untested rewrite may get you closer to what you are after?

<?php
$user = JFactory::getUser();
$bootstrapHelper = EventbookingHelperBootstrap::getInstance();
?>
<div class="tabbable">
  <ul class="nav nav-tabs">
    <?php
    $tab_count = 0;
    foreach ($categories as $category){
        if (!$config->show_empty_cat && !count($category->events)){continue;}

        $tab_count++;
        echo '<li';
        echo $tab_count == 1 ? 'class="active"' : '';
        echo '><a href="#tab' . $tab_count . '" data-toggle="tab">' . $category->name . '</a></li>';
    } ?>
  </ul>
  <div class="tab-content"><?php
    $tab_count = 0;
    foreach ($categories as $category){
        if (!$config->show_empty_cat && !count($category->events)){continue;}
    
        $tab_count++;
        echo '<div class="tab-pane';
        echo $tab_count == 1 ? ' active' : '';
        echo ' id="tab' . $tab_count . '">';

        echo !empty($category->description) ? '<div>' . $category->description . '</div>' : '';

        echo EventbookingHelperHtml::loadCommonLayout('common/events_table.php', array('items' => $category->events, 'config' => $config, 'Itemid' => $Itemid, 'nullDate' => JFactory::getDbo()->getNullDate(), 'ssl' => (int) $config->use_https, 'viewLevels' => $user->getAuthorisedViewLevels(), 'categoryId' => $category->id, 'bootstrapHelper' => $bootstrapHelper));
        }

        echo '<a href="' . JRoute::_(EventbookingHelperRoute::getCategoryRoute($category->id, $Itemid)) . '" class="btn btn-info">' . $category->name . '</a>';


        echo '</div>';
?>
  </div>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.