Welcome Guest, Not a member yet? Register   Sign In
Database Based Views
#3

(04-05-2015, 03:35 PM)gadelat Wrote: Pass the HTML code saved in database to view as data. Quick example:

Controller:

PHP Code:
function index()
{
 
   $this->load->model('views');
 
   $view_data = array(
 
       'navigation' => $this->views->get_navigation(),
 
       'content' => $this->views->get_content(),
 
   );
 
   $this->load->view('main_view'$view_data);

Your main view:

PHP Code:
<?=$navigation?>
<hr>
<?=$content?>

Hey gadelat,

Thanks for the quick reply. The issue being that I also want to be able to put limited PHP, such as variables and the sort into the database to have them eval'd just like the $this->load->view('file.php', $data); would do. I am currently doing exactly what you stated, but this requires that the database be static and that's not going to do what I want.

Thanks,

Tyler
Reply


Messages In This Thread
Database Based Views - by mtylerb - 04-05-2015, 02:13 PM
RE: Database Based Views - by gadelat - 04-05-2015, 03:35 PM
RE: Database Based Views - by mtylerb - 04-05-2015, 03:45 PM
RE: Database Based Views - by gadelat - 04-05-2015, 11:58 PM
RE: Database Based Views - by mtylerb - 04-06-2015, 04:52 PM
RE: Database Based Views - by gadelat - 04-06-2015, 11:13 PM
RE: Database Based Views - by mtylerb - 04-07-2015, 05:47 PM
RE: Database Based Views - by gadelat - 04-08-2015, 12:06 AM
RE: Database Based Views - by mwhitney - 04-08-2015, 12:31 PM
RE: Database Based Views - by mtylerb - 04-08-2015, 04:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB