Php, getInstanceByName

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gintare
    New Member
    • Mar 2007
    • 103

    Php, getInstanceByName

    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

    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.
    Attached Files
  • gintare
    New Member
    • Mar 2007
    • 103

    #2
    I am sorry. Seems i become tired. The method "getInstanceByN ame" exists in the class:
    C:\Bitnami\wamp stack-5.4.38-0\apache2\htdoc s\cms\ww.php_cl asses\Page.php

    Comment

    Working...