Re: Translation help

2006-12-22 Thread Claudio Poli 


Italian language uploaded.


--~--~-~--~~~---~--~~
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: Translation help

2006-12-22 Thread Mariano Iglesias

DONE.



I've uploaded the file to Google Group file space:



http://cake-php.googlegroups.com/web/default_es.pot?gda=pM-SXEQVwNXi_7HL
SeeNtp-vxh5uUMBK3rms7K1s1XO3I_p5JRVJVT3hrgKrn_IySc8la3JQ4TGSOcNvt2BjP67mPwUv
PaL7CSlCrVPCyuUyW4rK6w

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!

 _  


De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Larry E. Masters aka PhpNut
Enviado el: Viernes, 22 de Diciembre de 2006 09:02 p.m.
Para: cake-php@googlegroups.com
Asunto: Translation help



You will notice there is a msgid, this is the string I need translated into
another language.
The translated version of the string should be placed in the msgstr "" 





--~--~-~--~~~---~--~~
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: How to call other models from a model

2006-12-22 Thread the_woodsman


Remember as well, if the models are linked in this way you can chain
these calls, to access tables deeper in the relationships:

class Post extends AppModel
{
 var $hasOne = 'Author';

 function something()
 {
   /* Here you can access $this->Author->OtherModel->something...
  assuming the OtherModel class is linked from the Author model */
 } 


}

Can be quite handy.


--~--~-~--~~~---~--~~
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: Translation help

2006-12-22 Thread Mariano Iglesias


Larry,

I am already doing the translation into SPANISH.

Will send it as a reply to this message when finished.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


--~--~-~--~~~---~--~~
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: Updating a date field after form submission

2006-12-22 Thread Mariano Iglesias


As the name implies:

* created will be updated *ONLY* when the record has been created (one time)

* modified will be updated whenever record updates (which is: on creation
and on update)

Control it on what level? If you need further control (such as when they
should be updated or whatever) you can create your own fields and play with
beforeSave() and other callback methods to achieve what you need.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de phpjoy
Enviado el: Viernes, 22 de Diciembre de 2006 08:54 p.m.
Para: Cake PHP
Asunto: Re: Updating a date field after form submission


if i have a created field and a modified field, will both of them be
updated everytime?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Translation help

2006-12-22 Thread Larry E. Masters aka PhpNut

Hello all,

I have been working on the I18n and I10n support in the next major version
of CakePHP.
I am hoping you can help translate English to your language by editing a pot
file and sending it to me.
This way when someone installs cake they will see all the core messages in
their language.

http://translation.cakephp.org/default.pot

You will notice there is a msgid, this is the string I need translated into
another language.
The translated version of the string should be placed in the msgstr ""

There is a tool for editing these files.
http://www.poedit.org/

Others may know of another tool or any text editor should work.

--
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

--~--~-~--~~~---~--~~
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: Updating a date field after form submission

2006-12-22 Thread phpjoy


if i have a created field and a modified field, will both of them be
updated everytime?

for example:
add()/edit() - DB fields modified and created will be changed.

or:
add() - only the field "created" will be changed.
edit() - only the field "modified" will be changed.

and can you control it somehow?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why No Joining for hasMany and HABTM Associations?

2006-12-22 Thread Christoph Neumann

Cake automatically (left) joins over "hasOne" and "belongsTo" relationships,
but does not automatically join over "hasMany" and HABTM relationships. Why
is this?  This was recently discussed in the following thread and a
work-around involving rebinding associations to "hasOne" came out, but this
is a hack. Why not simply enable support for auto-joins for "hasMany" and
HABTM relationships?

http://groups-beta.google.com/group/cake-php/browse_thread/thread/b7bdb9ad670136d4/9d2ea0408d8756a1

At present, associations determine what Cake will splice together when
creating the tree of results, but associations do not determine what is
joined at query time. What would be ideal is being able to specify joins at
query time.  This is useful, for example, when table A needs to join to B
and B needs to join to C and the results of the entire set are filtered
based on fields in A and C.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



othAuth not reading cookie value

2006-12-22 Thread [EMAIL PROTECTED]


Logging in works perfectly. A cookie is stored which is valid until
2009, but when I reload the page a couple of hours later, I'm not
logged in anymore... I modified the OthAuth settings like this:

var $cookie_active= true;
var $cookie_lifetime = '+999 day';

The cookie is still on my PC, it looks like it's just not being read
for some reason.

This is some of my app_controller.php code:

function beforeFilter()
   {
$auth_conf = array(
'mode'  => 'oth',
'login_page'  => '/users/login',
'logout_page' => '/users/logout',
'access_page' => '/cpanel/index',
'noaccess_page' => '/users/noaccess',
'strict_gid_check' => false
);

$this->othAuth->controller = &$this;
$this->othAuth->init($auth_conf);
$this->othAuth->check();

if (!isset($this->User))
{
$this->User =& new User();
}
$email = $this->othAuth->user('email');
if (!empty($email)) // Only if the user is logged in
{
$user = $this->User->findByEmail($email);
$this->set('userInfo',$user);


--~--~-~--~~~---~--~~
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: Master-Detail question

2006-12-22 Thread bbuchs


I'd like to hear some suggestions on this, too. What's the best way to
add and edit multiple HasMany or HABTM relations in one single webform?

I've got a similar app to what theman describes; I use Javascript
(jQuery!) with an "add another answer" button that creates duplicates
of a formfield. How should those fields be named ("QuestionAnswer[]"?),
and how should they be handled in my controller?




On Dec 22, 11:42 am, "theman" <[EMAIL PROTECTED]> wrote:

I have a scenario where I'm building a test which has questions which
then have answers.  I want to be able to allow the user to create a
question (question add page) and also on that same page let them be
able to create their answers for this question.  I think I have the
models associated correctly with Questions hasMany Answers and Answers
belongTo Questions.

What I'm wondering is if anyone has any ideas or suggestions on how I
can do this using Cake.  What I've done previously (without cake) is
have a question add page with up to 8 (this is hardcoded) answers spots
available and on submit I create the question and get the key then only
create answer records for those out of the 8 that were filled out of
course using the master records (question) key.  So now when using Cake
do I just make some dummy answer records to display on my question add
page?  Then on submit cake should save everything properly because I
have the associations setup correctly?  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: LoadModel - updating tutorials

2006-12-22 Thread salimk786


is this the right way ?
If this is the right way to use LoadMoel (see below code), then won't
the model be
re-instantiated each time the user types in an incorrect password?

//controller
function login()
   {
$this->pageTitle = "Login";
$this->set('pageImage', 'login-welcome.gif');
$arr_validation_errors = array();

$this->loadModel( 'Member' );
$this->Member = &new Member();

//render view if user is logged in
if($this->Authentication->_isLoggedin())
{
$this->redirect('/members/');
exit;
}

if (empty($this->params['data']))
{
$this->render();
}
else
{
//has password
$this->sanitize->cleanArray($this->params['data']);
$password = 
md5($this->params['data']['Member']['password']);

if ($this->Member->validates($this->params['data']))
{
$results = $this->Member->find("email_address =
'".$this->params['data']['Member']['email_address']."' AND password =
'". $password ."'",'Member.id,Member.fname');

if ($results['Member']['id'])
{
//sets up the session vars

$this->Authentication->set($results['Member']);
$this->Member->id = 
$results['Member']['id'];
$_POST = array();//make sure the post 
is cleared out
$this->redirect('/members/');
}
else
{
array_push($arr_validation_errors, 
"Please enter a correct email
address and/or password");

$this->params['data']['Member']['password'] = '';
$this->set('data', 
$this->params['data']);
$this->set('arr_validation_errors', 
$arr_validation_errors);
$this->validateErrors($this->Member);
}
}
else
{
$this->set('data', $this->params['data']);
$this->validateErrors($this->Member);
}
}
} //end function


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



LoadModel - updating tutorials

2006-12-22 Thread salimk786


Hello,

Can someon please upadte the tutorial on the blog so that i can see how
i'm supposed to used loadmodel

thanks.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to store user more than one group?

2006-12-22 Thread nilaGroups


Hi all, I am a newbie to CakePhp. i have 2 questions using built in
ACL,
1. how can i store the user [ACO] more than one group? is it possible?
2. scenario: i have one client[Top Level Group], with in that "n"
number groups and sub groups, it' ok, when i go to create next client,
it will store [ARO] like 501 [id] and left=1001 and right=1002, and
when i add any group or user to ARO it will change all nodes left and
right values. is there anyway to store data without changing second
client nodes?
ex: Client1:  ARO:id=1 left=1 right=6
  id=2 left=4 right=5
  id=2 left=2 right=3
  
  -
  -

ex: Client2:  ARO:id=1 left=1 right=6
 id=2 left=4 right=5
 id=3 left=2 right=3
 
 -
 -
thanks a lot.,

regards,
palPalani


--~--~-~--~~~---~--~~
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: Problems with Auto-Complete in an Ajax Form

2006-12-22 Thread Chowsapal


Finally figured it out.  I just bagged the autocomplete component and
used the helper the regular way
(http://manual.cakephp.org/chapter/helpers).


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Master-Detail question

2006-12-22 Thread theman


I have a scenario where I'm building a test which has questions which
then have answers.  I want to be able to allow the user to create a
question (question add page) and also on that same page let them be
able to create their answers for this question.  I think I have the
models associated correctly with Questions hasMany Answers and Answers
belongTo Questions.

What I'm wondering is if anyone has any ideas or suggestions on how I
can do this using Cake.  What I've done previously (without cake) is
have a question add page with up to 8 (this is hardcoded) answers spots
available and on submit I create the question and get the key then only
create answer records for those out of the 8 that were filled out of
course using the master records (question) key.  So now when using Cake
do I just make some dummy answer records to display on my question add
page?  Then on submit cake should save everything properly because I
have the associations setup correctly?  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: pretty-url mayhem

2006-12-22 Thread ShepherdWeb


Things are pretty easy once mod_rewrite is enabled.  I know this is
probably not the answer you want to hear, but have you considered
changing hosts?

I'm sorry I don't have any experience working on URL rewrites without
using mod_rewrite.


--~--~-~--~~~---~--~~
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: Problems with Auto-Complete in an Ajax Form

2006-12-22 Thread Chowsapal


I'm still stuck on this... Any help would be appreciated.  Here's the
form code in my view:

form(array('action' => '/member/address_books'), 
'post',
array('update' => 'addressBookContent')) ?>

labelTag('User/username', 
'Username: ') ?>
autocomplete('User/username',
'/member/address_books/auto') ?>
submit('Add Contact') ?>

submit('Add Contact', 
array('url' =>
'/member/address_books/add', 'update' => 'addressBookContent',
'class'=>'submit-form')); ?>



and here's the controller code:

data)) {
$data =
$this->AddressBook->findByUserId($this->Session->read('User.id'));
if (empty($data)) {
$this->AddressBook->save(array('AddressBook' => 
array('user_id' =>
$this->Session->read('User.id';
$data =
$this->AddressBook->findByUserId($this->Session->read('User.id'));
$users = array();
}
$this->set('data', $data);
$users = array();
foreach ($data['User'] as $key => $user) if 
(is_numeric($key))
$users[$user['username']] = $user['username'];
$this->set('users', $users);
$this->render();
} else {
$this->cleanUpFields();
$addressBook =
$this->AddressBook->findByUserId($this->Session->read('User.id'));
if (!empty($this->data['User']['username'])) $user =
$this->User->findByUsername($this->data['User']['username']);
if (!empty($this->data['User']['username']) &&
$this->AddressBook->addAssoc($addressBook['AddressBook']['id'], 'User',
$user['User']['id'])) {
$data =
$this->AddressBook->findByUserId($this->Session->read('User.id'));
$this->set('data', $data);
$users = array();
foreach ($data['User'] as $key => $user) if 
(is_numeric($key))
$users[$user['username']] = $user['username'];
$this->set('users', $users);

$this->Session->setFlash(ucwords($this->data['User']['username']) .
' Is Now In Your Address Book.');
$this->render();
} else {
$this->Session->setFlash('Contact Username Not 
Found.');
$data =
$this->AddressBook->findByUserId($this->Session->read('User.id'));
$this->set('data',$data);
$users = array();
foreach ($data['User'] as $key => $user) if 
(is_numeric($key))
$users[$user['username']] = $user['username'];
$this->set('users', $users);
}
}
} // END function index


} // END class AddressBooksController
?>

I've tried several different things and can't seem to get autocomplete
working inside the ajax form.

thanks again,
chowsapal


--~--~-~--~~~---~--~~
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: Using data from another model, referenced by a foreign key.

2006-12-22 Thread FrenchEscapes


On Dec 22, 3:54 pm, clemos <[EMAIL PROTECTED]> wrote:

and if it's not about drop down, you can of course get the name of the
Type of your Event in your views like this:
($data is for exemple what Event->find() returns)



This worked great thanks, but tried putting it into a list of the
events using foreach (bake generated 'index' view) and it just listed
all the different types instead of the one relating to each record, I
can see why it happened but not sure how to do it to show each records
'type'!!

thanks 


Duncan


--~--~-~--~~~---~--~~
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: cake not running on shared server

2006-12-22 Thread Masida


I believe there are issues with CakePHP/mod_rewrite and mod_userdir
(the module which handles the /~username url's). On my Mac OS X machine
I had to disable mod_userdir. But you probably don't have that option
if it isn't your server.

Hope that gives you more info,
- Matthias

keymaster wrote:

Thanks for all your replies.

I did the following. I installed the identical files on another site,
this time with a regular domain name.

eg. www.mydomain.com (as opposed to the site in my post above which was
accessed through the ip)

I got the same error - but, I looked at the server error logs and found
the problem:

in app/webroot there is a .htaccess file which contained the lines
(from the BakeSale project on cakeforge):

php_flag zlib.output_compression On
php_value zlib.output_compression_level 1

These lines were producing the error:

"[alert] [client 99.99.999.999]
/home/myaccount/public_html/app/webroot/.htaccess: Invalid command
'php_flag', perhaps mis-spelled or defined by a module not included in
the server configuration"

So, I commented them out as follows:

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 1

That did it, cake came up smiling, using nothing but mod_rewrite.

I should note, that although I have no problems anymore on a site with
a regular domain name, there are still problems on the other site
accessed through IP.  I suspect there is still an issue there with
cake...

Thanks for your help.



--~--~-~--~~~---~--~~
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: Newbie question

2006-12-22 Thread clemos


hi kjohn

I think the User login, check, and so should rather be in your
controller, because usually Models are not a very good place for using
Sessions (and Components in general)

your Shop and User should probably be associated the simplest way
possible (without conditions) and your "conditions", user auth check,
login stuff should be in your Controller

and then in your shops controller, you can use this:
$data = 
$this->Shop->find(array("User.id"=>$this->Session->read('User.id'),"Shop.id"=>$shop_id));

if the shop $shop_id doesn't exist or the user isn't associated with
it, then $data would be empty, and else it will be filled with the
data for shop $shop_id...

hope this works


clemos

On 12/22/06, kjohn <[EMAIL PROTECTED]> wrote:


Hi all,

I am a newbie to cakephp & php OO..

I am confused how best to handle the following case:
 - Shop hasAndBelongsToMany Users (who can edit the Shop details).
 - Now, in the shops view page (say shops/view/2), how to check that
the currently logged in user can edit the shop (2) details?

I was thinking of adding the following to the shop.php model:

var $hasAndBelongsToMany = array('User' =>
   array('className'  => 'User',
 'joinTable'  => 'users_shops',
 'conditions' => 'User.id = '.
$this->Session->read('User.id'),
   )
   );

If this works, I could just read the $shop['User'] to check if the
current user can edit the Shop details. But it doesnt seem to work.

Any better way to get this working?

TIA
john


>



--~--~-~--~~~---~--~~
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: Newbie question

2006-12-22 Thread Adrian Godong

I don't think that Session is accessible from Model. But CMIIW.

If the above is true, then you'll need to move the matching logic into the
controller. You can use the beforeFilter callback function on the active
Controller to validate accessible shops.

On 12/22/06, kjohn <[EMAIL PROTECTED]> wrote:



Hi all,

I am a newbie to cakephp & php OO..

I am confused how best to handle the following case:
- Shop hasAndBelongsToMany Users (who can edit the Shop details).
- Now, in the shops view page (say shops/view/2), how to check that
the currently logged in user can edit the shop (2) details?

I was thinking of adding the following to the shop.php model:

var $hasAndBelongsToMany = array('User' =>
   array('className'  => 'User',
 'joinTable'  => 'users_shops',
 'conditions' => 'User.id = '.
$this->Session->read('User.id'),
   )
   );

If this works, I could just read the $shop['User'] to check if the
current user can edit the Shop details. But it doesnt seem to work.

Any better way to get this working?

TIA
john


>




--
Adrian Godong
[EMAIL PROTECTED]

Microsoft Student Ambassador

--~--~-~--~~~---~--~~
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: Using data from another model, referenced by a foreign key.

2006-12-22 Thread clemos


hi frenchescapes

in your model, you can choose which db field will be displayed as its name with:
var $displayField = "name_of_the_field";
This will work with Model->generateList() which will return an array
of id=>name.
(I guess you use generateList for your drop down menu)
and probably with scaffolding as well.

and if it's not about drop down, you can of course get the name of the
Type of your Event in your views like this:
($data is for exemple what Event->find() returns)


is it helpful ?
+
clemos

On 12/22/06, FrenchEscapes <[EMAIL PROTECTED]> wrote:


I have worked out how to populate drop down menus from an associated
model, thanks to help from other posts (much appreciated).

But I can't figure out how to use the foreign key to show a different
value from the other table, ex. I have an Events table which hasOne
Type, the 'id' of the Type is stored in the Events table, but when
viewing an Events record I want it to show the 'name' from the Type
table instead of the 'id'.


>



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Newbie question

2006-12-22 Thread kjohn


Hi all,

I am a newbie to cakephp & php OO..

I am confused how best to handle the following case:
- Shop hasAndBelongsToMany Users (who can edit the Shop details).
- Now, in the shops view page (say shops/view/2), how to check that
the currently logged in user can edit the shop (2) details?

I was thinking of adding the following to the shop.php model:

   var $hasAndBelongsToMany = array('User' =>
  array('className'  => 'User',
'joinTable'  => 'users_shops',
'conditions' => 'User.id = '.
$this->Session->read('User.id'),
  )
  );

If this works, I could just read the $shop['User'] to check if the
current user can edit the Shop details. But it doesnt seem to work.

Any better way to get this working? 


TIA
john


--~--~-~--~~~---~--~~
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: How to call other models from a model

2006-12-22 Thread anselm


Hi Ananda,


How to call other models in a model? I know that a controller could
use other model.


It depends what you want to do - if the model you want to call is an
associated model (ie. one you have defined in hasOne, belongsTo, etc.)
then Cake creates them automatically for you in the Model. For insance
:

class Post extends AppModel
{
 var $hasOne = 'Author';

 function something() {
   // Here you can access $this->Author
 }
}

Otherwise, follow Tarique's advice.

Anselm


--~--~-~--~~~---~--~~
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: How to call other models from a model

2006-12-22 Thread Dr. Tarique Sani


On 12/22/06, Ananda Putra <[EMAIL PROTECTED]> wrote:

How to call other models in a model? I know that a controller could
use other model.


Ideally you should not call one model from inside another but try

loadModel('blah');
$blah = new blah ;

Tarique

--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Coppermine Picture Gallery: http://coppermine.sf.net
=

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to call other models from a model

2006-12-22 Thread Ananda Putra


Hi all,

How to call other models in a model? I know that a controller could
use other model.

Thanks.

--
Regards,
Ananda Putra

--~--~-~--~~~---~--~~
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: Mod_rewrite on Windows XP

2006-12-22 Thread keymaster


Figured it out, and just thought I would post back with what made
everything work, so if someone later on is in the same position, they
will have this fix.

The stuff I mentioned at the start of this thread is all good, but :

1. I removed the:

RewriteBase /cake/

as it wasn't necessary.

2. Also, since I am using the bakesale project from CI forge, in
app/webroot/.htaccess there are two lines which were causing the
internal server errors.

They were the lines:

php_flag zlib.output_compression On
php_value zlib.output_compression_level 1

I commented them out like this:

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 1

3. I restarted the apache web server.

After these three changes, the internal server error went away,
mod_rewrite is working on windows, and cake, together with BakeSale
came up beautifully. (still a few problems I'm having with bakesale,
but I believe those are other issues).

I should note that even though cake pretty urls seem to work, things in
general just seem to work better with mod_rewrite, so I think it is
worth the effort to get mod_rewrite working. The benefits are not just
cosmetic (ie. nicer looking urls), I think stuff generally works better
with mod_rewrite in cake and there seems to be less problems.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---