Re: Element $html-link problem

2009-07-27 Thread Günther Theilen
Hi, you should add the fifth parameter to switch off escaping. http://api.cakephp.org/class/html-helper#method-HtmlHelperlink Something like this: e($html-link($html-tag('b','Home'),array ('controller'='controlls','action'='index'), null, null, false)); Regards Guenther DatacenterHellas

Change default behaviour of date saving

2009-07-08 Thread Günther Theilen
Hi, in my database there is a field called released type date. In the view I use this: $form-input('released', array('empty' = true)) Which gives me three nicely formatted select fields for month, day and year. But I can only save the field if all three select fields have a value. If I select

Containable problems

2009-05-20 Thread Günther Theilen
Hi, I'm a little bit lost about how to shape my query with the containable behaviour. There are two models: A hasMany B B belongsTo A B has a date-field Now I'd like to get one random data set out of A which has either - no belonging entries in B or - only entries in B where date is more

proper way to handle year fields

2009-05-13 Thread Günther Theilen
Hi, in my database I have a field named 'year' which has the type year(4). In the add form I would like to have a select field for the years. So I added this: e($form-year('year')); If I try to save the form I get an array to string conversion error and Unknown column 'Array' in 'field list.

Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Günther Theilen
Hi, $last_id = $this-ModelName-getInsertId() should do the trick. http://api.cakephp.org/class/model#method-ModelgetInsertID Regards Guenther Roman Brunnemann write: Hi, quick question from a newbie. After saving data that will result in a create, I'd like to retrieve the ID from the

Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Günther Theilen
Sorry, typo. It should be getInsertID(). Hi, $last_id = $this-ModelName-getInsertId() should do the trick. http://api.cakephp.org/class/model#method-ModelgetInsertID Regards Guenther Roman Brunnemann write: Hi, quick question from a newbie. After saving data that will result in a

containable trouble

2009-04-21 Thread Günther Theilen
Hi, I've got a bit of a problem with the containable behaviour: There are three models: A hasMany B B HABTM C A actsAs containable Now in a method of the A model I'd like to do a query which gets me the rows from A with the according rows from B _and_ the data from C belonging to each B. But

Re: containable trouble

