【问题标题】:How can i open thickbox in codeigniter如何在codeigniter中打开thickbox
【发布时间】:2011-10-15 11:04:35
【问题描述】:

我需要在控制器或模型内的 codeigniter 中打开厚盒。 如何在控制器或模型中写入。

结果将来自模型,所以我需要像这样在厚框中显示结果。请提出任何解决方案。

谢谢

【问题讨论】:

    标签: codeigniter thickbox


    【解决方案1】:

    控制器: if ( !defined('BASEPATH')) exit('不允许直接脚本访问');

    class Thickbox extends CI_Controller {
    
    
    
        public function __construct() {
    
    
    
            parent::__construct();
    
            $this->load->helper('url');
    
            //load ci url helper
    
        }
    
    
    
        public function index()
    
        {
    
            $this->load->view('thickbox_view');
    
            //load views 
    
        }
    
    }
    
    
    
    /* End of file thickbox.php */
    
    /* Location: ./application/controllers/thickbox.php */
    

    视图:

    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Untitled Document</title>
    
    <script type="text/javascript" src="js/jquery.js"></script>
    
    <script type="text/javascript" src="js/thickbox.js"></script>
    
    <style type="text/css" media="all">
    
    @import "css/thickbox.css";
    
    </style>
    
    </head>
    
    
    
    <body>
    
    <a href="/images/single.jpg" title="add a caption to title attribute / or leave blank" class="thickbox"><img src="/images/single_t.jpg" alt="Single Image"/></a>
    
    </body>
    
    </html>
    

    更多信息请访问:bugphp.com 或点击这里Implement ThickBox in Codeigniter

    【讨论】:

    • 感谢您的回答,但以上将仅打开查看页面,如果我们单击该页面中的图像,它将在厚框中打开知道..但我希望结果会在厚框中打开(无需点击)..
    【解决方案2】:

    您需要先学习和理解 MVC。
    您不能在模型或控制器中“打开”它,您应该在视图中执行此操作。
    在模型中加载数据,在控制器中分配数据,然后在视图中“回显”数据。

    但这真的很简单,与codeigniter无关(与普通php和/或html相同)。
    也许你可以向我们展示你的代码到目前为止你做了什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多