SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 222 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"

As it is coming
via Singleton, all variables set to it are still in scope. Dispatcher then passes the view
template file, variables to a function named _loadTemplate in base.
So what is the purpose of $uselayout? It just indicates whether a layout file should
be appended to our template. This is more fun when we see it in practice.
Here is the base::_loadTemplate() function:
public static function _loadTemplate($controller, $template,
$vars, $uselayout=false)
{
extract($vars);
if ($uselayout)
ob_start();
$templatefile ="app/views/{$controller}/{$template}.php";
if (file_exists($templatefile)){
include_once($templatefile);
}
else
{
throw new Exception("View '{$template}.php' is not found in
views/{$controller} directory.");
}
if ($uselayout) {
$layoutdata = ob_get_clean();
$layoutfilelocal = "app/views/{$controller}/{$controller}.php";
$layoutfileglobal = "app/views/layouts/{$controller}.php";
if (file_exists($layoutfilelocal))
include_once($layoutfilelocal);
else
include_once($layoutfileglobal);
}
}
Building Better with MVC
[ 220 ]
If you are confused about placing these files, here is the directory structure to help
you understand:
Why are there other files like jsm.


Pages:
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6