codeigniter可以在弹出窗口中显示数据时停止加载页眉页脚

时间:2015-09-04 19:12:17

标签: php codeigniter

我在弹出窗口中显示一些数据,但我不想在那里使用页眉和页脚如何在代码点火器中实现这一点

注意:我不想通过jQuery或CSS隐藏它们

这是我的控制器功能,用于显示数据

function singleBookmarksView()
    {
            $web_url = $this->uri->segment(2);

            $url_split_Array = explode('-', $web_url);

            $web_id = $url_split_Array['0'];

            //print_r($url_split_Array);

            $data['singleBookmark'] = $this->bookmark_model->getSingleBookmark($web_id);
            $data['bookmarkLabels'] = $this->getBookmarkLabel();
            $this->load->view("header_view.php");
            $this->load->view("bookmark_view.php", $data);
            $this->load->view("footer_view.php");

    }

由于

1 个答案:

答案 0 :(得分:1)

要做到这一点,你可以

//with this method add an extra value to the URI and it 
//will show without the header and footer
function singleBookmarksView($popup = null)
{
        $web_url = $this->uri->segment(2);

        $url_split_Array = explode('-', $web_url);

        $web_id = $url_split_Array['0'];

        $data['singleBookmark'] = $this->bookmark_model->getSingleBookmark($web_id);
        $data['bookmarkLabels'] = $this->getBookmarkLabel();
        if (!$popup) {
            $this->load->view("header_view.php");
        }
        $this->load->view("bookmark_view.php", $data);
        if (!$popup) {
            $this->load->view("footer_view.php");
        }

}

    import React, {Component} from 'react';
    import lodash from 'lodash';

    var TreeRootSty = {lineHeight: '120%'}
    var liSty = {listStyleType: 'none'};
    var ulSty = {height: 'inherit', WebkitPaddingStart: '16px'};
    var ulStyle = {height: 'inherit', WebkitPaddingStart: '16px'};
    var iconSty = {marginRight: '10px', width: '16px'};
    var titleSty = {color: '#afac87', marginTop: '2px'};

    var nottogglable = {
        color: '#FFF',
        cursor: 'pointer',
        margin: '0 0 0 .8em'
    };

    var togglable = {
        color: '#815C7C',
        cursor: 'pointer',
        margin: '0'
    };

    var options = {};

    var getTreeNode = function(child, index) {
        return <li key={index} style={liSty}><JTreeViewNode node={child} iconClick={this.props.iconClick} titleClick={this.props.titleClick} /></li>;
    };

    class JTreeViewNodeRender extends Component {
        binder(...methods) { methods.forEach( (method) => this[method] = this[method].bind(this) ); }

        render() {
            var childNodes;
            var pSty = nottogglable;
            if (lodash.has(this.props.node, 'children') && this.props.node.children.length > 0) {
                childNodes = this.props.node.children.map(getTreeNode, this);

                titleSty.color = this.props.node.selected ? '#7BB53B' : '#AF90A5';
            } else {
                titleSty.color = this.props.node.selected ? '#b58900' : '#afac87';
            }

            var isClosed = true;
            if (lodash.has(this.props.node, 'closed')) isClosed = this.props.node.closed;
            ulStyle.display = isClosed ? 'none' : 'inline-block';
            var props = this.props;
            var iconType = lodash.get(props, options.typeName);
            if (iconType == options.icon.sun) iconSty.background = "url('./img/sun.ico') 0/16px no-repeat !important";
            else if (iconType == options.icon.leaf) iconSty.background = "url('./img/leaf.ico') 0/16px no-repeat !important";
            else if (iconType == options.icon.snow) iconSty.background = "url('./img/snow.ico') 0/16px no-repeat !important";
            else iconSty.background = "url('./img/sun.ico') 0/16px no-repeat !important";

            return (
                <div id='TreeNode'>
                    <div id='pSty' style={pSty} className='FlexBox'>
                        <div id='iconSty' onClick={this.iconHandler} style={iconSty}>&nbsp;</div>
                        <div id='titleSty' onClick={this.clickHandler} style={titleSty} >{this.props.node.title}</div>
                    </div>
                    <ul id='ulStyle' style={ulStyle}>
                        {childNodes}
                    </ul>
                </div>
            );
        }
    }

    class JTreeViewNode extends JTreeViewNodeRender {
        constructor() { 
            super();
            this.binder('clickHandler', 'iconHandler');
        }
        iconHandler() { 
            if (lodash.has(this.props.node, 'children') && this.props.node.children.length > 0) {
                this.props.iconClick(this.props.node); 
            } else {
                this.clickHandler();
            }
        }
        clickHandler() { this.props.titleClick(this.props.node); }
    }

    class JTreeViewRender extends Component {
        render() {
            options = this.props.options;
            var childNodes = this.props.data.map(getTreeNode, this);
            return (
                <div id='TreeRootSty' style={TreeRootSty}>
                    <ul id='ulSty' style={ulSty}>
                            {childNodes}
                    </ul>
                </div>
            );
        }
    }

    export default class JTreeView extends JTreeViewRender {}