Preview.php
authorAlan Knowles <alan@roojs.com>
Tue, 12 Nov 2013 10:23:56 +0000 (18:23 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 12 Nov 2013 10:23:56 +0000 (18:23 +0800)
Preview.php

index 6837e3d..628b2a0 100644 (file)
@@ -42,7 +42,7 @@ class Pman_Cms_Preview extends Pman
      * $this->page= loadPage($name);
      */
     
-    function loadPage($name)
+    function loadPage($name, $default = false)
     {
         // used to load sub elements. of a site..
         if (preg_match('/\*$/', $name)) {
@@ -81,7 +81,35 @@ class Pman_Cms_Preview extends Pman
          
     }
       
-   
+    function assignMeta()
+    {   
+        foreach(func_get_args() as $argsItem){
+            if(!$argsItem)
+                continue;
+            
+            if(empty($this->title) && !empty($argsItem->title)){
+                $this->title = ' - ' . $argsItem->title;
+            }
+            if(empty($this->keywords) && !empty($argsItem->keywords)){
+                $this->keywords =   $argsItem->keywords;
+            }
+            if(empty($this->descriptions) && !empty($argsItem->descriptions)){
+                $this->descriptions =   $argsItem->descriptions;
+            }
+        }
+        $x = DB_DataObject::factory("cms_page");
+        $x->whereAdd("language = ''");
+        $x->get("page_link", "Home");
+        if(empty($this->title) && !empty($x->title)){
+            $this->title = ' - ' . $x->title;
+        }
+        if(empty($this->keyword) && !empty($x->keywords)){
+            $this->keywords = $x->keywords;
+        }
+        if(empty($this->descriptions) && !empty($x->descriptions)){
+            $this->descriptions = $x->descriptions;
+        }
+    }
     
     
     function herr( $error_name, $args = array(), $redirect=false )