Re: CakePHP 2.x how to manage multiple user-tables and access areas?

2012-10-23 Thread Braindead
Actually you only need one table with the following fields:

username or email
password
group
+ additional fields that might be useful for your application

After login (with AuthComponent) you can check to which group the user 
belongs. Depending on the group you can redirect the user to the correct 
area.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Social Networking Login with Auth Component.

2012-08-13 Thread Braindead

>
> I think HybridAuth is better in response data provided.
>

The only difference I can see is that HybridAuth does automatically login 
using AuthComponent and Opauth does not. But actually this can be done in a 
few lines of code. Opauth has the advantage that it is a nice plugin that 
fits nicely into any Cake app.

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Social Networking Login with Auth Component.

2012-08-13 Thread Braindead
Have a look at Opauth. It's a nice plugin working really well.

https://github.com/uzyn/cakephp-opauth 

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: One Site With Multiple SubSite

2012-07-20 Thread Braindead
The Cookbook describes it very well. Have a look at rounting: 
http://book.cakephp.org/2.0/en/development/routing.html

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: passing post_id to comments

2011-10-13 Thread Braindead
You're right, that someone could change the value using Firebug. To
prevent this you should use Cakes Security Component. If you use the
Security Component and the Form Helper to create your forms, Cake will
automagically add a hidden field containing a hash of your fields and
the values of hidden fields. If an attacker changes the value of a
hidden field or add/deletes a field, Cake will recognize it and stop
further processing.

Have a look at the Cookbook (for Cake 2.0)
http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html?highlight=security#SecurityComponent

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How would I do this project best in CakePHP?

2011-09-28 Thread Braindead
As your app seems to be very easy, you could create the database as
Paul already described and then bake the rest (controllers, models,
views).

http://book.cakephp.org/view/1522/Code-Generation-with-Bake

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Generate Excel from cakephp

2011-05-12 Thread Braindead
There is more than one way to create Excel sheets.

1. You can use a class like PHPExcel. You get a native Excel file.
2. You can save a simple HTML table as xls. Excel is able to read the
table.
3. You can create a CSV file. Excel is able to import the file.

Depending on your customers wishes, the amount of data and your skills
you can choose one of the above options.

Hope that helps.
Markus

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 207 bytes

2010-11-19 Thread Braindead
What about not using php_excel and writing Office XML using a simple
helper? That's the way I do it and it's working quite well. Of course
the helper has only a few features, but for simple exports that's ok.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: PHP CodeSniffer

2010-05-06 Thread Braindead
Hi Achilleas,

you are right that CodeSniffer validates your code to make sure that
it follows certain conventions. It is possible to define a validation
set that reflects CakePHPs conventions. If your code doesn't follow
these conventions CodeSniffer gives you a warning and you have the
possibility to correct it (if you want to).

As I'm new to CodeSniffer I thought that there must be someone who
already uses CodeSniffer with CakePHP and who is willing to share his
validation set with me (and anyone else ho is interested). I wonder
how the CakePHP core developers validate for conventions?

Thanks,
Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: PHP CodeSniffer

2010-05-03 Thread Braindead
I use this plugin with NetBeans, too. Which coding standard you want
to use is just a matter of taste. In every case you have to make the
standard follow Cake conventions and this is my problem. Is there
really no one who uses CodeSniffer in a Cake project?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


PHP CodeSniffer

2010-04-30 Thread Braindead
Hi all

is there anybody out there who uses PHP CodeSniffer with his Cake app?
I tried PHP CodeSniffer for the first time and used the build in
coding standards to sniff my code. Actually I get warnings because of
Cake conventions.

Method name "PostsController::admin_edit" is not on camel caps format

Just to mention one warning. So can anybody lead me the way to use PHP
CodeSniffer with CakePHP?

Cheers,
Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: dyamic dropdown list wtih dyanamic optgroup

2009-12-14 Thread Braindead
Actually it's quite easy. Have a look at the cookbook:
http://book.cakephp.org/view/192/options-options

Hope that helps,
Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: How much memory should cakephp use?

2009-12-06 Thread Braindead
I think the memory usage is normal, as my app has the same usage.

Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Fatal Error: Out of memory error

2009-11-26 Thread Braindead
I got the same error while creating an Excel file with many rows and
columns. So I guess the error is related to processing to much data.
You can either increase the memory limit or decrease the amount of
data to process.

Hope that helps.
Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Export to CSV using Helper, resulting error

2009-11-25 Thread Braindead
The problem with this approach is that Excel tries to parse certain
values. Just to mention one example: "1-10" will be converted to "01.
Oct".
I prefer the following approach from the bakery:
http://bakery.cakephp.org/articles/view/excel-xls-helper

Markus

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: addons.mozilla.org soon will leave CakePHP..

2009-11-17 Thread Braindead
I use Cake alot in more or less big projects and personally I don't
see a problem with the future of CakePHP.

The only thing that will happen in case the Cake development is
stopped is that there will be no new releases / features. Well that's
a pitty, but if you can live with the current release there is
actually no need for new features otherwise your decision to use Cake
was the wrong one. :-)

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@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=.




Re: Howto save NULL for a date field?

2009-11-12 Thread Braindead
Is there realy no automagic in Cake that converts empty date fields to
NULL?

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@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=.




Howto save NULL for a date field?

2009-11-12 Thread Braindead
Hi all,

In my form I have a date field. I use the form helper to generate a
year, month and day field for the date.

$form->input('date_field', array('type' => 'date');

Now I was asked to change the field, so that the users can enter the
date into a text field using -mm-dd as format.

$form->input('date_field', array('type' => 'text');

Actually this works as long as a date is entered. If the field is left
blank, Cake saves -00-00 instead of NULL, although the field in
the database is set to accept NULL values.

Is there a build in feature to force Cake to save NULL instead of
'' (empty)? Or do I have to process the date field in the beforeSave
event?

Thanks,
Markus

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@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=.




Re: validate - unique - error message

2009-10-12 Thread Braindead

http://api.cakephp.org/class/form-helper#method-FormHelpererror

Maybe this helps...
--~--~-~--~~~---~--~~
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: Paginate fat models

2009-09-30 Thread Braindead

That's what I thought.
--~--~-~--~~~---~--~~
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: remove authorization from Cakephp form

2009-09-30 Thread Braindead

In the beforeFilter event of your controller you have to use

$this->Auth->allow('action_of_your_form');

http://book.cakephp.org/view/563/Setting-Auth-Component-Variables
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Paginate fat models

2009-09-30 Thread Braindead

I'm currently reworking one of my early Cake applications and I want
to follow the "fat models - skinny controllers" principle. What I
don't understand is how to paginate a fat model. Is it true, that I
have to use pagination in the controller? Or is there another way?

Thanks,
Markus
--~--~-~--~~~---~--~~
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: Top Contributors

2009-09-20 Thread Braindead

You should also have a look at CounterCache:
http://book.cakephp.org/view/816/counterCache-Cache-your-count

Hope that helps.
Markus


--~--~-~--~~~---~--~~
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: Returning file for download

2009-09-07 Thread Braindead

You could also have a look at Cakes media views: 
http://book.cakephp.org/view/489/Media-Views
--~--~-~--~~~---~--~~
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: Organizing hierarchical system with breadcrumb navigation

2009-08-27 Thread Braindead

In my opinion using a model for breadcrumbs is bloated. Why don't you
just set the breadcrumbs in the view manually? The HTML helper has two
functions addCrumb and getCrumbs, which makes basic breadcrumbs really
simple.
--~--~-~--~~~---~--~~
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 sort forum threads?

2009-08-24 Thread Braindead

I want to build a forum with CakePHP. The forum actually consists of
many forums. Each forum hasMany threads. A thread hasMany replies.
Forums, threads and replies are stored in separate tables. All
assossiations are setup correctly.

How can I sort threads and replies by date, so that the newest thread
or the thread with the newest reply comes first.

Thanks,
Markus
--~--~-~--~~~---~--~~
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: Export to Excel

2009-08-24 Thread Braindead

There are at least 2 articles in the bakery that describe how to
create a real Excel file (no csv):

http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database
http://bakery.cakephp.org/articles/view/excel-xls-helper

Personally I use the second one and it works quite good.
--~--~-~--~~~---~--~~
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: Finding missing numbers in an array

2009-08-04 Thread Braindead

Or the Cake way: http://book.cakephp.org/view/666/diff

$missing_numbers = Set::diff($the:array, $the_complete_array);



On 4 Aug., 11:36, Fran Iglesias  wrote:
> You could try
>
> $missing_numbers = array_diff($the_array, $the_complete_array);
>
> El 04/08/2009, a las 9:57, liaogz82 escribió:
>
>
>
>
>
> > Hi all,
>
> > I know this is not directly related to cakePHP but i am cracking my
> > head trying my best to figure out how to discover a missing number in
> > an array in php.
>
> > Let me give you this example:
> > $missing_array1 = array(1,2,3,4,6,7,8);
>
> > The missing number for the above array is 5.
>
> > $missing_array2 = array(1,2,3,4,5,7,8,9);
>
> > The missing number is 6
>
> > Please help me on this. Thanks
>
> > Gangzheng
>
> ---
> Fran Iglesias http://cakephpilia.blogspot.com
--~--~-~--~~~---~--~~
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: Write to log table for every successful update/delete

2009-07-03 Thread Braindead

You should write a behavior. I guess that's the way to go. :-)
--~--~-~--~~~---~--~~
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: recursive = -1

2009-06-30 Thread Braindead

That's what I though about. But are there any unforseen problems with
this approach?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



recursive = -1

2009-06-30 Thread Braindead

Is it recommended to set recursive = -1 application wide and only set
it to a higher value when it is really needed?
Are there any unforseen problems?

Thanks,
Markus
--~--~-~--~~~---~--~~
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: Read-Only app

2009-06-30 Thread Braindead

and don't call $this->Model->save()

;-)
--~--~-~--~~~---~--~~
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: Web Installer

2009-06-30 Thread Braindead

Have a look at NeutrinoCMS. It is based on CakePHP and has a web
installer included.
http://dsi.vozibrale.com/articles/view/neutrinocms-0-1-beta-has-been-released

Happy baking,
Markus
--~--~-~--~~~---~--~~
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: retrieve profile id from session

2009-06-25 Thread Braindead

Did you set up the relationship between User and Profile properly?
There is no need to use "var uses" in your Profile controller, when
the relatioship is setup correct.

Markus


On 25 Jun., 10:31, Paulos23  wrote:
> Hello people,
> i am having an issue about profile id.I am using 2 models, User and
> Profile.After a successful login i activate 3 links about profile
> (create,view,edit) but when i use $user['Profile']['id'] in view,edit
> links i get a message "undefined user variable".In my Profile model i
> use var uses =array('User').Is there any alternative way to get the
> profile id even form the session?
>
> Thanks,
> Paulos N.
--~--~-~--~~~---~--~~
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: German Umlaut in form->end

2009-06-24 Thread Braindead

The problem was related to an encoding problem. Netbeans saved the
files as utf-8, but I wanted ISO 8859-1 to be used on my page. After
saving the files as ISO 8859-1 everything is ok now.
But I wonder if there is a way to get the umlauts encoded as
htmlentity (ü = ü) Is this not possible?

Thanks for all the help!
--~--~-~--~~~---~--~~
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: German Umlaut in form->end

2009-06-22 Thread Braindead

Thanks for the help. I guess it's a problem with the encoding, because
either "Löschen" nor "Löschen" work. :-(
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



German Umlaut in form->end

2009-06-21 Thread Braindead

Hi, how can I use a German Umlaut in form->end('Löschen')?
--~--~-~--~~~---~--~~
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: Router Connect

2009-06-19 Thread Braindead

This is the link to the corresponding chapter in the cookbook Adam
mentions:
http://book.cakephp.org/view/544/Prefix-Routing

Hope that helps,
Markus
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with associated model and form->dateTime

2009-06-08 Thread Braindead

Hi all,

I've a problem with associated models and form->dateTime.
I have the following models: User belongsTo Group hasOne Detail.

Now I want to edit User, Group and Profile in one form. User and Group
work without any problem, but there is a problem with the field
foundation_date of the Detail model. The foundation_date can be NULL.
I use the following code to generate the field:

echo $form->dateTime(
'User.Group.foundation_date',
'YMD',
'NONE'
);

If the field is not empty, everything is ok and I can enter a new date
and even empty the field. But when the field is empty I get the
following errors:

Undefined variable: year
Undefined variable: month
Undefined variable: day

Does anybody know a solution to my problem?

Thanks,
Markus
--~--~-~--~~~---~--~~
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: Cake php connection with MS Sql Server 2000

2009-05-28 Thread Braindead

Are you sure, that the connection settings are ok and the MS SQL
server is running?
You also have to change the security salt as the first message says.
But I gues that this is not related to your SQL server problem.
--~--~-~--~~~---~--~~
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: View Images

2009-05-28 Thread Braindead

I would save the files using the user id as part of the filename e.g.
user_12.jpg
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Database design

2009-05-27 Thread Braindead

Well, my problem is not directly related to CakePHP, but as it's about
database design maybe I'll get some good answers.

On my page I have news, downloads and users. These three can be
commented. Additionally I have a shoutbox and a guestbook. The
comments, shoutbox and guestbook have all the same fields. So they
could reside in the same table.

Is it best practice to only have one table for all comments (news,
downloads, users), the shoutbox and the guestbook and actually filter
based on a type column? Or is it better to separate everything into
it's own table?

Using only one table has the advantage, that I could use only one
controller and a limited set of views, where as using multiple tables
would mean multiple controllers and duplicated views (as they are all
nearly the same).

So what do you recomment?
--~--~-~--~~~---~--~~
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: Moving a webapp from Windows to Linux

2009-05-26 Thread Braindead

Are you sure that your problem is related to the PATH_SEPARATOR? I
guess they use the constant PATH_SEPARATOR to make it work on Windows
and Linux without having to worry about that.
I also develop on Windows using XAMPP and my production server is on
Linux. I never had that kind of problems.
--~--~-~--~~~---~--~~
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: Are admin routes worthwhile? No automagic with Auth

2009-05-26 Thread Braindead

I use admin routing to build an administration interface that has a
minimalistic design and is quite straight forward to the need to
administer the main page (write news, edit user profiles etc.)
So if you don't require this kind of admin interface than there is no
need to use admin routing at all.

Cake is written to be as flexible as possible. I don't think that
there will be an automagic to add the admin prefix to the functions if
the user has an admin role, because this would only serve your needs
and not mine for example.

Hope that helps to clear at least something about admin routing.
Markus
--~--~-~--~~~---~--~~
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: Validation and the return of data

2009-05-26 Thread Braindead

echo $form->input(
'password',
array(
'type' => 'password',
'value' => ''
)
);

Hope that helps,
Markus
--~--~-~--~~~---~--~~
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: using invalidate

2009-05-26 Thread Braindead

Why do you call save when validation in the controller fails?
Save validates your data using the validation rules in your model. If
you want to do some extra validate in your controller, you should make
sure, that you don't call save when the extra validation fails.

Did you setup validation rules in your item model? Check the Cookbook
for help on that topic: http://book.cakephp.org/view/125/Data-Validation
For validation inside your controller you should check this link:
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

Hope that helps
Markus
--~--~-~--~~~---~--~~
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: How to use bindModel in Cake PHP

2009-05-22 Thread Braindead

You should have a look at the models section of the Cookbook:
http://book.cakephp.org/view/66/Models
This should be the most interesting part for you:
http://book.cakephp.org/view/78/Associations-Linking-Models-Together
--~--~-~--~~~---~--~~
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: Appropriate requestAction() alternative required

2009-05-16 Thread Braindead

Have a look at the Cake based Neutrino CMS:
http://dsi.vozibrale.com/articles/view/neutrinocms-0-1-beta-has-been-released
It uses a component to get these kind of data. I use this approach all
the time and it works like a charme.

Markus
--~--~-~--~~~---~--~~
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: data not write in excel sheet on server

2009-05-16 Thread Braindead

You should have a look at PHPExcel. It's a very good class for
creating Excel sheets on the fly.
http://www.codeplex.com/PHPExcel

Hope that helps.
Markus
--~--~-~--~~~---~--~~
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: generating slug from title - must be unique! (using sluggable-1.1.3)

2009-05-13 Thread Braindead

As far as I can see from the source, the sluggable behavior increments
a number at the end of the slug in the case the slug is already in
use.
Pls. check the beforeSave event of the sluggable behavior.

Markus
--~--~-~--~~~---~--~~
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: Validate postal

2009-05-10 Thread Braindead

Hi Dave,

I've never used the postal code validation rule, but I guess you have
to use a cutom validation rule to validate postal code from different
countries.
Why don't you ask the user for the country, the town and the postal
code? In that case you won't have to try different formats.

Hope that helps,
Markus
--~--~-~--~~~---~--~~
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: DB driven sidebars

2009-04-20 Thread Braindead

You can use a component to fetch sidebar data from the database.

Have a look at NeutrinoCMS, a cake based CMS:
http://dsi.vozibrale.com/downloads/categories/view/neutrinocms
--~--~-~--~~~---~--~~
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: Need high-level advice on how to implement cross Model csv exporter

2009-04-15 Thread Braindead

Using the RequestHandler you could automatically switch the layout
based on the extension (in your case csv). In the layout file you
could generate the CSV content, which should be quiete easy.
--~--~-~--~~~---~--~~
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: Dependent in Associations is not working.

2009-04-14 Thread Braindead

How do you delete the user? You have to set the cascade parameter of
the del funtion to true. Otherwise related blog posts won't be
deleted.

http://book.cakephp.org/view/516/Deleting-Data
--~--~-~--~~~---~--~~
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: search engine bots and sessions

2009-03-13 Thread Braindead

Cake deletes expired entries from the session table automatically.
Therefore using the session table to track users could lead to wrong
figures.

Multiple records for the same IP address are ok. Try to open your site
with Firefox and IE at the same time. There will be 2 records for your
IP address, because the two browsers don't share sessions.
--~--~-~--~~~---~--~~
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: Expiry date

2009-03-12 Thread Braindead

If you are using the Auth Component, this is a simple task:
http://book.cakephp.org/view/248/AuthComponent-Variables

Hope that helps.
Markus
--~--~-~--~~~---~--~~
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: Form validation without model

2009-03-06 Thread Braindead

Yes, it is possible to use validation without a table. Simply define
$useTable = false in your model and define the validation rules as if
there was a table. You can then use cakes form helper without any
problems.

This is how you can force validation in your controller (part of my
contact page):

if (!empty($this->data)) {
$this->Contact->set($this->data);
if($this->Contact->validates()) {
//do something
}
} else {
$errors = $this->Contact->invalidFields();
$this->render();
}


Hope that helps,
Markus
--~--~-~--~~~---~--~~
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: Labels around inputs

2009-03-06 Thread Braindead

I haven't tried it, but maybe this can help:
http://bakery.cakephp.org/articles/view/overriding-specific-html-tags-before-using-helper-methods


--~--~-~--~~~---~--~~
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: How to use contained models in conditions?

2009-03-05 Thread Braindead

Miles, that's bad news. But how can I solve my problem? Is there any
workaround?

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



How to use contained models in conditions?

2009-03-05 Thread Braindead

Hi all,

I have 3 models: Company, Site and Country. All relations are set
properly.

Company hasMany Site
Company belongsTo Country
Site belongsTo Country

Using the Containable Behavior find queries and pagination works well,
except one thing: I can't get conditions to work that are related to
the contained models.

The following code shows how I paginate the Company model. But how can
I specify that I only get companies that have at least one site? Or
how is it possible to get only companies who have at least one site in
Germany?


$this->paginate = array(
'contain' => array(
  'Country' => array(
'name',
'region',
'continent'
  ),
  'Site' => array(
'fields' => array(
  'id',
  'name'
),
'Country' => array(
  'name',
  'region',
  'continent'
)
  )
)
  );


Thanks,
Markus
--~--~-~--~~~---~--~~
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: Validation Problem

2009-03-02 Thread Braindead

Take a look at the MultivalidateableBehavior in the bakery. That's
what I used to solve your kind of problems.
http://bakery.cakephp.org/articles/view/multivalidatablebehavior-using-many-validation-rulesets-per-model
--~--~-~--~~~---~--~~
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: Model localisation question.

2009-02-27 Thread Braindead

http://book.cakephp.org/view/198/options-error

This should answer your question. :-)
--~--~-~--~~~---~--~~
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: switching databases on dev and production

2009-02-11 Thread Braindead

Instead of changing a value in core.php you could switch the database
depending on the current DOCUMENT_ROOT or SERVER_NAME or some other
server variable that fits for the distinction between development
server and production server.

That's the way I do it and it works very well for me.
--~--~-~--~~~---~--~~
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: Validate belongsTo model in select element - inList does not seem to work?

2009-02-03 Thread Braindead

Brian, your solution seems to be ok, but there is one problem:

Let's assume the selectbox contains the 3 items de, nl and dk.
Selecting one of the items would pass the validation.
But aa, ab, ac, ad, ae and so on would also pass the validation
without being valid.

So what is the way to go? I guess you have to write a custom
validation rule, that checks if the selected item is part of the
association.

Hope that helps.
Markus
--~--~-~--~~~---~--~~
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: odd database problem

2009-02-03 Thread Braindead

Did you already delete the cached files? I guess this should solve
your problem.
--~--~-~--~~~---~--~~
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: Security-Component-form-checks?

2009-02-03 Thread Braindead

As far as I know the SecurityComponent checks for hidden fields.
But you could try it out using Firebug. ;-)
--~--~-~--~~~---~--~~
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: content_for_layout

2009-02-03 Thread Braindead

On your website you will most likely have parts that are displayed on
every page and other parts that change.
$content_for_layout contains the part that changes. :-)

Hope that helps.
Markus
--~--~-~--~~~---~--~~
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: Separating user and profile tables

2009-01-28 Thread Braindead

LunarDraco, thanks for the explanation! Now it's clear why Janne wants
to separate the information.
--~--~-~--~~~---~--~~
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: Separating user and profile tables

2009-01-27 Thread Braindead

Why do you want to separate login information from other information
about the user?
I cant't think of a good reason to do this.

Markus
--~--~-~--~~~---~--~~
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: Element placeholder help

2009-01-25 Thread Braindead

Hi Dave,

you could select the element to show based on the controller and / or
action that is currently used.
$this->params['controller'] and $this->params['action'] should help
you in your view.

Markus

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



Validating the value of a selectboxes to be in a dynamic list

2009-01-25 Thread Braindead

Hi everyone,

I'm searching for a way to validate selectboxes. I'm using the
SecurityComponent and Cake 1.2.

Let's assume I want to write an article. The article belongs to one
category and the categories are stored in my database and therefore
dynamic.

So I have a selectbox on my form for the category. The values are
retrieved with a simple
$this->News->Category->find('list');

Validating the category only to be a number is not enough, as the
attacker could submit a number, that is not part of one of my
categories.

