[eluser]123wesweat[/eluser]
@jbreitweiser, tx i will try to remember that load->view is kinda "include"
When i load-> view_book
Code:
if ($val->run() == FALSE) {
//show errors
$this->load->view('books/view_book');
//$this->load->view('forms/form_a');
} else {
i get the errors (amongst others)
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: metakeywords
Filename: incs/meta.php
Line Number: 3
" />
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: metadescription
Filename: incs/meta.php
Line Number: 4
" />
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: titletag
Filename: incs/meta.php
Line Number: 5
" />
These variables are set in main.php with function show_content();
Function show_content loads the meta, descr, content and VIEW file etc from the db and passed as an array so the vars can be used in the nested views in view_book.php
In view_book.php i got another load view
Code:
<!DOCTYPE html>
<html>
<head>
<?php
$this->load->view('incs/meta');
?>
</head>
<body>
This my simplied show_content function
Code:
function show_content($content_id = 1){
$this->load->helper(array('form','url'));
$this->load->library("form_validation");
$this->load->model('content/content_model','');
$options = array ('content_id' => $content_id);
$showContent = $this->content_model->get_content($options);
$this->data = array (
'titletag' => $showContent["content_title"],
'metadescription' => $showContent["metaDescr"],
'metakeywords' => $showContent["metaKeywords"],
'imgSRC' =>$showContent["imgSRC"],
'imgAlt' => $showContent['imgAlt'],
'imgTitle' => $showContent['imgTitle'],
'cssXtra' => $showContent['contentCategory'],
);
//view also from db
$this->load->view($showContent["content_tmpl"], $this->data);
}
and $showContent["content_tmpl"] = 'view_book'
Now i don't have the
Code:
$showContent = $this->content_model->get_content($options);
etc
in form.php, but i thought (like you said) load->view was an include and i wouldn't have to get the data from the db again????
Should i use ob_start() etc
Please, advice
oh btw, between all the errors and the ridiculous looking page i do see the error messages.