0

I should have access to CakePHP constants in an external application on the same server.

What is best practise to include parts of a CakePHP application, to access them?

already tried to include bootstrap.php:

Fatal error: Class 'Cache' not found in /Users/Patrick/Sites/project/Config/bootstrap.php on line 27

line 27 in bootstrap.php:

Cache::config('default', array('engine' => 'File'));

Patrick Hafner
  • 129
  • 3
  • 12
  • what exactly are your global vars? usually there are none in such a framework. they all have some scope or are accessed by wrappers like session, configure, ... – mark May 16 '12 at 12:01
  • I need APP and CAKE_CORE_INCLUDE_PATH for this external application. – Patrick Hafner May 16 '12 at 12:04
  • my fault, changed title. need one more coffee :) – Patrick Hafner May 16 '12 at 12:08
  • You probably need to include the index.php or copy and paste some of it (without the dispatcher part). – mark May 16 '12 at 12:09
  • just tested, but there's following error: `Fatal error: Class 'Cache' not found in /Users/Patrick/Sites/project/Config/bootstrap.php on line 27` line 27 in bootstrap.php: `Cache::config('default', array('engine' => 'File'));` – Patrick Hafner May 16 '12 at 12:15

1 Answers1

2

Best practice is to make a plugin for it. That creates a separation of concerns. Just including parts from Cake into another piece of software will create a mess likely. Think about what happens when CakePHP Framework get's to a new version. After a while it is totally unclear what is integrated and what not while you have to check only your plugin(s) to see the integration in the other case.

Luc Franken
  • 2,994
  • 1
  • 17
  • 14