2013-05-03 37 views
0

對於我添加的一些標籤字段,我們添加了一些不保存數據的問題。我知道它與$ db數組有關,但是當我嘗試/ dev/build時,我無法在沒有錯誤的情況下正常工作。將銀色條紋頁面模板保存到數據庫問題

這是我的代碼片段。我正在嘗試添加5個HTMLEditorFields,如下所示。我對此很新,但是我遇到過的所有帖子都表明,我已經明白了嗎?

http://www.silverstripe.org/customising-the-cms/show/4496

http://www.silverstripe.org/customising-the-cms/show/9391

http://www.silverstripe.org/general-questions/show/9001

我想知道如果任何人都可以指出什麼我的問題可能是?

<?php 
class HomePage extends Page { 

    static $db = array(
     'contentBottom'  => 'HTMLText', 
     'centerTop'   => 'HTMLText', 
     'centerBottom'  => 'HTMLText', 
     'rightTop'   => 'HTMLText', 
     'rightBottom'  => 'HTMLText' 
    ); 


    function getCMSFields() { 
     $fields = parent::getCMSFields(); 

     // Content 
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('contentBottom')); 
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('centerTop')); 
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('centerBottom')); 
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('rightTop')); 
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('rightBottom')); 

     return $fields; 
    } 

} 

class HomePage_Controller extends Page_Controller { 

    public function init() { 
     parent::init(); 
    } 

} 

錯誤:

[Notice] Array to string conversion 
GET /<site_name>/dev/build 

Line 396 in F:\Programs\XAMPP\htdocs\<site_Name>\sapphire\core\model\Database.php 

Source 

387      $array_spec = $this->indexList[$table][$index_alt]['spec']; 
388     } else { 
389      $array_spec = $this->indexList[$table][$index_alt]; 
390     } 
391    } 
392   } 
393   
394   if($newTable || !isset($this->indexList[$table][$index_alt])) { 
395    $this->transCreateIndex($table, $index, $spec); 
396    $this->alterationMessage("Index $table.$index: created as $spec","created"); 
397   } else if($array_spec != DB::getConn()->convertIndexSpec($spec)) { 
398    $this->transAlterIndex($table, $index, $spec); 
399    $spec_msg=DB::getConn()->convertIndexSpec($spec); 
400    $this->alterationMessage("Index $table.$index: changed to $spec_msg <i style=\"color: #AAA\">(from {$array_spec})</i>","changed");   
401   } 
402  } 
+0

什麼開發/構建錯誤? – schellmax 2013-05-03 09:20:42

+0

@schellmax我已經將它添加到說明:) – Goose 2013-05-03 09:48:42

+0

猜你在使用php 5.4嗎?你可以嘗試降級到php 5.3,將silverstripe升級到3.0,或者禁用php警告 – schellmax 2013-05-03 10:11:59

回答

1

這裏曾作爲Schellmax建議,我已經安裝了XAMPP的早期版本的PHP 5.3和它的工作,因爲它現在應該問題......