zakupłem ksiązke helionu Projektowanie systemów cms... itd.
I mam problem ponieważ kod do wyświetlania działa lecz nie widze treści z bazy mysql po mimo tego, że funkcje szukania działają.
Proszę o jakąś radę.
Pozdrawiam.
plik index.php
<?php // { common variables and functions include_once('ww.incs/common.php'); // { get current page id if(!$id){ if($page){ // load by name $r=Page::getInstanceByName($page); } if(!$id){ // else load by special $special=1; if(!$page){ $r=Page::getInstanceBySpecial($special); } } } // { load page data if($id){ } else{ exit; }
plik basics.php
<?php function __autoload($name) { require $name . '.php'; } function dbInit(){ $db=new PDO('mysql:host='.$DBVARS['hostname'].';dbname='.$DBVARS['db_name'],$DBVARS['username'],$DBVARS['password']); $db->query('SET NAMES utf8'); $db->num_queries=0; $GLOBALS['db']=$db; return $db; } function dbQuery($query){ $db=dbInit(); $q=$db->query($query); $db->num_queries++; return $q; } function dbRow($query) { $q = dbQuery($query); return $q->fetch(PDO::FETCH_ASSOC); } require SCRIPTBASE . '.private/config.php';
plik Page.php
<?php class Page{ function __construct($v,$byField=0,$fromRow=0,$pvq=0){ # byField: 0=ID; 1=Name; 3=special } else if ($byField == 1){ // by name } $fname='page_by_special_'.$v; $r=dbRow("select * from pages where special&$v limit 1"); } else return false; foreach ($r as $k=>$v) $this->{$k}=$v; $this->urlname=$r['name']; $this->dbVals=$r; self::$instances[$this->id] =& $this; self::$instancesBySpecial[$this->special] =& $this; if(!$this->vars)$this->vars='{}'; $this->vars=json_decode($this->vars); } function getInstance($id=0,$fromRow=false,$pvq=false){ return self::$instances[$id]; } function getInstanceByName($name=''){ self::$instancesByName[$nameIndex]=new Page($name,1); return self::$instancesByName[$nameIndex]; } function getInstanceBySpecial($sp=0){ return $instancesBySpecial[$sp]; }