1

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]

aya
  • 1,597
  • 4
  • 29
  • 59
  • Is that a valid path? Do you actually have a /files top-level directory on your system? I think you'll find your solution if you carefully consider that `$this->webroot` is set to `/cake/`, and then work your way from there. Is there a different variable you have access to which statically points to app\webroot ? – Chris Trahey Aug 27 '12 at 06:56
  • 1
    The function [realpath()](http://php.net/manual/en/function.realpath.php) can be useful debugging things like this. Just do a die(realpath($path)); and see if it's valid or you are too deep/shallow. – ficuscr Aug 27 '12 at 07:15
  • 1
    if your php file contains some classes, then you must use it as a vendor library. – Arun Jain Aug 27 '12 at 07:28

1 Answers1

1

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.

parseha
  • 170
  • 1
  • 8