I am following the book "https://www.packtpub.co m/":
https://www.packtpub.co m/web-development/cms-design-using-php-and-jquery
On chapter one the give simple CMS example.
I am not able to understand the line:
$r=Page::getIns tanceByName($pa ge);
From where the method "getInstanceByN ame" is called?
I could not find such a method in the official Php documentation:
http://php.net/manual-lookup.php?patt ern=getInstance ByName&scope=qu ickref
The example code also throws error on windows Apache, but i am not dealing with them now. Please find CMS files enclosed.
https://www.packtpub.co m/web-development/cms-design-using-php-and-jquery
On chapter one the give simple CMS example.
I am not able to understand the line:
$r=Page::getIns tanceByName($pa ge);
From where the method "getInstanceByN ame" is called?
I could not find such a method in the official Php documentation:
http://php.net/manual-lookup.php?patt ern=getInstance ByName&scope=qu ickref
Code:
<?php
// index.php
// { common variables and functions
include_once('ww.incs/common.php');
$page=isset($_REQUEST['page'])?$_REQUEST['page']:'';
$id=isset($_REQUEST['id'])?(int)$_REQUEST['id']:0;
// }
// { get current page id
if(!$id){
if($page){ // load by name
$r=Page::getInstanceByName($page);
if($r && isset($r->id))$id=$r->id;
}
if(!$id){ // else load by special
$special=1;
if(!$page){
$r=Page::getInstanceBySpecial($special);
if($r && isset($r->id))$id=$r->id;
}
}
}
The example code also throws error on windows Apache, but i am not dealing with them now. Please find CMS files enclosed.
Comment