Search code examples
phpcakephpviewrequire-once

how use require_one views in cakephp


i am beginner in cakephp and i want use file with percalname.php in my view.
this file have this path :
app\webroot\files\percalname.php
and i write this code in my view (this code is in line 17)

require_once $this->webroot.'../files/percalname.php';

but i face this message :

require_once(/cake/../files/percalname.php) [function.require-once]: failed to open stream: No such file or directory [APP\views\orders\add.ctp, line 17]


Solution

  • you can use vondor .
    first you should copy file to vendor folder and use app::import() like this link. vendor example in cakephp.org

    good luck.