Hello, i have a question: i have a model named "admin" where the
admins of the site can write an article, edit it, delete it etc. It's
assosiated with model "section" so every article must belong to a
section.

How can i make a model "articles" that doesn't have a database
connected to it but it can just use the fields from the other model to
show them to the visitor of the site? Let's say it will be the frond-
end of the site. When sb is going to the site i want it to go to /
articles/ (i know how to change it from routes.php) and show to the
user the all the published articles, e.g. sorted by their section. I'm
giving this example so i can help you understand what i want to do.

The reason that i don't want to use the admin model to view to
visitors the articles is that i don't want them to have any access to
the admin model (it will be password protected), for security reasons.
My approach is right?

The Admin model:
class Admin extends AppModel
{
var $name = 'Admin';
var $belongsTo = array ('Section' => array(
'className' => 'Section',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'section_id')
);
var $hasMany = array ('Article' => array(
'className' => 'Article',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'admin_id')
);
}

The Section model:
class Section extends AppModel
{
var $name = 'Section';
var $hasMany = array (
'Admin' => array(
'className' => 'Admin',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'section_id'),

'Article' => array(
'className' => 'Article',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'section_id')
);
}

The articles model:
class Article extends AppModel
{
var $name = 'Article';
var $useTable = false;
var $belongsTo = array (

'Section' => array(
'className' => 'Section',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'section_id'),

'Admin' => array(
'className' => 'Admin',
'conditions'=> null,
'order'=> null,
'foreignKey'=>'admin_id')
);
}


I did the above but i don't think it's the right thing to do..

Thank you for your time

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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