I thought about using the build-in "inList" rule, but how do I tell
cake to use my category list?

Thanks for your help!
Markus
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Validation error messages of related model are not shown

2009-01-15 Thread Braindead

I have a view were I show a news and it's related comments.
There is also a form in the view where the user can enter a new
comment.

I want to save the new comment in the news controller comment action,
because I don't want to use a comments controller.

Everything works well except the fact that the validation error
messages are not shown, but the validation works as expected. So when
I fill both fields the data is saved. If one or both fields are left
blank, the data is not saved and the form is shown agaib. But there
are no error messages.

I asked google and tried several things over the whole day, but
nothing helped. So any help is highly appreciated. :-)


That is the code I use to generate the form:

create(
null,
array(
'url' => array(
'controller' => 'news',
'action' => 'comment'
)
)
);
echo $form->input(
'Comment.foreign_id',
array(
'type' => 'hidden',
'value' => $the_news['News']['id']
)
);
echo $form->input(
'Comment.nickname',
array(
'label' => 'Nickname:',
'error' => 'This field cannot be left blank.'
)
);
echo $form->input(
'Comment.text',
array(
'label' => 'Text:',
'error' => 'This field cannot be left blank.'
)
);
echo $form->end('Abschicken');
?>


This is the code of my comment action:

function comment() {
if(!empty($this->data)) {
if ($this->News->Comment->save($this->data)) {
// Message for the user
$this->flash(
'The comment was saved..',
array(
'controller' => 'news',
'action' => 'view',
$this->data['Comment']['foreign_id']
),
2
);
} else {
// Get the news to show the title when a validation error
occurs
$the_news = $this->News->find(
'first',
array(
'conditions' => array(
'News.id' => $this->data['Comment']
['foreign_id']
),
'recursive' => 1
)
);

$this->set('the_news', $the_news);
}
}
}


--~--~-~--~~~---~--~~
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: How to validate this?

2008-09-25 Thread Braindead

Hi Günther,

just in case you haven't already solved this problem, the following
link to the bakery should lead you 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
> 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 the profile-field "foo".
> Users in group "2" have to enter data for the profile-field "bar".
> Users in group "1" don't even see the form field "bar".
> Users in group "2" don't even see the form field "foo".
>
> If I'm not mistaken, custom validation rules are only triggered if the
> field exists in the form data.
> So, if a user from group "1" fumbles around with the form and sends it
> without the "foo"-field, my custom validation would not work. Right?
>
> How would you set up the validation rules for this, especially the part
> that the fields are required only for users in some groups?
>
> Regards
> Guenther
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Localizing autherror and loginerror

2008-09-11 Thread Braindead

Hi guys,

after spending some more time I solved my problem with authError and
loginError messages of the Auth component only displaying in the
default language.
Just in case somebody has the same problem I post the solution. :-)

This is my app_controller.php file where only the L10n part and the
messages are of interest:


uses('L10n');

class AppController extends Controller {
var $components = array('Auth');

function beforeFilter() {
$this->L10n = new L10n();
$this->L10n->get($this->Session->read('Config.language'));


if (isset($this->Auth)) {
$this->Auth->fields = array('username' => 'email', 
'password' =>
'password');
$this->Auth->userScope = array('activated' => 1);
$this->Auth->loginAction = array('controller' => 
'users', 'action'
=> 'login');
$this->Auth->loginRedirect = array('controller' => 
'pages',
'action' => 'display', 'home');
$this->Auth->logoutRedirect = array('controller' => 
'users',
'action' => 'login', 'admin' => false);
$this->Auth->loginError = __('auth_loginerror', true);
$this->Auth->authError = __('auth_autherror', true);
$this->Auth->autoRedirect = true;
$this->Auth->authorize = 'controller';
}

}

function isAuthorized() {
return true;
}
}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterDelete question

2008-09-07 Thread Braindead

Hi,

there is no need to use the afterDelete event, because the delete
function of the model class gives a return value. Depending on the
return value you can set the flash message.
Pls. have a look at the API: 
http://api.cakephp.org/class_model.html#680f1a7876f7be4d87308d4df3252e77

I hope this helps.

Brain


On 7 Sep., 23:23, seanislegend <[EMAIL PROTECTED]> wrote:
> Hey,
>
> after I delete from a DB something I want to set a Flash message
> saying if it's successfully been deleted or if there was an error.
>
> I'm not sure how to implement this with afterDelete. Any ideas?
>
> Thanks.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Localizing autherror and loginerror

2008-09-07 Thread Braindead

Hi guys,

I'm currently localizing my application in English and German.
Everything works as expected. Except the authError and loginError
messages of the Auth component. I'm trying to set these messages in
the app_controller beforeFilter event. But the messages are always
shown in German (default language).

This is my beforeFilter code (excerpt):

function beforeFilter() {
 if (isset($this->Auth)) {
   $this->Auth->fields = array('username' => 'email', 'password' =>
'password');
   $this->Auth->userScope = array('activated' => 1);
   $this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
   $this->Auth->loginRedirect = array('controller' => 'pages',
'action' => 'display', 'home');
   $this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login', 'admin' => false);
   $this->Auth->loginError = __('auth_loginerror', true);
   $this->Auth->authError = __('auth_autherror', true);
   $this->Auth->autoRedirect = true;
   $this->Auth->authorize = 'controller';
 }
}

Can anybody help me to solve the problem?

Thanks,
Brain

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: User Management\Login\Auth Framework

2008-02-06 Thread Braindead

There is an article in the bakery about ACL. Maybe this is something
you are searching for?
http://bakery.cakephp.org/articles/view/acl-management-plugin

Hope this helps...
Markus
--~--~-~--~~~---~--~~
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: Independent Tab Component/Module?

2008-02-01 Thread Braindead

Why don't you use jQuery or any other JavaScript framework that
supports tabs?
I know they only work when JavaScript is enabled, but is there another
reason for you?

Happy baking,
Markus
--~--~-~--~~~---~--~~
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: Auth + ACL + Guests handling

2008-02-01 Thread Braindead

Instead of granting access to the guest group, you could define public
actions for each controller.

function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index', 'view');
}

would be the way to go.

Happy baking,
Markus
--~--~-~--~~~---~--~~
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: Yet another Auth and ACL question

2008-02-01 Thread Braindead

I think it is not right to be redirected to the referer page and
display the error message on the referer page. This is not what I
would expect when I try to access a certan page.
At first I wanted to be redirected to the login page, because I though
it is the right behavior to give the user the chance to login as
another user.
Now I changed my mind and hacked the auth.php so that it now splashes
the error message to the user (using $controller->flash), waits for 5
seconds and the redirects to the referer page. I think this is the way
for me to go.

Thanks for you help.

Markus


On Feb 1, 9:43 am, djiize <[EMAIL PROTECTED]> wrote:
> Why do you want to be redirected to login since you're already logged
> in?
--~--~-~--~~~---~--~~
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: Yet another Auth and ACL question

2008-01-29 Thread Braindead

That's what I already did. When I'm not logged in and want to enter an
access controlled controller, I'm redirected to $loginAction.
But how is it possible to be redirected to $loginAction, when I'm
already logged in, but not allowed to access a controller?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Yet another Auth and ACL question

2008-01-29 Thread Braindead

Hello group,

I'm using Auth and ACL in Cake 1.2. It took quite a long time to get
it to work, but now everything is working, except one thing:

When I'm logged in and try to access a controller I don't have access
to, I'm redirected to the url I came from and get the message that I'm
not allowed to access the controller. I would expect to be redirected
to the login page and see the error message.

Is there a way to achieve this or is this a normal Cake behavior?

Happy baking
Markus


--~--~-~--~~~---~--~~
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 Acl to display a user-specific menu

2008-01-16 Thread Braindead

On Jan 17, 1:47 am, Luke <[EMAIL PROTECTED]> wrote:
> like 3 different menu.ctp files (menu-admin.ctp, menu-manager.ctp, and
> menu-default.ctp) ?

Yes, thats what AD7six meant. :-)

--~--~-~--~~~---~--~~
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: Auth in 1.2

2008-01-16 Thread Braindead

On Jan 16, 5:51 am, Baz <[EMAIL PROTECTED]> wrote:
> Oooohh, that's something I forgot to put in my tutorial!
>
> The session messages for Auth aren't written to Message.flash, it's to
> Message.auth...
>


Baz,
I was searching for the reason that no auth errors are displayed for a
long time!
Thank you very much for your hint!

Markus
--~--~-~--~~~---~--~~
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: Badword Bahavior

2007-10-09 Thread Braindead

dardosordi, that is exactly the solution to my problem!
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
-~--~~~~--~~--~--~---



Re: Badword Bahavior

2007-10-08 Thread Braindead

I don't want to use the badword model in my controller. I want to use
it in a behavior. Are there any possibilities?


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



Badword Bahavior

2007-10-08 Thread Braindead

I'm trying to write a badword behavior for my guestbook, where a
guestbook entry has to be verified when one or more badwords are
detected inside the guestbook entry. My badwords are stored in a
database. The problem is how to query the badwords, when the current
model is the guestbook?

Is the only possibility something like

$badwords = $model->query('SELECT `entry` FROM `badwords` ORDER BY
`entry`');

or is there a more "cake-like" way?


--~--~-~--~~~---~--~~
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: Select only a few fields

2007-09-04 Thread Braindead

I've got it!

This is now part of my 'Comments' model.

var $belongsTo = array('Author' =>
   array('className'  => 'User',
 'conditions' => '',
 'order'  => '',
 'foreignKey' => 'user_id',
 'fields' => array('id',
'nickname')
   )
 );

After specifying the 'fields' parameter everything worked as expected.
Only id and nickname are selected.

Is this parameter new in Cake 1.2?

Markus


--~--~-~--~~~---~--~~
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: Select only a few fields

2007-09-04 Thread Braindead

Chris, thanks for the quick reply, but the problem is not to select
only a few fields from 'Post'. I want to select only a few fields from
'Comment Author' like nickname and id. I don't want fields like hash
and sault.

Please take a look at the data I receive from the query. I think this
should help to understand my problem.

Array
(
[Post] => Array
(
[id] => 14
[title] => TEST title
[content] => TEST content
[status] => draft
[created] => 2007-08-24 23:03:35
[modified] => 2007-08-24 23:09:31
)
[Comment] => Array
(
[0] => Array
(
[id] => 1
[user_id] => 1
[content] => The first test
[created] => 2007-09-04 21:46:23
[modified] => 2007-09-04 21:46:23
[Author] => Array
(
    [id] => 1
[nickname] => Braindead
[hash] => ***this is the hash***
[salt] => ***this is the salt***
[realname] => Markus
[description] => Test description
[created] => 2007-07-29 00:00:00
[modified] => 2007-08-18 12:15:48
)
)
)
)

Thanks,
Markus


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



Select only a few fields

2007-09-04 Thread Braindead

Hi,

I have a model 'posts'. 'Post' has and belongs to many 'Comment'.
'Comments' belongs to 'Author'. 'Author' comes from my model 'users'.
Everything is working fine. I can access the post, the comments and
the author information.

The only problem I have is the fact, that every single field from the
'users' model is accessible, including salt and hash of the login
password. I only want selected fields, like nickname and id. Is this
possible?

I tried thinks like 'Comment.Author.id' or 'Post.Comment.Author.id'
and several other things. Nothing worked. How to select only a few
fields?


This is an excerpt of the data I receive when I use $post-find(...).
Maybe this helps.

Array
(
[Post] => Array
(
[id] => 14
[title] => TEST title
[content] => TEST content
[status] => draft
[created] => 2007-08-24 23:03:35
[modified] => 2007-08-24 23:09:31
)
[Comment] => Array
(
[0] => Array
(
[id] => 1
[user_id] => 1
[content] => The first test
[created] => 2007-09-04 21:46:23
[modified] => 2007-09-04 21:46:23
    [Author] => Array
(
[id] => 1
[nickname] => Braindead
[hash] => ***this is the hash***
[salt] => ***this is the salt***
[realname] => Markus
[description] => Test description
[created] => 2007-07-29 00:00:00
[modified] => 2007-08-18 12:15:48
)
)
)
)


Regards,
Markus


--~--~-~--~~~---~--~~
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: Storing Site Preferences

2007-08-21 Thread Braindead

Thanks for the link. After searching the Bakery I found the tutorial
for the component:
http://bakery.cakephp.org/articles/view/confcomponent-db-based-configuration-tutorial

Brain


--~--~-~--~~~---~--~~
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: Storing Site Preferences

2007-08-21 Thread Braindead

I'm currently also using a seperate file to store the configuration.
But I would prefer to store it in my database.

Where is the best place to query the database for the settings? When
the bootstrap.php is executed, the models are not yet available. Do I
have to use beforeFilter in every controller to query the database? Or
is there a better way?

Regards,
Brain



--~--~-~--~~~---~--~~
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 set title of home page that doesn't have a controller? (../views/pages/home.thtml)

2007-08-06 Thread Braindead

You can set the title of the page inside the page. Just enter $this-
>pageTitle = '' on top of the page.


--~--~-~--~~~---~--~~
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: post title as parameter for view action... how?

2007-07-23 Thread Braindead

> I can add another attribute to the Posts table, "url_title" for
> example, and then, when i add a Post, fill it with the title with
> white spaces string replaced to  '-'.
>
> I was looking for a clean solution to string replace the white spaces,
> directly from $html-link() call.

Felix Geisendörfer wrote a nice article: Title to url slug conversion.
http://www.thinkingphp.org/2006/10/19/title-to-url-slug-conversion/

That should solve your problem.

Regards,
Brain
--
http://braindead1.de - My german blog


--~--~-~--~~~---~--~~
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: Date format with $form->input

2007-07-20 Thread Braindead

> There is already a Enhancement ticket in the trac for this 
> athttps://trac.cakephp.org/ticket/2405(along with a few other dateTime
> enhancements).
>
> If you want it now you can apply the patch in the ticket.

Thanks for the link. The first attachment already includes a patch for
my problem. So I think there is no need to submit the patch again.


--~--~-~--~~~---~--~~
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: Date format with $form->input

2007-07-20 Thread Braindead

On Jul 20, 1:02 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
> It is possible, you misread what speccy was saying.  Use what you have
> and add a dateFormat key in the options array

I tried to add the dateFormat key yesterday before posting my question
and I tried it 2 minutes ago. Both times the selects were displayed in
MDY order. As I already wrote it is fixed to MDY according to the API.
I use Cake 1.2.0.5427alpha. Maybe it was possible to change via the
dateFormat key in a version prior 1.2.0.5427alpha?

How do I submit a change request to the Cake developers to change this
behaviour?

Geoff, my site will be used by an online gaming clan. The oldest
member they have is 50. And I don't think that there will be someone
older than 60. ;-)


--~--~-~--~~~---~--~~
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: Date format with $form->input

2007-07-19 Thread Braindead

I want to use $form->input with the type set to 'date'. The advantage
is, that it generates the select fields AND a label for the fields.
$form->dateTime does not generate the label.

My problem is, that I want to change the dateFormat to DMY. But I
think this is not possible, because the dateFormat is fixed. Is there
any chance to change the format?


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



Date format with $form->input

2007-07-19 Thread Braindead

I'm using Cake 1.2 and want to display some selects for date input.
This is my code:

input('User.birthday', array('type' => 'date',
'label' => 'Birthday', 'empty' => true, 'minYear' => date('Y')-60,
'maxYear' => date('Y')-15)); ?>

Is it possible to tell Cake to display the fields in DMY order instead
of MDY?

According to the API it seems to be fixed to MDY. Is that true? Are
there plans to make the date format flexible?

Regards,
Brain
--
http://braindead1.de - my german blog


--~--~-~--~~~---~--~~
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: Where to store the logic? V or C?

2007-07-12 Thread Braindead

Thanks for the answers. I never thought about putting this kind of
logic into the model. But Chris' recommendation with "Fat Models and
Skinny Controllers" makes sense to me. So I think I will take this
way. :-)


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



Where to store the logic? V or C?

2007-07-12 Thread Braindead

Hi,

I'm new to MVC development and at the moment I'm quiet unsure about V
and C.

Let's assume I have a list of users in which I want to display an
avatar next to each user. If the user has no avatar I want to display
the default one. Both, the user avatar and the default avatar, are
stored in the filesystem.

Here's my question: Where do I decide which avatar should be
displayed? Is it C because it's some kind of logic? Or is it V because
the avatar is part of the design?

I'm unsure, because both would work, but I want to use the "correct"
one.

Thanks,
Brain


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



  1   2   >