Welcome Guest, Not a member yet? Register   Sign In
How to insert view into another view?
#7

(This post was last modified: 12-16-2015, 06:41 AM by webcomfort.)

I think, that you need simple helper, like this:
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* View in view
*
* @access   public
* @param    string
* @param    array
* @param    string
* @return   string
*/
if ( ! function_exists('view'))
{
 
   function view($view$params = array())
 
   {
 
       if(is_file(FCPATH.APPPATH.'views/'.$view.'.php'))
 
       {
 
           $CI =& get_instance();
 
           return $CI->load->view($view$paramstrue);
 
       }
 
   }


Load this helper or autoload it.  And call function from your view:
PHP Code:
<?php echo @view('my_view', array('param'=>'pam-pam')); ?>
Reply


Messages In This Thread
How to insert view into another view? - by Kostia - 12-10-2015, 01:27 AM
RE: How to insert view into another view? - by webcomfort - 12-15-2015, 02:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB