Awsome Martin. Thanks. I did try this a few days back before posting
but could get it to work. I'll try again in case I did something
wrong.

Cheers,

bwragg

On Feb 2, 11:51 pm, Martin Westin <[email protected]> wrote:
> You can probably do something like this:
>
> 1. make a copy of app/webroot/index.php - call it start_cake.php or
> something and put it where you can include it.
> In that file:
> 2. alter the include paths to suit your environment so that cake can
> be found.
> 3. remove the call to Dispatcher almost at the bottom. (you might want
> to remove the timer at the very bottom also)
>
> Just above the lines about the dispatcher and the favicon you see the
> important line that "initializes" the framework:
> --> if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
>
> It is important to keep that if clause :)
>
> Now, if you include that file you can call up a model in the way Miles
> wrote.
>
> /martin
>
> On Feb 2, 10:04 am, Miles J <[email protected]> wrote:
>
>
>
> > App::import('Model', 'ModelName');
> > $model = new ModelName();
>
> > But that would only work within the cake system itself.
>
> > On Feb 1, 8:20 pm,bwragg<[email protected]> wrote:
>
> > > Hi all,
>
> > > We have some code written in an existing app and will be migrating it
> > > to cake in the future but for step 1 of the migration we need to start
> > > using cake's model functionality.
>
> > > So is it possible to load cake into the existing php code via an
> > > include() to get access to just the model functionality and not the
> > > controller and view functionality? For example how can I do something
> > > like :
>
> > > //existing applicataion code
> > > include('load_cake.php');
> > > $m=new model_in_cakes_model_dir();
> > > //...use model as normally would in cake
> > > $m->findAll();
> > > //change $m to have different values
> > > $m->save();
>
> > > Thanks.
>
> > >bwragg- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to