output with a string containing the heading -- [PRIVATE] -- fetch_page_list() fetches a list of pages in this heirachy ++ populates $this->page_list [array] with an ordered array containing the page ids -- scribble_page_headings() creates a separated list of page headings for this title ++ returns the list as a properly formatted string -- scribble_site_description() scribbles the site description, if we're showing it ++ returns a string containing the site description -- scribble_site_heading() scribbles the site heading, if we're showing it ++ returns a string containing the site heading -- scribble_title($page,$n) scribbles the title of the page, depending on our settings -- $page is an asset object for the page on which we're working -- $n is this page's position in the page list ++ returns a properly formatted string containing the page title and a separator -- scribble_title_content($page) fetches the title of the content which this page is displaying, or the heading title if the content title cannot be found -- $page is an asset object for the page on which we're working ++ returns [string] the title we want */ class PageHeading extends scribbler{ //input properties protected $page; //internal properties protected $config, $page_list; //output properties public function __construct($page){ //put our data somewhere useful //if we're using an alternative title for this page // -- just use that //else // -- scribble the page headings part of the title // -- scribble the site heading // -- scribble the site description // -- add it all together //strip any slashes from the title //put the output somewhere useful $file=new rFile('headings.js','system_settings'); $this->config=$file->parse_ini(); $this->page=$page; if($this->page->get('use_alternative_title')==1) $str=$this->page->get('alternative_title'); else { $page_headings=$this->scribble_page_headings(); $site_heading_str=$this->scribble_site_heading(); $description_str=$this->scribble_site_description(); $str=sprintf('%s%s%s',$page_headings,$site_heading_str,$description_str); } $str=stripslashes($str); //HACK WARNING -- this is a hack, as they're not being stripped automatically when reading from a file $this->output['xhtml']=$str; } function fetch_page_list(){ //fetch the relations finder for this page //load the page's ancestors //add this page itself to the end of the list //populate the page list $relations=new PageRelations($this->page->get_id()); $pages=$relations->get_ancestors(); $pages[]=$this->page->get_id(); $this->page_list=$pages; } function scribble_page_headings(){ //if we're showing page headings // -- if we're cascading the headings // -- fetch the page list // -- set some useful variables // -- initiate a new asset creator // -- loop through the list of pages // -- create an asset for the current page // -- if it's valid and displayable // -- put the new title together and add it to our title string // -- increment our counter // -- else // -- make a dummy page list (so our inclusion rules still work) // -- scribble the title // //return the titles string $str=''; if($this->config['show_page_heading']) if($this->config['cascade_headings']) { $this->fetch_page_list(); $count=0; $c=new CreateAsset(); foreach($this->page_list as $page) { $p=$c->create($page); if($p && $p->check('displayable')) { $str.=$this->scribble_title($p,$count); $count++; } } } else { $this->page_list=array('dummy'); $str=$this->scribble_title($this->page,0); } return $str; } function scribble_site_description(){ //if we're showing the description // -- stick it to some dashes and add it in //else // -- make it a blank string //return the string if($this->config['show_site_description']) $description_str=' -- '.$this->config['site_description']; else $description_str=''; return $description_str; } function scribble_site_heading(){ //if we're showing the site heading // -- add it in //else // -- make it a blank string //return the string if($this->config['show_site_heading']) $site_heading_str=$this->config['site_heading']; else $site_heading_str=''; return $site_heading_str; } function scribble_title($page,$n){ //if this is a content display page // -- fetch the content's title //else // -- use our heading title //add the separator and title together to form a new title //switch based on our inclusion rule // -- if we're always adding the heading of this page // -- add it // -- if we're never adding it // -- do nothing // -- if we're only adding it when it's the last page // -- if this is the last page in the list // -- add it // -- if we're only adding it when it's the first page // -- if this is the first page in the list // -- add it // -- if we're only adding it when it's the only page // -- if the list only has one page // -- add it // -- if we can't find any option // -- create a blank string //return the title we've made if($page->get('for_content')) $title=$page->get('translated_title'); else $title=$page->get('heading_title'); $title=sprintf('%s %s ',$title,$this->config['site_heading_separator']); switch($page->get('include_page_heading')) { case 'always': $str=$title; break; case 'never': break; case 'when last page in list': if($n==(count($this->page_list)-1)) $str=$title; break; case 'when first page in list': if($n==0) $str=$title; break; case 'when only page in list': if(count($this->page_list)==1) $str=$title; break; default: $str=''; break; } return $str; } } ?> Fatal error: Class 'PageHeading' not found in /var/www/vhosts/happiness-by-design.com/httpdocs/renaissance/xtnls/front/_front_page.inc.php on line 716