2009-04-21 Thread Günther Theilen
Hi, thanks for the answer but I just found out that I misread the docs. I tried something like this: $data = $this-find('all', array( 'contain' = array( 'B' = array( 'contain' = array( 'C' ); which doesn't work. It has to be like this: $data = $this-find('all',

find('list') mit COUNT kombinieren

2009-04-17 Thread Günther Theilen
Moin, ist es möglich find('list') mit COUNT zu kombinieren? Ich möchte eine Liste erhalten mit dem Wert eines Feldes als key und der Häufigkeit des Auftretens als value. Geht das mit cake-Bordmitteln? Oder muss ich das Ergebnis einer find('list')-Abfrage in php auswerten (zählen)? Danke und

Re: find('list') mit COUNT kombinieren

2009-04-17 Thread Günther Theilen
, for example: array('fields'=array('Product.type','MIN(Product.price) as price'), 'group' = 'Product.type'); http://book.cakephp.org/view/74/Complex-Find-Conditions All the best, Richard 2009/4/17 Günther Theilen thei...@eqi.de Moin, ist es möglich find('list') mit COUNT zu kombinieren

Re: Problem with $this-Session-setFlash(__('Hidden value changed'));

2009-04-07 Thread Günther Theilen
Hi, Toby wrote: I have a problem with the following line in my code... $this-Session-setFlash(__('Hidden value changed')); try this: $this-Session-setFlash(__('Hidden value changed', true)); http://api.cakephp.org/file/basics.php#function-__ Regards Guenther

Re: Validate HABTM

2009-03-01 Thread Günther Theilen
by calling saveAll(). Isn't that possible with HABTM? Regards Guenther brian schrieb: Have a look here http://teknoid.wordpress.com/?s=validate+habtm On Fri, Feb 27, 2009 at 9:30 AM, Günther Theilen thei...@eqi.de wrote: Hi, maybe I'm a bit dull but I can't figure out what I'm doing wrong

Validate HABTM

2009-02-27 Thread Günther Theilen
Hi, maybe I'm a bit dull but I can't figure out what I'm doing wrong here. Maybe someone can help: I've got two models: Foo HABTM Bar. In foo_controller, add method I do this: $bar = $this-Foo-Bar-find('list'); $this-set(compact('bar)); In the foo/add view I have: $form-input('Bar',

Re: Authentication bypassed due to camel-cased naming of functions

2009-02-22 Thread Günther Theilen
Hi, what version do you use? There was a bug in an older version that is fixed by now: https://trac.cakephp.org/changeset/8011 Regards Guenther RKS schrieb: Hi friends, I am a new user of CakePHP, and just finished the tutorials. I created a small application for testing and found out a

Re: List of all Controllers and Actions

2009-02-18 Thread Günther Theilen
Hi, I use these two methods: http://bin.cakephp.org/view/835272537 Regards Guenther GetIT wrote: Hi, I want to build a navigation out of all available Controllers/Actions. Is there a way to get a list of all Controllers/Actions with the help of cakephp or php? How?

Re: File upload stopped working

2009-02-04 Thread Günther Theilen
to automatically populate $this-data var maybe just data[field] suffice, but I don't know as I always use FormHelper, you can try yourself On 4 fév, 08:05, Günther Theilen thei...@eqi.de wrote: Hi, I'm a little bit lost here, maybe someone can help. A file upload on one of my sites (Cake

Re: File upload stopped working

2009-02-04 Thread Günther Theilen
djiize wrote: - the form and the field have the same name ImportFile = conflict ? That did it. I renamed the field to import and it worked. The really strange thing is that it _has_ worked with ImportFile. Thanks a lot! Regards Guenther --~--~-~--~~~---~--~~

Define query condition in model

2009-02-04 Thread Günther Theilen
Hi! Is there as way to define default conditions in the model? Let's say I have a model with a field active which can be 0 or 1. In most queries I need the condition active = 1 but sometimes I need the condition active in (0,1). Is there a way to define active = 1 as the default condition for

Re: Define query condition in model

2009-02-04 Thread Günther Theilen
. '.active'])) { $conditions[$this-alias . '.active'] = 1; } return true; } 2009/2/5, Günther Theilen thei...@eqi.de: Hi! Is there as way to define default conditions in the model? Let's say I have a model with a field active which can be 0 or 1. In most queries I

File upload stopped working

2009-02-03 Thread Günther Theilen
Hi, I'm a little bit lost here, maybe someone can help. A file upload on one of my sites (Cake 1.2) suddenly stopped working. The method isn't used very often so I can't exactly say since when it doesn't work anymore but I know that my hoster has moved to a new data center and I suspect that

Re: Get count of related model

2009-01-29 Thread Günther Theilen
AS SELECT f.id, COUNT(b.id) FROM foo AS f INNER JOIN bar AS b ON b.foo_id = f.id GROUP BY f.id'; $this-Foo-query('SELECT * FROM foobar'); Oooh! Wouldn't Cake DBviews be tasty? Cake 2.0, maybe? On Wed, Jan 28, 2009 at 10:18 AM, Günther Theilen thei...@eqi.de wrote: Hi, I've got two models Foo

Re: Get count of related model

2009-01-29 Thread Günther Theilen
be used with conditions when you need to limit the results to rows that have (or don't have) related items. On Jan 28, 7:18 am, Günther Theilen thei...@eqi.de wrote: Hi, I've got two models Foo hasMany Bar. What would be the best way to get all entries of Foo and the number of according

Get count of related model

2009-01-28 Thread Günther Theilen
Hi, I've got two models Foo hasMany Bar. What would be the best way to get all entries of Foo and the number of according entries in Bar. I thought about a find-('all') and a count() in the view but that doesn't seem to be very elegant. Any hints? Regards Guenther

Re: How to prevent updating other fields when calling model::save()

2009-01-15 Thread Günther Theilen
Hi, you can add a list of allowed fields as third parameter. http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd428f5c81 Regards Günther K3 schrieb: Hi, if for example end user changed the html form and adds another field, he can update another field. What i mean by

Language codes

2008-12-10 Thread Günther Theilen
Hi, as far as I can see cake uses ISO 639-2 in i18n/l10n for the abbreviation of the language names. http://www.loc.gov/standards/iso639-2/php/code_list.php For a few languages there are two codes, B (bibliographic) or T (terminology). (Whatever that may mean...) For example: German has ger

Bug in text-truncate()?

2008-12-09 Thread Günther Theilen
Hi, I have a problem with truncate() and German umlauts (äöü). (The DB and the php code is in utf-8) $test = xäx; debug ($text-truncate($test, 9)); I would expect it to return xä... but it returns x?... Bug or feature? Regards Guenther

Re: Bug in text-truncate()?

2008-12-09 Thread Günther Theilen
mbstring.func_overload 7 This will overload string functions (strlen, substr, ...) to use the mb_* versions transparently. hth grigri On Dec 9, 12:06 pm, Günther Theilen [EMAIL PROTECTED] wrote: Hi, I have a problem with truncate() and German umlauts (äöü). (The DB and the php code is in utf

Re: store i18n data in database

2008-12-06 Thread Günther Theilen
Hi, thanks for the answers but the don't really cover my problem. Maybe my explanation was a bit blurry... Let's say I have a link like this: $html-link(__('edit data', true), array(...)) This works fine with the translations for 'edit data' in the po-files. But in my application I have to

store i18n data in database

2008-12-05 Thread Günther Theilen
Hi, in an application I use cake's l10n class which works fine. Now I want to be able to edit some of the translations from within the application. I'd like to use the __()-function but it should get the translations from a database table instead the po-files. Has someone already done

Re: Validation date: which key?

2008-12-02 Thread Günther Theilen
Hi Sebastian, I'm not 100% sure but this should work: 'date' = array ( array( 'rule' = array('date', array('dmy')) etc. Regards Guenther Sebastian Göttschkes schrieb: Hi Deepesh, thanks for your reply. Sure, I could make a custom validation rule, but as it is written in the

Re: DbAcl::allow() - Invalid node

2008-12-02 Thread Günther Theilen
Hi Anja, sorry, I can't help you with your specific problem. But maybe you want to take a look at this: http://www.cakephpforum.net/index.php?showtopic=27st=0 With that, I set up Auth and ACL and it works like a charm. (You should read the entire thread, though. There are some bugfixes.)

Re: Validation date: which key?

2008-12-02 Thread Günther Theilen
this to the docs with an example to provide an answer to anyone who is facing the same issue. Regards, Sebastian On 2 Dez., 15:17, Günther Theilen [EMAIL PROTECTED] wrote: Hi Sebastian, I'm not 100% sure but this should work: 'date' = array ( array( 'rule' = array('date', array('dmy

Auth-loginAction()

2008-12-01 Thread Günther Theilen
Hi, I've got a little problem regarding Auth-loginAction() on Cake 1.2.0.7692 RC3. Auth and ACL is set up and working fine. By default, Auth redirects to /users/login if someone tries to access a protected page. I want to change that. I put the login-form in some sort of sidebar menu (an

Re: Auth-loginAction()

2008-12-01 Thread Günther Theilen
. However, you can force people to go to a specific controller/action pair if needed. http://book.cakephp.org/view/391/loginAction You can change the default login from /users/login to be any action of your choice. thatsgreat2345 wrote: loginRedirect not loginAction On Dec 1, 7:01 am, Günther

Re: Additional conditions for authentication

2008-11-20 Thread Günther Theilen
Hi Anja, Liebermann, Anja Carolin schrieb: I wonder if I can add additional conditions for authentication. Something like this? http://book.cakephp.org/view/248/AuthComponent-Variables#userScope-487 Regards Guenther --~--~-~--~~~---~--~~ You received this

Re: best practices: disable/hide links which are denied by ACL?

2008-11-17 Thread Günther Theilen
dr. Hannibal Lecter schrieb: Günther, you seem to be working on the exactly same thing. Did you notice any significant slowdowns in your application? No, I didn't. But that's probably because my application isn't online yet... ;-) I'll let you know when I finished the component, ok? Regards

Re: best practices: disable/hide links which are denied by ACL?

2008-11-15 Thread Günther Theilen
dr. Hannibal Lecter wrote: I'm halfway through the ACL implementation (well, almost...), and I was wondering: is it better to hide the links which are denied by ACL (we're talking about the already logged-in user), or show them and give the user the Auth message not enough privileges?

Save hasOne

2008-10-08 Thread Günther Theilen
Hi, let's say there are two models: BasicEntry hasOne AdvancedEntry AdvancedEntry belongsTo BasicEntry In the advanced_entries table in the DB there is a field called basic_entry_id In views/basic_entries_edit.ctp there is something like this: $form-input('BasicEntry.foo');

Re: Save hasOne

2008-10-08 Thread Günther Theilen
% in control of what happens and when. I'll probably get used to saveAll() eventually though... On Oct 8, 1:40 pm, Günther Theilen [EMAIL PROTECTED] wrote: Yeah, I thought about that. But what happens if a user changes the value of the hidden field AdvancedEntry.id? So I would have to check

Re: Save hasOne

2008-10-08 Thread Günther Theilen
this for the primary model. It doesn't hurt, though) (id fields are hidden by default, so you don't need to specify it) hth grigri On Oct 8, 9:45 am, Günther Theilen [EMAIL PROTECTED] wrote: Hi, let's say there are two models: BasicEntry hasOne AdvancedEntry AdvancedEntry belongsTo BasicEntry

Re: Auth doesn't store user data in session after login?

2008-09-27 Thread Günther Theilen
Hi, what's the name of your session cookie? I had a similar problem with a session cookie name foo.bar. When I renamed it to foo_bar everything worked fine. alex_c schrieb: Hi all, I've been pouring over the docs and this group, but I can't really figure it out. In my UsersController,

Problem with form helper

2008-09-25 Thread Günther Theilen
Hi! I've got a weird problem with the form helper, maybe someone can help... $form-input(5.name) creates an input field with name=data[5][name], which is pretty much what I expected. But $form-input(0.name) creates an input field with name=data[foo][name], foo is the pluralized modelname.

Re: How to validate this?

2008-09-25 Thread Günther Theilen
into the right direction: http://bakery.cakephp.org/articles/view/multivalidatablebehavior-using-many-validation-rulesets-per-model Regards, Markus On 22 Sep., 14:25, Günther Theilen [EMAIL PROTECTED] wrote: Hi, I'm struggling a bit to set up the right validation rules for my

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
Donkeybob schrieb: what happens when you do it the other way . . . That doesn't work at all. I think I'll just capitulate an do it the old fashioned way: index.ctp to list the records, edit.ctp to edit _one_ record Thanks anyway! Regards Guenther

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
(Contact.$i.name); } This way the data is like this: $data = array( 'Contact' = array( 0 = array('id' = ..., 'name' = ...), 1 = array('id' = ..., 'name' = ...), 2 = array('id' = ..., 'name' = ...), ... ) ); ...works fine. hth grigri On Sep 25, 3:53 pm, Günther

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
am, Günther Theilen [EMAIL PROTECTED] wrote: Hi! I've got a weird problem with the form helper, maybe someone can help... $form-input(5.name) creates an input field with name=data[5][name], which is pretty much what I expected. But $form-input(0.name) creates an input field with name=data

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
-and-tips/ It looks like it *should* work. So I don't know... On Sep 25, 4:28 pm, Günther Theilen [EMAIL PROTECTED] wrote: Could you please post your controller code to populate the form? grigri schrieb: I've never seen it done that way before. I always do it like this: (simplified view

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
teknoid wrote: That being said it is always a good idea to name your fields as ModelName.fieldName and ModelName.{$index}.fieldName This is especially true when using saveAll(), and I do specify that in the tutorials. Yep, you're right. I usually do it that way when handling hasMany

How to validate this?

2008-09-22 Thread Günther Theilen
Hi, I'm struggling a bit to set up the right validation rules for my application, maybe someone has a hint. Let's say there are two models: User hasOne Profile The users belong to different groups and the profiles differ a bit according to the group. Users in group 1 have to enter data for

Re: Cake replace my special chars

2008-09-20 Thread Günther Theilen
Hi, kicaj wrote: ...in view: $form-input('category_id', array('options'=$categoriesList)); try this: $form-input('category_id', array( 'options' = $categoriesList, 'escape' = false )); Regards Guenther --~--~-~--~~~---~--~~ You received this message

Ideas about models and associations

2008-09-17 Thread Günther Theilen
Hi! I'm working on a new project and right now I'm struggling a bit to put the requirements together in a proper cake-like way. I use Auth/ACL which is set up and works fine. The users who can log-in belong to three different groups. These groups are defined by a field role_id in the user

Re: Ideas about models and associations

2008-09-17 Thread Günther Theilen
contacts and people and companies depending on the ContactsController. On Wed, Sep 17, 2008 at 8:10 AM, Günther Theilen [EMAIL PROTECTED] wrote: Hi! I'm working on a new project and right now I'm struggling a bit to put the requirements together in a proper cake-like way. I use Auth/ACL

Re: Missing Database Table

2008-09-09 Thread Günther Theilen
Hi, forrestgump: Error: Database table itemss for model Items was not found. you should check your model. Is it called items instead of item? regards Guenther --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Strange session problem

2008-08-26 Thread Günther Theilen
Hi, I'm using Cake 1.2.0.7296 RC2 on a local LAMP machine and I ran into a problem: There a two sites foo.local and bar.local, both have identical apache configuration files. They use different cake installation but (as far as I can see) the configuration files are identical (except for the

Re: Strange session problem

2008-08-26 Thread Günther Theilen
Hi again, I think I found the solution: I named the session cookie foo.bar. If I call it foo_bar it works. Are dots not allowed in cookie names? Regards Guenther --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups