Chobeat
Chobeat

Reputation: 3535

Including file in cakephp

I'm getting mad. I can't understand what's the problem. screenshot Obviously i'm trying a require_once() but it doesn't work. As you can see, the file should be in the right place. Anyone have a clue why it doesn't work?

Upvotes: 0

Views: 19463

Answers (3)

Paul Okeke
Paul Okeke

Reputation: 11

Just place your path appropiately. For instance

require_once('/cake/importedfolder/imported_file.php');

In as much as your .htaccess is set to have permission and mod_rewriting is enabled.

To narrate better: you can place the file or folder containing the file you want to import in the 'webroot' folder For instance we want to require a connection.php file (just to explain tho). All you have to do is place the file in 'webroot' And then require it. : thus 'require_once(/cake/connection.php');

Let me know if this helps.....

Upvotes: 1

octavian
octavian

Reputation: 321

You can include files in different ways: http://book.cakephp.org/2.0/en/core-utility-libraries/app.html

In your case you're using Lucene as a vendor, so the correct include would be:

App::import('Vendor', 'lucene/Search/Lucene');

to load /app/Vendor/lucene/Search/Lucene.php

Upvotes: 3

dzm
dzm

Reputation: 23534

If you have a file in your vendors folder (i.e., vendors/filename.php)

You can do:

App::import('Vendor', 'filename');

Here's some more examples of including vendors

Upvotes: 7

Related Questions