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>
4

2 回答 2

2

你可以试试

<?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                       
}
?>
于 2014-05-21T02:45:49.547 回答
2

为滑块创建一个单独的视图作为slider.php。将以下代码放入其中

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

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

在加载主页时,加载此slider.php 也如下所示:

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

对于其他页面,不要加载视图slider.php。

干杯!!

于 2014-05-21T04:37:23.663 回答