473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Php, getInstanceByName

103 100+
I am following the book "https://www.packtpub.com/":
https://www.packtpub.com/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::getInstanceByName($page);

From where the method "getInstanceByName" is called?
I could not find such a method in the official Php documentation:
http://php.net/manual-lookup.php?pattern=getInstanceByName&scope=quickre f

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //  index.php
  3. // { common variables and functions
  4. include_once('ww.incs/common.php');
  5. $page=isset($_REQUEST['page'])?$_REQUEST['page']:'';
  6. $id=isset($_REQUEST['id'])?(int)$_REQUEST['id']:0;
  7.  
  8. // }
  9.  
  10. // { get current page id
  11. if(!$id){
  12.     if($page){ // load by name
  13.         $r=Page::getInstanceByName($page);
  14.         if($r && isset($r->id))$id=$r->id;
  15.     }
  16.     if(!$id){ // else load by special
  17.         $special=1;
  18.         if(!$page){
  19.             $r=Page::getInstanceBySpecial($special);
  20.             if($r && isset($r->id))$id=$r->id;
  21.         }
  22.     }
  23. }

The example code also throws error on windows Apache, but i am not dealing with them now. Please find CMS files enclosed.
Attached Files
File Type: zip cms.zip (4.8 KB, 45 views)
Oct 17 '15 #1
1 1230
gintare
103 100+
I am sorry. Seems i become tired. The method "getInstanceByName" exists in the class:
C:\Bitnami\wampstack-5.4.38-0\apache2\htdocs\cms\ww.php_classes\Page.php
Oct 17 '15 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.