0

I want to show a slider module on home page but hide it on rest of the site. Could anyone help me hide it. I am using HMVC in Codeigniter

<div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">

                        <?php
    echo Modules::run('slider');
    ?>
                        </div>
Robin
  • 465
  • 2
  • 7
  • 19

2 Answers2

2

You can try

<?php
if($this->router->fetch_class()=='home_controller_name'){
?>
    <div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">
        <?php
            echo Modules::run('slider');
        ?>
    </div>
    <?php                       
}
?>
user3470953
  • 11,025
  • 2
  • 17
  • 18
2

Create an seperate view for slider as slider.php. Put your following code into it

<div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">

                    <?php
echo Modules::run('slider');
?>
                    </div>

And while loading the Home page, Load this slider.php also like as follows :

$this->load->view("header.php");
$this->load->view("slider.php");
$this->load->view("home.php", $data);
$this->load->view("footer.php");

For other pages don't load the view slider.php.

Cheers!!

Girish Hosamani
  • 1,203
  • 12
  • 18