php - CakePHP warning and Notice after installation -


after installing cakephp successfully, on first time running, i'm getting these warnings @ bottom. how can fix this.

warning (2): missing argument 1 view::element(), called in /users/michaelanywar/sites/cakephp/app/view/layouts/default.ctp on line 61 , defined [core/cake/view/view.php, line 398]

notice (8): undefined variable: name [core/cake/view/view.php, line 416]

notice (8): undefined variable: name [core/cake/view/view.php, line 422]

notice (1024): element not found: elements/.ctp [core/cake/view/view.php, line 425]

my view/view.php lines 398 427 this:

    public function element($name, $data = array(), $options = array()) {     $file = $plugin = null;      if (isset($options['plugin'])) {         $name = inflector::camelize($options['plugin']) . '.' . $name;     }      if (!isset($options['callbacks'])) {         $options['callbacks'] = false;     }      if (isset($options['cache'])) {         $contents = $this->_elementcache($name, $data, $options);         if ($contents !== false) {             return $contents;         }     }      $file = $this->_getelementfilename($name);     if ($file) {         return $this->_renderelement($file, $data, $options);     }      if (empty($options['ignoremissing'])) {     list ($plugin, $name) = pluginsplit($name, true);         $name = str_replace('/', ds, $name);         $file = $plugin . 'elements' . ds . $name . $this->ext;         trigger_error(__d('cake_dev', 'element not found: %s', $file), e_user_notice);     } } 

if @ first warning/error message should clear issue is: "warning (2): missing argument 1 view::element()".

look on line 61 of default layout view template (/app/view/layouts/default.ctp). have call $this->element() isn't passing template name (hence cake looking "elements/.ctp").

make sure pass template name element() method or remove template. example, if want include template "view/elements/site_header.ctp":-

echo $this->element('site_header'); 

the template needs exist in 'view/elements' folder. don't need pass '.ctp' extension element() method, cake assumes this.

make sure you've read docs on elements.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -