AuthComponent logs out users randomly?

2009-08-01 Thread Marcel

Hi,

I'm using cake's AuthComponent for login/logout etc.
But sometimes when I click around the site I'm getting logged out.

No error message - nothing. Rarely I've also seen white screens. But 
no error message on the screen (debug is enabled) and no errors in any 
log files (webserver+cake).

I was not able to surely reproduce this, it just happens randomly. But I 
just got logged out by clicking very fast around the page. I think cake 
logs me out when I click to links at the same time (i.e. click one 
link and fastly any other link before the site loads). This is really 
annoying :(

Security.level is set to high, but it also happens at low. I'm not 
using any ACL stuff.

Maybe someone has any tip?


Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: empty pages on prod server

2009-06-23 Thread Marcel

I'm also having this sometimes and I couldn't figure it out.

Are you using Auth Component and or Security Component?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: transactions + redirect doesn't work!

2009-06-22 Thread Marcel

Mateo San Román wrote:
 Thank you for you quick answer.
 Any way to do that operation in a standard way?


Depending on what you like to do put the SQL in a model. I think/hope 
that cake does not make new connections for each model method call ;)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP XSS protection?

2009-06-17 Thread Marcel

Hi,

I'm using the save(), saveField() and saveAll() model methods to save 
userdata directly to the database.
On some sites I've read that CakePHP does things against XSS, but when 
I'm trying to save the standard example xss string

script type=text/javascriptalert(XSS);/script

to the database it's saved as it is. So the alert box is shown when e.g. 
I just do a findAll() and print it out on a table.

Is there an easy way to solve this issue? Do I have to handle this in 
beforeSave? Or can it be done in $validate?


Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP XSS protection?

2009-06-17 Thread Marcel

Adam Royle wrote:
 You need to handle this manually. Look at the Sanitize class for cake's 
 built-in methods.
 
 http://api.cakephp.org/class/sanitize
 
 If you don't need the user to enter any html at all, consider using the h() 
 method while outputting your data, which will convert any html tags to their 
 entities so they will no longer be interpreted by the browser as html.
 
 Cheers,
 Adam

Thanks!
Should this also be used while saving data? Or only in the views?

Marcel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with $this-Session-setFlash when using caching

2009-06-17 Thread Marcel

Looks like that this is also not working within nocache, like the 
FormHelper... :(

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with $this-Session-setFlash when using caching

2009-06-17 Thread Marcel

Steve wrote:
 Well, when I activate this line in core.php:
 
 Configure::write('Cache.disable', true);
 
 Everything works like expected..
 
 But then you have no caching at all...


See: https://trac.cakephp.org/ticket/6034

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth Component, white page when cookies disabled

2009-06-09 Thread Marcel

Hi,

When I disable Cookies I get a white page after logging into my website 
(using Auth Component).

Is there a way view an error page instead of just a white page?


Marcel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth: become a user

2009-04-12 Thread Marcel

Hi,

I've got a basic Authentication with the Auth-Component. The Auth Model 
is called 'user'.

I'd like to implement an admin-area where an admin can become an user. 
How can this easily be done?


Cheers

Marcel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth: become a user

2009-04-12 Thread Marcel

Hi,

An admin is a normal user which has tinyint admin set to 1.

Becoming a user means to make Auth think that the logged in user is 
the user the admins wants to be. The target is that an admin can see the 
website like the normal user does with all the relations and stuff.

bally.z...@gmail.com wrote:
 Log in? What does become a User mean?
 
 Is Admin extended from User? If not, you can always make 
 AdminsController::uses = array('Admin', 'User') and you can do all the 
 CRUD you want.
 
 On Apr 12, 2009 4:56pm, Marcel vermas...@gmail.com wrote:
  
  
   Hi,
  
  
  
   I've got a basic Authentication with the Auth-Component. The Auth Model
  
   is called 'user'.
  
  
  
   I'd like to implement an admin-area where an admin can become an user.
  
   How can this easily be done?
  
  
  
  
  
   Cheers
  
  
  
   Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Value from record

2009-04-12 Thread Marcel

Dave Maharaj :: WidePixels.com wrote:
 I have a states table which holds id, abrev, name
  
 My user profile displays the State.name based on the id. (HABTM table)
  
 ?php echo $user['User']['state_id']; ? displays California
  
 How can i get it to display CA rather than the full name?
  
 the controller gets the user info by:
 $this-set('users', $this-paginate());
  
 Thanks,
  
 Dave


Why HABTM?

Shouldn't it be sth like: User hasOne State, State belongsTo User? It 
should be enough to just have a state_id at your user table.


Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



send POST with redirect()

2009-03-12 Thread Marcel

Hi,

I need to send post variables to a website but I'd like to to this 
without a form the user sees.

The user should just click on a link and I'll do the redirect and like 
to pass through the POST information.

Is this somehow possible?


Cheers

Marcel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: send POST with redirect()

2009-03-12 Thread Marcel

Miles J wrote:
 Ajax or use javascript submit().


Thanks, but that's not exactly what I wanted to do.

I want to set the POST Variables in the action method of the controller 
and then use $this-redirect().

e.g. something like

$post['foo'] = bar;
$this-redirect(http://someurl;);


at http://someurl there then should be set $_POST['foo']



Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What do you develop in (ide, text editor, etc.)?

2009-03-01 Thread Marcel

At the moment I'm still using Eclipse. But it's too slow and the code 
completion is not very useful with CakePHP. A normal Texteditor would do 
it's job as well.

I'll give Netbeans a try and then probably switch to notepad++ or 
something similar (what do you need more than a small file explorer and 
tabs? ;) ).

cheers

Marcel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Howto secure a form / posted data from tampering?

2008-04-08 Thread Marcel

Hello

The problem is that a model has some fields that the user may never
edit. I don't show them in the /edit view so they don't get posted (by
default). But manualy adding some of those private fields will result
in illegal save. I've noticed the secure method in the api of the
FormHelper to generate a hidden field with some sort of hash, but how
do I use that?

I did this in my /edit view:
echo $form-secure($this-data);

Which does work, but how do I validate that in my save method? If I do
a post it still saves the posted (malicious) data...?

Thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



efficient allow / deny check for pages

2008-03-31 Thread Marcel

Hello!

I have a model named Menu which surprisingly stores menuitems for my
websites (using tree behavior). There are also models voor Users and
Groups. The menu creates the Aco's and the User and Group models
create the corresponding Aro's.

What I want is to get all menuitems that a user has access to, but I
can't figure out what the most efficient way would be? I can check if
a user has access to one page using Auth-check but doing that on
thousands of menuitems will not be healthy for the performance.

I just can't figure out what the best and most efficient way would be
to ultimately get a hiearchial array of menuitems that only the user
has access to. I'm not asking for code examples or so, just a 'this is
how to' would be great! ;-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



ACO::setParent adds an empty record

2008-03-28 Thread Marcel

Helllo!

I can't get setParent on an aco to work using the console:

Menu:
id | title
1  | websites
2  |mysite.nl
3  |   admin
5  |  news
4  |   www

Aco:
id  | parent_id | model | foreign_key
17 | null | Menu  | 2
18 | 17  | Menu  | 3
19 | 17  | Menu  | 4
20 | 18  | Menu  | 5

Now, I want to move news under www so I do this:
cake acl setParent aco 20 19

But the result of this action is that a new aco record is added with
parent_id set to 19, but all other fields like model, lft, rght are
null.

What am I doing wrong?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: ACO::setParent adds an empty record

2008-03-28 Thread Marcel

I got it working like this, but isn't there an easier way using
setParent?


In the menu_controller that handles the reparent action:

//get aco of the node to move (thisAco) and the new parent (otherAco)
//The 0 says we do not want to get the aros (if any)
$thisAco = $this-Menu-Aco-find(array(model=Menu,
foreign_key=$movedID), array(), null, 0);
$otherAco = $this-Menu-Aco-find(array(model=Menu,
foreign_key=$destID), array(), null, 0);

//update parent and save
$thisAco[Aco][parent_id] = $otherAco[Aco][id];
$this-Menu-Aco-save($thisAco);



On 28 mrt, 12:21, Marcel [EMAIL PROTECTED] wrote:
 Helllo!

 I can't get setParent on an aco to work using the console:

 Menu:
 id | title
 1  | websites
 2  |mysite.nl
 3  |   admin
 5  |  news
 4  |   www

 Aco:
 id  | parent_id | model | foreign_key
 17 | null | Menu  | 2
 18 | 17  | Menu  | 3
 19 | 17  | Menu  | 4
 20 | 18  | Menu  | 5

 Now, I want to move news under www so I do this:
 cake acl setParent aco 20 19

 But the result of this action is that a new aco record is added with
 parent_id set to 19, but all other fields like model, lft, rght are
 null.

 What am I doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Hide php code in /app from FTP

2008-03-25 Thread Marcel

Hello,

I was wondering what the best way would be for hiding the code in /
app?
The situation: My company makes websites with a CMS behind it. Now
customers often ask if they could get access to the FTP account so
they can add other folders there so they are availble for there
customers online.

Now what we really do not want is the customer having access to our
core application code. The may access the webroot folder and
subfolders.

Our solution was creating a symlink to the application core code and a
symlink is not visible when viewing the files in an FTP client.

But how would one achieve this in cake? It isn't possible to create an
FTP account that has the webroot folder as 'home folder'. An PHP
accelerator would be an option, but rather not...

So the question is: How can we protect our code efficiently from these
FTP users?

Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Hide php code in /app from FTP

2008-03-25 Thread Marcel

Ok, thanks for the fast reply's!

I will play with your suggestions and as soon as I have the results I
will post them back here :-)

On 25 mrt, 11:28, laeffe [EMAIL PROTECTED] wrote:
 I would recommend you to look up ACL, if your box is *NIX based. With
 it you would be able to specify the access rights on a file system
 basis. I use it my self and it is very useful =D

 On Mar 25, 10:58 am, Marcel [EMAIL PROTECTED] wrote:

  Hello,

  I was wondering what the best way would be for hiding the code in /
  app?
  The situation: My company makes websites with a CMS behind it. Now
  customers often ask if they could get access to the FTP account so
  they can add other folders there so they are availble for there
  customers online.

  Now what we really do not want is the customer having access to our
  core application code. The may access the webroot folder and
  subfolders.

  Our solution was creating a symlink to the application core code and a
  symlink is not visible when viewing the files in an FTP client.

  But how would one achieve this in cake? It isn't possible to create an
  FTP account that has the webroot folder as 'home folder'. An PHP
  accelerator would be an option, but rather not...

  So the question is: How can we protect our code efficiently from these
  FTP users?

  Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: MVC Architecture: model -- controller -- view

2008-03-10 Thread Marcel

Oke thanks for the explanations!

I know there are many good implementations of the mvc pattern, but
because I'am starting a new project for my job (my first piece of
cake) I wanted to know some background info on this issue.

thanks again!

On 3 mrt, 19:49, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 As Nate said, original MVC was intended for desktops apps (it comes
 from smalltalk). View was associated to a model trough the Observer
 pattern, where model was in charge to tell the view when it's status
 has changed.Controllerwas an artifice to make the user able to edit
 data in view (using gui widgets) and then it pushes the changes to the
 model.

 Actual MVC in frameworks like CakePHP is something else, but it works
 this way, and has proven to be a really good way to structure web
 apps, so bear with it.

 More on MVC:http://www.martinfowler.com/eaaDev/uiArchs.html

 On Mon, Mar 3, 2008 at 2:34 PM, nate [EMAIL PROTECTED] wrote:

   Not true.  If there is a most important tier in MVC, it is arguably
   the model, which is your domain entities, which should encompass the
   bulk of your application's business logic.  Thecontrollersimply has
   the unglamorous job of shoveling data back and forth between your
   model and view.

   The important thing to remember, however, is that MVC is a *pattern*;
   patterns have many implementations, and there's no one right one (that
   doesn't mean that there aren't many wrong ones).  MVC was first
   developed almost 30 years ago, and there have been many iterations on
   it since then, the most notable difference from the original being
   that it's now used in web applications, whereas it was first designed
   for desktop apps.

   On Mar 3, 11:00 am, Kjell Bublitz [EMAIL PROTECTED] wrote:
the view in turn, asks the model for some data to display it

This sounds to me like it's an (bad) explanation past thecontroller.

Anyway, the view never asks anything from the model. The view is the
final stage (a format, if you want). The most important thing in MVC
is the C. Without thecontrollerit would be sorta procedural and so
the whole object model would be useless.

The example you gave is an optional one. 99% you wont need to use
requestAction if your controllers and model relations are well thought
out.

Basicly it goes like this: request - loadcontroller- load models
- call action (using models) - assign data - render view.

And requestAction does nothing else. So there is no direct
Model-View connection, even so it looks like that. As you can see by
the URL (first param) it calls the newscontrollerand the view
action - not any specific model

HTH

   On Mon, Mar 3, 2008 at 4:31 PM, djiize [EMAIL PROTECTED] wrote:

  If Views directly ask Models to have Data:
  1- what is Controllers' purpose?
  2- how do you do business Logic with your data?

  On 3 mar, 12:32, Marcel [EMAIL PROTECTED] wrote:
   Hi!

   I've been doing some research about MVC implementations indifferent
   frameworks. Now in allmost every book I have on my desk it says
   something like 'the view in turn, asks the model for some data to
   display it'. In cake I have noticed (if I'm correct) thecontrolleris
   asking data from the model and that data is then passed to the view.

   Example: $newsItem = $this-requestAction(/news/view,
   array(id=1));

   My question is why this kind of implementation? It seams to be a bit
   of double work because having that kind of intermediate 'layer'
   between model and view.

   Just curious ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Creating a generic controller

2008-03-10 Thread Marcel

Hello

Is there a way to create a generic crud controller shared by some
models? But there's a catch: I don't know before hand what the models
will be.

What I would like to have is something like this:

/news = dispatch to generic_controller.php
/news/edit/1 = dispatch to generic_controller.php, action edit
etc...

By default, cake searches for a file named news_controller.php, but I
want to change that to generic_controller.php

Is that possible?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Creating a generic controller

2008-03-10 Thread Marcel

Ah that works great!

It was the creating/adapting of te model correcty in the generic class
part where I got stuck :-)  I did look at the scaffold controller but
didn't knew exactly what fields to set.

Thanks a lot!

On 10 mrt, 15:20, grigri [EMAIL PROTECTED] wrote:
 You could try something like this:

 routes.php

 Router::connect('/:pseudo/:action/*', array('controller' =
 'generic'), array('pseudo' = '/^(news|eggs|bacon|spam)$/));

 controllers/generic_controller.php

 class GenericController extends AppController {
   var uses = array();

   function beforeFilter() {
 // Get the pseudo-controller from the params
 $this-pseudo = $this-params['named']['pseudo'];
 // Set the various internal variables
 $this-modelClass = Inflector::classify($this-pseudo);
 $this-modelKey = Inflector::underscore($this-modelClass);
 $this-viewPath = $this-pseudo;
 // Load the model normally
 $this-loadModel($this-modelClass);
   }

   function view($id) {
 $this-set('data', $this-{$this-modelClass}-findById($id));
   }

   function edit($id = null) {
 if (!empty($this-data)) {
   $this-{$this-modelClass}-create();
   $this-{$this-modelClass}-id = $id;
   if ($this-{$this-modelClass}-save($this-data)) {
 // blablabla as normal
   }
 }
 else {
   $this-data = $this-{$this-modelClass}-findById($id);
 }
   }

 }

 So calling /news/edit/1 will be handled with generic_controller, with
 its internal variables set to:

 pseudo: news
 modelClass: News
 modelKey: news
 viewPath: news [this is the subfolder where the view files are stored]

 On Mar 10, 1:32 pm, Marcel [EMAIL PROTECTED] wrote:

  Hello

  Is there a way to create a generic crud controller shared by some
  models? But there's a catch: I don't know before hand what the models
  will be.

  What I would like to have is something like this:

  /news = dispatch to generic_controller.php
  /news/edit/1 = dispatch to generic_controller.php, action edit
  etc...

  By default, cake searches for a file named news_controller.php, but I
  want to change that to generic_controller.php

  Is that possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Application Design Issue

2008-03-10 Thread Marcel

Have a look at this, it did help me to get rid of all the almost-
simular controller files:
http://groups.google.com/group/cake-php/browse_thread/thread/7638b690ae0545ff


On 10 mrt, 15:57, sleepy1038 [EMAIL PROTECTED] wrote:
 I think I may try implementing some logic in AppController. I will let
 you know how it turns out.

 Thank You

 On Mar 10, 9:36 am, djiize [EMAIL PROTECTED] wrote:

  you can load a Model in a component
  see App::import('Model', 'ModelName')

  but it's not very MVC compliant, so if you can avoid that... ;)

  Maybe you could do your business in AppController, or better in a
  behavior (or many) ?

  On 10 mar, 13:58, sleepy1038 [EMAIL PROTECTED] wrote:

   Could I use a component instead, since a lot of the logic that is
   being duplicated is business logic? If so, how do I use Model classes
   in a component? According to the manual, there is no guarantee that
   model instances will be created at the time my component attempts to
   use them.

   Thanks,

   Mike

   On Mar 10, 2:28 am, Adam Royle [EMAIL PROTECTED] wrote: You have three 
   options:

- put generic code in app_model.php
- use model inheritance, eg. class MyModel extends MyBaseModel, class
MyBaseModel extends AppModel
- write a model behaviour (not unlike multiple inheritance)

Cheers,
Adam

On Mar 10, 4:04 pm, sleepy1038 [EMAIL PROTECTED] wrote:

 In my application, I will have the same problem if I put the bulk of
 the code in the models. I have as many models as I do controllers. How
 should I handle this?

 Thanks

 On Mar 9, 10:31 pm, mbavio [EMAIL PROTECTED] wrote:

  The essential Fat Models, Skinny Controllers:

  Write big and long models, and short controllers

  DRY itself.

  Cheers,
  Martin B

  On Mar 9, 4:52 pm, sleepy1038 [EMAIL PROTECTED] wrote:

   Hello,

   I've recently implemented a content management system using Cake, 
   and
   am running into a design issue. I have many different types of 
   posts
   (articles, books, etc.). All these posts must be associated to 
   tags. I
   implemented a general posts table, and associated the tags to 
   this. I
   then implemented each type of post as belonging to a content post.

   The problem is, I now have many controllers. Each post type has 
   its
   own controller, although aside from differing fields they pretty 
   much
   have the same controller logic. The only thing that really 
   differs in
   each controller code is the name of the controller instance. 
   Whenever
   I need to make an update, I have to essentially copy and paste 
   into 10
   different controllers.

   My questions is, how do I consolidate this logic into one 
   location. I
   thought about using a component, put b/c Cake uses lazy loading I
   don't believe the model classes are available in a component. Am I
   wrong about this? Is there a way around this? Also, is there any 
   way
   to consolidate the many views associated with the controllers? Any
   help would be greatly appreciated.

   Thank You
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



MVC Architecture: model -- controller -- view

2008-03-03 Thread Marcel

Hi!

I've been doing some research about MVC implementations in different
frameworks. Now in allmost every book I have on my desk it says
something like 'the view in turn, asks the model for some data to
display it'. In cake I have noticed (if I'm correct) the controller is
asking data from the model and that data is then passed to the view.

Example: $newsItem = $this-requestAction(/news/view,
array(id=1));

My question is why this kind of implementation? It seams to be a bit
of double work because having that kind of intermediate 'layer'
between model and view.

Just curious ;-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---