appendPage() public method

The page can be added to the end of the hierarchy or as a subpage to any existing page.
public appendPage ( $page )
示例#1
0
 /**
  * Saves the object to the disk.
  */
 public function save()
 {
     $isNewFile = !strlen($this->fileName);
     /*
      * Generate a file name basing on the URL
      */
     if ($isNewFile) {
         $dir = rtrim(static::getFilePath($this->theme, ''), '/');
         $fileName = trim(str_replace('/', '-', $this->getViewBag()->property('url')), '-');
         if (strlen($fileName) > 200) {
             $fileName = substr($fileName, 0, 200);
         }
         if (!strlen($fileName)) {
             $fileName = 'index';
         }
         $curName = trim($fileName) . '.htm';
         $counter = 2;
         while (File::exists($dir . '/' . $curName)) {
             $curName = $fileName . '-' . $counter . '.htm';
             $counter++;
         }
         $this->fileName = $curName;
     }
     parent::save();
     if ($isNewFile) {
         $pageList = new PageList($this->theme);
         $pageList->appendPage($this);
     }
 }
示例#2
0
 /**
  * Adds this page to the meta index.
  */
 protected function appendToMeta()
 {
     $pageList = new PageList($this->theme);
     $pageList->appendPage($this);
 }