Hi Tester,
Try this:
File: the_controller.php
...
...
...
function what_ever() {
$data['the_heading'] = 'This is my header';
$count = 0;
$output_bit = "";
while($count < 10){
$count++;
$output_bit .= '<br />This value is from the_controller.php --> ' .$count ;
}
$data['string_from_controller'] = $output_bit;
$tmp_string = $this->load->view("my_template_bit", $data, TRUE); // check the help documention
ECHO $tmp_string ;
} // end function what_ever()
File: my_template_bit.php
<html>
<head>
<title><?=$the_heading?></title>
</head>
<body>
<h1><?=$the_heading?></h1>
<?=$string_from_controller?>
</body>
</html>
If the <?=$the_heading ?> does not work then try <?php ECHO $the_heading ?>
Cheers,
John_Betong
PS If English is not your first language then it is very good.
Hello,
I know that I can output a template with this code
$this->load->view(“header”);
but I want to use this function only for the final output, all other code shall be stored in variables e.g. in loops
in my_template_bit is some html-code and php-variables
is there any way to use such kind of option so that i do not have to write the html-code inside the loop ?
$output_bit shall be available inside my outputpage
$this->load->view(“my_outputpage”);
Sorry for my terrible english