Database Date/Time Functions?

2009-08-18 Thread Elmo

I would like to use the built in database date/time functions as part
of a 'conditions'. How is this done?

i.e.: select foo from bar where created >= (NOW() - interval '7
days');

I tried: 'conditions'=>array('Bar.created' => ">= (NOW() - interval '7
days')") to no avail.

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



auto guest login .. Auth

2009-08-18 Thread Marojahan M.T. Sigiro
with Auth.. what should i do to create auto login mechanism for certain user
(e.g. guest)

anybody has an idea? since i'm still a newbie with cake

Thankyou

-- 
---
I Don't Know Who/What I Am Yet, But I Know Who/What I Am Not!
--
Marojahan M.T. Sigiro
maroja...@gmail.com
GTalk : marojahan
Y! : ojak_s
http://ojakaja.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: $form->input() help

2009-08-18 Thread Dr. Loboto

find('list', array ('fields' => array ('Course.id', 'Course.name',
'College.name'))) should provide array you need.
But you can convert your array by Set::combine($data, '{n}.Course.id',
'{n}.Course.name', '{n}.College.name')

On Aug 17, 10:02 pm, hymen breaker  wrote:
>  ok..so its my first time here..past few days ive been reading and
> coding with cakephp for my school_enrollment system project..now im
> stuck with this simple problem that i cant solve.4 hours of reading
> and rereading about some cakephp articles but still no luck.. so i
> think, you guys can be a really big help..here it goes:
> this is a result of find() method (2 joined tables):
> resulting array using (print_r):
>
> CODE
>
> Array (
> [0] => Array (
> [Course] => Array (
>  [id] => 1
>  [code] => BSCS
>  [name] => BACHELOR OF SCIENCE IN COMPUTER SCIENCE
>  [college_id] => 1
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 1
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 1 ) )
> [1] => Array (
> [Course] => Array (
>  [id] => 2
>  [code] => BSCOMENG
>  [name] => BACHELOR OF SCIENCE IN COMPUTER ENGINEERING
>  [college_id] => 2
>  [years] => 5
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 2
>  [code] => CEA
>  [name] => COLLEGE OF ENGINEERING AND ARCHITECHTURE
>  [campus_id] => 2 ) )
> [2] => Array (
> [Course] => Array (
>  [id] => 3
>  [code] => BSINT
>  [name] => BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
>  [college_id] => 1
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 1
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 1 ) )
> [3] => Array (
> [Course] => Array (
>  [id] => 4
>  [code] => BSCS
>  [name] => BACHELOR OF SCIENCE IN COMPUTER SCIENCE
>  [college_id] => 3
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 3
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 3 ) ) )
>
> so my problem is how can i display it on a select tag where [College]
> [name] is my optgroup label and my [Course][id] and [Course][name] as
> my key value pair options.. what i have right now only display 1
> array:
> PHP Code
> 
> echo $form->input('course_id', array('options' => array(
>                         $courses[1]['College']['name'] =>array(
>                             $courses[1]['Course']['id']=>$courses[1]
> ['Course']['name']
>                             )
>                         )
>                     )
>                     );
>
> ?>
>
> please help..thanx
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



If Auth isAuthorize() == false, how to redirect user?

2009-08-18 Thread zotium

When using the Auth->Authorize = 'controller' method of authorization,
and isAuthorized() returns false, how do you set the URL where the
user gets redirected?
--~--~-~--~~~---~--~~
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: webroot and htaccess

2009-08-18 Thread brian

Just remove the trailing slash from the rule:

RewriteCond %{REQUEST_URI} ^/forums(.*)$

On Tue, Aug 18, 2009 at 8:02 PM,
designv...@gmail.com wrote:
>
> Hi there,
>
> I have some forums in my webroot and have added the following to my
> htaccess:
>
>   RewriteCond %{REQUEST_URI} ^/forums/(.*)$
>   RewriteRule ^.*$ - [L]
>
> And this is fine if I type:
>
>  www.mydomain.com/forums/
>
> However if I dont put the trailing slash (www.mydomain.com/forums) I
> get redirected to:
>
>  www.mydomain.com/app/webroot/forums/
>
> Can anyone help with a quick fix or suggestion?
>
> TIA
>
> d.
>
>
> >
>

--~--~-~--~~~---~--~~
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: webroot and htaccess

2009-08-18 Thread MattyHead

you could write a second rewrite rule as a failover...   I can't write
it offhand (sorry -- just thinking conceptually) but basically, for
those that fail the /forums/ condition you do a /forums condition
which inserts / into the referred URL.

Am I off base?

On Tue, Aug 18, 2009 at 8:02 PM,
designv...@gmail.com wrote:
>
> Hi there,
>
> I have some forums in my webroot and have added the following to my
> htaccess:
>
>   RewriteCond %{REQUEST_URI} ^/forums/(.*)$
>   RewriteRule ^.*$ - [L]
>
> And this is fine if I type:
>
>  www.mydomain.com/forums/
>
> However if I dont put the trailing slash (www.mydomain.com/forums) I
> get redirected to:
>
>  www.mydomain.com/app/webroot/forums/
>
> Can anyone help with a quick fix or suggestion?
>
> TIA
>
> d.
>
>
> >
>

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



webroot and htaccess

2009-08-18 Thread designv...@gmail.com

Hi there,

I have some forums in my webroot and have added the following to my
htaccess:

   RewriteCond %{REQUEST_URI} ^/forums/(.*)$
   RewriteRule ^.*$ - [L]

And this is fine if I type:

 www.mydomain.com/forums/

However if I dont put the trailing slash (www.mydomain.com/forums) I
get redirected to:

 www.mydomain.com/app/webroot/forums/

Can anyone help with a quick fix or suggestion?

TIA

d.


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



Multi Sort with Paginator

2009-08-18 Thread aron

We have a unique case where we need to sort by two fields using the
built in paginator and sort .

ie. order by field1, field2

where field1 is always there and field2 is the set using the sort
buttons

ie.
sort('field1');?>

when the built in sort is set it wipes out the default sort of
field1.

Any thoughts on solving this with 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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n

2009-08-18 Thread Marcelo Andrade

On Tue, Aug 18, 2009 at 12:30 PM, RhythmicDevil wrote:
>
>(..)
> From what I have read I gather that I wrap all my strings in my views
> with __(). Create language directories in /app/locale like the
> following:
> /app/locale/
>              eng/
>                   LC_MESSAGES/
>               en_GB/
>                   LC_MESSAGES/
> Then I go to the console and run $cake i18n. I give that the path
> where the files I want to extract reside and then give it the path
> where I want it output the files. The paths I used were:
>
> /home/swright/vhosts/solowsc/app/views
> /home/swright/vhosts/solowsc/app/locale
>
> This created a file called default.pot in the following location:
> /home/swright/vhosts/solowsc/app/locale

You have to put the .po files into the LC_MESSAGES
directory for each language.


> Thats about as far as I get. I have no idea what to do with the
> created file. Where do the .po and .mo files come in? Do I have to
> create them? I also would have thought that the output path should
> have been a particular language directory. I get the impression from
> what I have read that the translation and file creation is an
> automated process, is that correct?

All you have to do to create the files is enclose your
i18n string messages with the __() function.  Then,
running cake i18n from console, you'll have a default
language version .po file.  Then copy it to the other
LC_MESSAGES language directory and make the
translations (with poEdit or a plain text editor).

CakePHP uses the .po files to generate (compile) the
.mo files internally.  You don't have to deal with it.


> I have a basic test working but the files are hand created and I dont
> think thats the correct way to do it. I would really appreciate if
> someone could fill in the holes with, perhaps, a set of detailed steps
> what will work for CakePHP1.2.

Well...  I did an i18n application with Cake sometime
ago and I didn't dive into problems.  It was an easy
job.  Check this tips and read the cookboo too and
tell us if you're still getting into problems.

http://book.cakephp.org/view/161/Internationalization-Localization

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.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: $this->Auth->user() <- update the data

2009-08-18 Thread Miles J

Here you go: http://www.milesj.me/blog/read/31/Refreshing-The-Auths-Session
--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread Rich

Ok, I narrowed it done to this line: ${$class} =& new $class
($settings); inside class_registry.php. I think it is failing when it
tries to load the class for the model, as we thought. Now I have to
try figure out why.Oh, and brian, I appreciate the response. That
controller I posted above is literally the only thing that has been
added to the app, considering I am trying to figure out why this thing
is going crazy. I appreciate your help.

On Aug 18, 2:31 pm, brian  wrote:
> I don't think it's the Cake files. I don't have any idea what it might
> be. My point is that you need to find out where your app is croaking.
> It *seems* to be related to the controller loading the models, so that
> would be a good place to start. Otherwise, I doubt you're going to get
> any other clues from the list as you haven't posted any code.
>
> On Tue, Aug 18, 2009 at 2:13 PM, Rich wrote:
>
> > I'll try, but remember that this application is working on my local
> > development server. I can pull it up and  us it just fine. The one
> > that is not working is on a Debian Linux, while the one that works is
> > on a Windows WAMP install. I highly doubt cake's libraries are broken,
> > but I will try.
>
> > On Aug 18, 1:59 pm, brian  wrote:
> >> This is why I suggested debugging what's happening in loadModel().
> >> Have a look at Controller (in cake/libs) to see what's happening when
> >> it's first instantiated. One of the things that happens is that the
> >> $uses array is checked for models and those are loaded. Put some
> >> debugging lines in there to log what's happening. Eventually, you'll
> >> narrow it down somewhat.
>
> >> On Tue, Aug 18, 2009 at 1:36 PM, Rich wrote:
>
> >> > Ok, for example sake, I created a test controller, and what do you
> >> > know, it does exactly the same thing as my other controller. Now I
> >> > purposefully left out a model and view, just so I know that I am
> >> > getting a true blank page. There should be all kinds of Cake Errors,
> >> > but all I get is a blank page. Here is the contorller:
> >> > 
> >> > 
> >> > class TesterController extends AppController
> >> > {
> >> >  var $name = 'Tester';
>
> >> >  var $uses = array(
> >> >    'TestModel'
> >> >  );
> >> > }
> >> > ?>
> >> > 
>
> >> > If you go to this controller in my fresh, brand new app, you get a
> >> > blank page. If you comment out one line, the 'TestModel' line
> >> > (rendering you an empty model array), it works. It doesn't matter what
> >> > name you give it, if the array has something in it, it comes back with
> >> > a blank page. Keep in mind there is not actually a model or view, so
> >> > there should be an error saying so, but there isn't.The only way I
> >> > have found to get something on the page besides not using a model, is
> >> > by erroring out php, IE causing PHP to have an error. Typing jibberish
> >> > in the middle of the file, or missing a semi-colon, or something like
> >> > that. As you see, this is a basic controller, and I have added nothing
> >> > else, the rest is a fresh cake install.
>
> >> > I have also tried various DB configs, with no change. No matter what I
> >> > do, I seem to get a blank page. I also can't do a Try-Catch or debug
> >> > simply because this is not happening inside a function, and PHP
> >> > doesn't allow you to use things like that outside functions. Hope this
> >> > helps describe the issue.
>
> >> > On Aug 18, 12:16 pm, brian  wrote:
> >> >> I'd make a backup of cake/libs/controller/controller.php then have a
> >> >> good look at loadModel(). Set debug = 2 and add some Debugger::log()
> >> >> statements here and there.
>
> >> >> Might you have a forgotten die() statement anywhere in your own code?
>
> >> >> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> >> >> > Ok, this is going to be a long post, so let me begin at when this all
> >> >> > started. This is a project for work, and what it essentially does is
> >> >> > generate reports using Cake and a PDF generator. Now, it is ready to
> >> >> > go live, and to get all that started we moved it to a dev server to
> >> >> > test it before we put it fully live. I had been developing the app on
> >> >> > my PC using WAMP for a while, inside a windows environment. The app
> >> >> > moved from my local development platform of WAMP on windows to a Linux
> >> >> > development server the company has.
>
> >> >> > As with any application, it never goes the way you want, but this time
> >> >> > is was completely weird what happened. After gettting all the basics
> >> >> > such as Mod Rewrite and whatnot to work, I noticed something. All you
> >> >> > every get was a blank page. Nothing, no body, no head, nothing. Like
> >> >> > any good developer, I checked all the logs. There are no errors in the
> >> >> > php log, no apache errors, not even anything out of the ordinary in
> >> >> > the Apache access log (typical mod rewrite access stuff was there).
>
> >> >> > So, I decided to go through my code, and I began commenting things
> >> 

Re: $this->Auth->user() <- update the data

2009-08-18 Thread brian

It's all in the regular PHP $_SESSION. You can modify
$_SESION['Auth']['User']['whatever'].

debug($_SESSION) to see the structure.

On Tue, Aug 18, 2009 at 2:14 PM, Andreas wrote:
>
> Hey all!
>
> I have a form, where the user can change his data, like first and last
> name. how can i update the data thats inside $this->Auth->user() after
> editing the model via the form? i dont want to logout and relogin the
> user again only to update the session data...
>
> is there an elegant way to do so?
>
> greets
> Andreas
>
> >
>

--~--~-~--~~~---~--~~
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: Fulltext Index with schema console

2009-08-18 Thread brian

This is a MySQL issue. Did you search first?
http://www.google.ca/search?q=used+in+key+specification+without+a+key+length

On Tue, Aug 18, 2009 at 12:05 PM, PaSToReT wrote:
>
> Hi!
>
> I have this table in mysql:
>
> CREATE TABLE `search_index` (
>  `id` int(11) NOT NULL auto_increment,
>  `association_key` varchar(36) collate utf8_unicode_ci NOT NULL,
>  `model` varchar(128) collate utf8_unicode_ci NOT NULL,
>  `data` longtext collate utf8_unicode_ci NOT NULL,
>  `created` datetime NOT NULL,
>  `modified` datetime NOT NULL,
>  PRIMARY KEY  (`id`),
>  KEY `association_key` (`association_key`,`model`),
>  FULLTEXT KEY `data` (`data`)
> ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
> COLLATE=utf8_unicode_ci;
>
> I have generated a schema.php with 'cake schema generate'.
> When I try to execute it ('cake schema run create') i get this error.
>
> search_index: 1170: BLOB/TEXT column 'data' used in key specification
> without a key length
>
> I know that it is because of the key length is not specified in the
> schema.php, but I don't know how to do it.
>
> Could anyone help me?
>
> Thanks a lot!
>
> >
>

--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread brian

I don't think it's the Cake files. I don't have any idea what it might
be. My point is that you need to find out where your app is croaking.
It *seems* to be related to the controller loading the models, so that
would be a good place to start. Otherwise, I doubt you're going to get
any other clues from the list as you haven't posted any code.

On Tue, Aug 18, 2009 at 2:13 PM, Rich wrote:
>
> I'll try, but remember that this application is working on my local
> development server. I can pull it up and  us it just fine. The one
> that is not working is on a Debian Linux, while the one that works is
> on a Windows WAMP install. I highly doubt cake's libraries are broken,
> but I will try.
>
> On Aug 18, 1:59 pm, brian  wrote:
>> This is why I suggested debugging what's happening in loadModel().
>> Have a look at Controller (in cake/libs) to see what's happening when
>> it's first instantiated. One of the things that happens is that the
>> $uses array is checked for models and those are loaded. Put some
>> debugging lines in there to log what's happening. Eventually, you'll
>> narrow it down somewhat.
>>
>> On Tue, Aug 18, 2009 at 1:36 PM, Rich wrote:
>>
>> > Ok, for example sake, I created a test controller, and what do you
>> > know, it does exactly the same thing as my other controller. Now I
>> > purposefully left out a model and view, just so I know that I am
>> > getting a true blank page. There should be all kinds of Cake Errors,
>> > but all I get is a blank page. Here is the contorller:
>> > 
>> > >
>> > class TesterController extends AppController
>> > {
>> >  var $name = 'Tester';
>>
>> >  var $uses = array(
>> >    'TestModel'
>> >  );
>> > }
>> > ?>
>> > 
>>
>> > If you go to this controller in my fresh, brand new app, you get a
>> > blank page. If you comment out one line, the 'TestModel' line
>> > (rendering you an empty model array), it works. It doesn't matter what
>> > name you give it, if the array has something in it, it comes back with
>> > a blank page. Keep in mind there is not actually a model or view, so
>> > there should be an error saying so, but there isn't.The only way I
>> > have found to get something on the page besides not using a model, is
>> > by erroring out php, IE causing PHP to have an error. Typing jibberish
>> > in the middle of the file, or missing a semi-colon, or something like
>> > that. As you see, this is a basic controller, and I have added nothing
>> > else, the rest is a fresh cake install.
>>
>> > I have also tried various DB configs, with no change. No matter what I
>> > do, I seem to get a blank page. I also can't do a Try-Catch or debug
>> > simply because this is not happening inside a function, and PHP
>> > doesn't allow you to use things like that outside functions. Hope this
>> > helps describe the issue.
>>
>> > On Aug 18, 12:16 pm, brian  wrote:
>> >> I'd make a backup of cake/libs/controller/controller.php then have a
>> >> good look at loadModel(). Set debug = 2 and add some Debugger::log()
>> >> statements here and there.
>>
>> >> Might you have a forgotten die() statement anywhere in your own code?
>>
>> >> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>>
>> >> > Ok, this is going to be a long post, so let me begin at when this all
>> >> > started. This is a project for work, and what it essentially does is
>> >> > generate reports using Cake and a PDF generator. Now, it is ready to
>> >> > go live, and to get all that started we moved it to a dev server to
>> >> > test it before we put it fully live. I had been developing the app on
>> >> > my PC using WAMP for a while, inside a windows environment. The app
>> >> > moved from my local development platform of WAMP on windows to a Linux
>> >> > development server the company has.
>>
>> >> > As with any application, it never goes the way you want, but this time
>> >> > is was completely weird what happened. After gettting all the basics
>> >> > such as Mod Rewrite and whatnot to work, I noticed something. All you
>> >> > every get was a blank page. Nothing, no body, no head, nothing. Like
>> >> > any good developer, I checked all the logs. There are no errors in the
>> >> > php log, no apache errors, not even anything out of the ordinary in
>> >> > the Apache access log (typical mod rewrite access stuff was there).
>>
>> >> > So, I decided to go through my code, and I began commenting things
>> >> > out. The problem seemed to disappear if I commented out the $uses
>> >> > array, giving you basically: $uses = array(); Immediately, it became
>> >> > clear that something was wrong with one of my models. I commented out
>> >> > the model names in the $uses array one by one, and they all seemed to
>> >> > give me a blank page. It is crazy how you can comment out the models
>> >> > in your app and everything seems to work. No matter what model you
>> >> > use, they all cause a completely blank page. Just to be sure, however,
>> >> > I keep one model on and cleared out its contents, given me a blank
>> >> 

Contains and conditions gives rather unexpected results

2009-08-18 Thread channel5

Hi All

I am working through examples of containable and applying conditions
to the results.

I have a basic blog example running, where Posts can have many
comments.

I'm trying to use contain with conditions so I can pick out only posts
that have been commented on by a particular user.

Here is my test function from my controller:

function test() {
$result =  $this->Post->find('all',array('contain' => 
'Comment.name
= "Howard"'));
debug($result);
}

I would expect the debug output in my view to only contain Posts which
user Howard has commented on.. however here are the results I get:

Array
(
[0] => Array
(
[Post] => Array
(
[id] => 1
[name] => First post
[date] => 2009-08-13 15:01:00
[content] => This is our first blog post, how
exciting.
[user_id] => 1
)

[Comment] => Array
(
[0] => Array
(
[id] => 1
[name] => Howard
[content] => Lovely post, really lovely
post.
[post_id] => 1
)

)

)

[1] => Array
(
[Post] => Array
(
[id] => 2
[name] => Our second post
[date] => 2009-08-14 10:11:00
[content] => Our second post
[user_id] => 1
)

[Comment] => Array
(
)

)


So as you can see it is still returning ALL posts yet only attaching
comments if they were made by Howard.

This isn't the behaviour I was expecting, as the example code shown at
http://book.cakephp.org/view/474/Containable claims it should exclude
all Posts without comments by the specified user.

I am hoping someone can point me in the right direction here.

Thanks
c5

--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread Rich

I'll try, but remember that this application is working on my local
development server. I can pull it up and  us it just fine. The one
that is not working is on a Debian Linux, while the one that works is
on a Windows WAMP install. I highly doubt cake's libraries are broken,
but I will try.

On Aug 18, 1:59 pm, brian  wrote:
> This is why I suggested debugging what's happening in loadModel().
> Have a look at Controller (in cake/libs) to see what's happening when
> it's first instantiated. One of the things that happens is that the
> $uses array is checked for models and those are loaded. Put some
> debugging lines in there to log what's happening. Eventually, you'll
> narrow it down somewhat.
>
> On Tue, Aug 18, 2009 at 1:36 PM, Rich wrote:
>
> > Ok, for example sake, I created a test controller, and what do you
> > know, it does exactly the same thing as my other controller. Now I
> > purposefully left out a model and view, just so I know that I am
> > getting a true blank page. There should be all kinds of Cake Errors,
> > but all I get is a blank page. Here is the contorller:
> > 
> > 
> > class TesterController extends AppController
> > {
> >  var $name = 'Tester';
>
> >  var $uses = array(
> >    'TestModel'
> >  );
> > }
> > ?>
> > 
>
> > If you go to this controller in my fresh, brand new app, you get a
> > blank page. If you comment out one line, the 'TestModel' line
> > (rendering you an empty model array), it works. It doesn't matter what
> > name you give it, if the array has something in it, it comes back with
> > a blank page. Keep in mind there is not actually a model or view, so
> > there should be an error saying so, but there isn't.The only way I
> > have found to get something on the page besides not using a model, is
> > by erroring out php, IE causing PHP to have an error. Typing jibberish
> > in the middle of the file, or missing a semi-colon, or something like
> > that. As you see, this is a basic controller, and I have added nothing
> > else, the rest is a fresh cake install.
>
> > I have also tried various DB configs, with no change. No matter what I
> > do, I seem to get a blank page. I also can't do a Try-Catch or debug
> > simply because this is not happening inside a function, and PHP
> > doesn't allow you to use things like that outside functions. Hope this
> > helps describe the issue.
>
> > On Aug 18, 12:16 pm, brian  wrote:
> >> I'd make a backup of cake/libs/controller/controller.php then have a
> >> good look at loadModel(). Set debug = 2 and add some Debugger::log()
> >> statements here and there.
>
> >> Might you have a forgotten die() statement anywhere in your own code?
>
> >> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> >> > Ok, this is going to be a long post, so let me begin at when this all
> >> > started. This is a project for work, and what it essentially does is
> >> > generate reports using Cake and a PDF generator. Now, it is ready to
> >> > go live, and to get all that started we moved it to a dev server to
> >> > test it before we put it fully live. I had been developing the app on
> >> > my PC using WAMP for a while, inside a windows environment. The app
> >> > moved from my local development platform of WAMP on windows to a Linux
> >> > development server the company has.
>
> >> > As with any application, it never goes the way you want, but this time
> >> > is was completely weird what happened. After gettting all the basics
> >> > such as Mod Rewrite and whatnot to work, I noticed something. All you
> >> > every get was a blank page. Nothing, no body, no head, nothing. Like
> >> > any good developer, I checked all the logs. There are no errors in the
> >> > php log, no apache errors, not even anything out of the ordinary in
> >> > the Apache access log (typical mod rewrite access stuff was there).
>
> >> > So, I decided to go through my code, and I began commenting things
> >> > out. The problem seemed to disappear if I commented out the $uses
> >> > array, giving you basically: $uses = array(); Immediately, it became
> >> > clear that something was wrong with one of my models. I commented out
> >> > the model names in the $uses array one by one, and they all seemed to
> >> > give me a blank page. It is crazy how you can comment out the models
> >> > in your app and everything seems to work. No matter what model you
> >> > use, they all cause a completely blank page. Just to be sure, however,
> >> > I keep one model on and cleared out its contents, given me a blank
> >> > model, it still gave me a blank page.
>
> >> > I have spent the better part of a week trying to fix this issue,
> >> > spending most of that time trying various "blank page" fixes around
> >> > the internet, both php and cakephp solution. Here are just some of the
> >> > solutions I tried:
>
> >> > -Deleted all the App Cahce in the Cake App Cache Folder
> >> > -Checked every file for space after the PHP tags
> >> > -Checked all the logs for errors: PHP, Cake, and Apache show nothin

$this->Auth->user() <- update the data

2009-08-18 Thread Andreas

Hey all!

I have a form, where the user can change his data, like first and last 
name. how can i update the data thats inside $this->Auth->user() after 
editing the model via the form? i dont want to logout and relogin the 
user again only to update the session data...

is there an elegant way to do so?

greets
Andreas

--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread Rich

I'll try, but remember that this application is working on my local
development server. I can pull it up and  us it just fine. The one
that is not working is on a Debian Linux, while the one that works is
on a Windows WAMP install. I highly doubt cake's libraries are broken,
but I will try.

On Aug 18, 1:59 pm, brian  wrote:
> This is why I suggested debugging what's happening in loadModel().
> Have a look at Controller (in cake/libs) to see what's happening when
> it's first instantiated. One of the things that happens is that the
> $uses array is checked for models and those are loaded. Put some
> debugging lines in there to log what's happening. Eventually, you'll
> narrow it down somewhat.
>
> On Tue, Aug 18, 2009 at 1:36 PM, Rich wrote:
>
> > Ok, for example sake, I created a test controller, and what do you
> > know, it does exactly the same thing as my other controller. Now I
> > purposefully left out a model and view, just so I know that I am
> > getting a true blank page. There should be all kinds of Cake Errors,
> > but all I get is a blank page. Here is the contorller:
> > 
> > 
> > class TesterController extends AppController
> > {
> >  var $name = 'Tester';
>
> >  var $uses = array(
> >    'TestModel'
> >  );
> > }
> > ?>
> > 
>
> > If you go to this controller in my fresh, brand new app, you get a
> > blank page. If you comment out one line, the 'TestModel' line
> > (rendering you an empty model array), it works. It doesn't matter what
> > name you give it, if the array has something in it, it comes back with
> > a blank page. Keep in mind there is not actually a model or view, so
> > there should be an error saying so, but there isn't.The only way I
> > have found to get something on the page besides not using a model, is
> > by erroring out php, IE causing PHP to have an error. Typing jibberish
> > in the middle of the file, or missing a semi-colon, or something like
> > that. As you see, this is a basic controller, and I have added nothing
> > else, the rest is a fresh cake install.
>
> > I have also tried various DB configs, with no change. No matter what I
> > do, I seem to get a blank page. I also can't do a Try-Catch or debug
> > simply because this is not happening inside a function, and PHP
> > doesn't allow you to use things like that outside functions. Hope this
> > helps describe the issue.
>
> > On Aug 18, 12:16 pm, brian  wrote:
> >> I'd make a backup of cake/libs/controller/controller.php then have a
> >> good look at loadModel(). Set debug = 2 and add some Debugger::log()
> >> statements here and there.
>
> >> Might you have a forgotten die() statement anywhere in your own code?
>
> >> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> >> > Ok, this is going to be a long post, so let me begin at when this all
> >> > started. This is a project for work, and what it essentially does is
> >> > generate reports using Cake and a PDF generator. Now, it is ready to
> >> > go live, and to get all that started we moved it to a dev server to
> >> > test it before we put it fully live. I had been developing the app on
> >> > my PC using WAMP for a while, inside a windows environment. The app
> >> > moved from my local development platform of WAMP on windows to a Linux
> >> > development server the company has.
>
> >> > As with any application, it never goes the way you want, but this time
> >> > is was completely weird what happened. After gettting all the basics
> >> > such as Mod Rewrite and whatnot to work, I noticed something. All you
> >> > every get was a blank page. Nothing, no body, no head, nothing. Like
> >> > any good developer, I checked all the logs. There are no errors in the
> >> > php log, no apache errors, not even anything out of the ordinary in
> >> > the Apache access log (typical mod rewrite access stuff was there).
>
> >> > So, I decided to go through my code, and I began commenting things
> >> > out. The problem seemed to disappear if I commented out the $uses
> >> > array, giving you basically: $uses = array(); Immediately, it became
> >> > clear that something was wrong with one of my models. I commented out
> >> > the model names in the $uses array one by one, and they all seemed to
> >> > give me a blank page. It is crazy how you can comment out the models
> >> > in your app and everything seems to work. No matter what model you
> >> > use, they all cause a completely blank page. Just to be sure, however,
> >> > I keep one model on and cleared out its contents, given me a blank
> >> > model, it still gave me a blank page.
>
> >> > I have spent the better part of a week trying to fix this issue,
> >> > spending most of that time trying various "blank page" fixes around
> >> > the internet, both php and cakephp solution. Here are just some of the
> >> > solutions I tried:
>
> >> > -Deleted all the App Cahce in the Cake App Cache Folder
> >> > -Checked every file for space after the PHP tags
> >> > -Checked all the logs for errors: PHP, Cake, and Apache show nothin

ACO node being overridden by a node with the same name further down the tree

2009-08-18 Thread benjam

I have encountered what might be a bug in Cake.

I have an ACO tree that looks like the following:
controllers
- Events
-- admin_index
- Newsletters
-- events

When I try to access the admin index page for the Events controller, I
get an error stating that the ACL check failed.

After digging a bit into the ACO node function, I came up with the
following scenario:
on line 129 of cake/cake/libs/model/db_acl.php, the $result[0][$type]
['alias'] is returning 'Newsletter' (because it's lower in the tree),
and $path[count($path) - 1] is 'Events' (passed in)

This causes the whole thing to fail.

Basically, my question is this... is this a bug?  Or am I doing
something wrong?

And if it's a bug, can somebody who is/might be having the same issue
who can write test cases write one up so that a ticket can be
submitted (if it's not in there already)?

I am not sure of a fix, as I have not looked into that deeply, and I
can't write any test cases to submit a bug as I don't know how.
--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread brian

This is why I suggested debugging what's happening in loadModel().
Have a look at Controller (in cake/libs) to see what's happening when
it's first instantiated. One of the things that happens is that the
$uses array is checked for models and those are loaded. Put some
debugging lines in there to log what's happening. Eventually, you'll
narrow it down somewhat.

On Tue, Aug 18, 2009 at 1:36 PM, Rich wrote:
>
> Ok, for example sake, I created a test controller, and what do you
> know, it does exactly the same thing as my other controller. Now I
> purposefully left out a model and view, just so I know that I am
> getting a true blank page. There should be all kinds of Cake Errors,
> but all I get is a blank page. Here is the contorller:
> 
> 
> class TesterController extends AppController
> {
>  var $name = 'Tester';
>
>  var $uses = array(
>    'TestModel'
>  );
> }
> ?>
> 
>
> If you go to this controller in my fresh, brand new app, you get a
> blank page. If you comment out one line, the 'TestModel' line
> (rendering you an empty model array), it works. It doesn't matter what
> name you give it, if the array has something in it, it comes back with
> a blank page. Keep in mind there is not actually a model or view, so
> there should be an error saying so, but there isn't.The only way I
> have found to get something on the page besides not using a model, is
> by erroring out php, IE causing PHP to have an error. Typing jibberish
> in the middle of the file, or missing a semi-colon, or something like
> that. As you see, this is a basic controller, and I have added nothing
> else, the rest is a fresh cake install.
>
> I have also tried various DB configs, with no change. No matter what I
> do, I seem to get a blank page. I also can't do a Try-Catch or debug
> simply because this is not happening inside a function, and PHP
> doesn't allow you to use things like that outside functions. Hope this
> helps describe the issue.
>
> On Aug 18, 12:16 pm, brian  wrote:
>> I'd make a backup of cake/libs/controller/controller.php then have a
>> good look at loadModel(). Set debug = 2 and add some Debugger::log()
>> statements here and there.
>>
>> Might you have a forgotten die() statement anywhere in your own code?
>>
>> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>>
>> > Ok, this is going to be a long post, so let me begin at when this all
>> > started. This is a project for work, and what it essentially does is
>> > generate reports using Cake and a PDF generator. Now, it is ready to
>> > go live, and to get all that started we moved it to a dev server to
>> > test it before we put it fully live. I had been developing the app on
>> > my PC using WAMP for a while, inside a windows environment. The app
>> > moved from my local development platform of WAMP on windows to a Linux
>> > development server the company has.
>>
>> > As with any application, it never goes the way you want, but this time
>> > is was completely weird what happened. After gettting all the basics
>> > such as Mod Rewrite and whatnot to work, I noticed something. All you
>> > every get was a blank page. Nothing, no body, no head, nothing. Like
>> > any good developer, I checked all the logs. There are no errors in the
>> > php log, no apache errors, not even anything out of the ordinary in
>> > the Apache access log (typical mod rewrite access stuff was there).
>>
>> > So, I decided to go through my code, and I began commenting things
>> > out. The problem seemed to disappear if I commented out the $uses
>> > array, giving you basically: $uses = array(); Immediately, it became
>> > clear that something was wrong with one of my models. I commented out
>> > the model names in the $uses array one by one, and they all seemed to
>> > give me a blank page. It is crazy how you can comment out the models
>> > in your app and everything seems to work. No matter what model you
>> > use, they all cause a completely blank page. Just to be sure, however,
>> > I keep one model on and cleared out its contents, given me a blank
>> > model, it still gave me a blank page.
>>
>> > I have spent the better part of a week trying to fix this issue,
>> > spending most of that time trying various "blank page" fixes around
>> > the internet, both php and cakephp solution. Here are just some of the
>> > solutions I tried:
>>
>> > -Deleted all the App Cahce in the Cake App Cache Folder
>> > -Checked every file for space after the PHP tags
>> > -Checked all the logs for errors: PHP, Cake, and Apache show nothing
>> > - Tried CakePHP Testing, Didn't really work that well, or help me find
>> > an issue
>> > -Looked at Blank page tickets over at the CakePHP Trac and This google
>> > group
>> > -Searched Google for Blank Page solutions, went through pages upon
>> > pages with no solution
>>
>> > Now, keep in mind that I can get my app to show up as long as I don't
>> > use any models. As soon as I include a model with the $uses array, I
>> > get a blank page. It was suggested that

Re: Auth + HATM problem when want to read user details

2009-08-18 Thread Ace

I love You man!:D

I forgot to add   var $primaryKey = 'user_id'; in one class:D


On 18 Sie, 18:21, brian  wrote:
> Normally, with HABTM, you'd have these tables:
>
> users:
> id
> ...
>
> accounts:
> id
> ...
>
> accounts_users:
> account_id
> user_id
>
> I don't know if this is the reason for your trouble, but it's worth
> starting from what Cake expects and see if that resolves it.
>
> On Tue, Aug 18, 2009 at 8:09 AM, Ace wrote:
>
> > I have my users in standard users table. There is also an account
> > table. Every user can have many accounts (account is let's say a group
> > of premissions, like a role) and every account can have many users so
> > the relation is HABTM (there is a linking table - account_user_assoc).
> > When the user is being logged in I want to know what roles does he
> > have, but Account object is empty. Can anyone tell me what do I do
> > wrong?
>
> > Cake generates query without even mentioning the Accounts table:
>
> > SELECT `User`.`user_id`, `User`.`contact_name`,
> > `User`.`email_address`, `User`.`username`, `User`.`password`,
> > `User`.`language`, `User`.`default_account_id`, `User`.`comments`,
> > `User`.`active`, `User`.`sso_user_id`, `User`.`date_created`,
> > `User`.`date_last_login`, `User`.`email_updated` FROM `ox2_users` AS
> > `User` WHERE `User`.`username` = 'root' AND `User`.`password` =
> > '7a89a595cfc6de85480202a143e37d2e' LIMIT 1
>
> > Results:
> > Array ( [User] => Array ( [user_id] => 1 [contact_name] =>
> > Administrator [email_address] => t...@test.pl [username] => root
> > [password] => 7a89a595cfc6de85480202a143e37d2e [language] => pl
> > [default_account_id] => 2 [comments] => [active] => 1 [sso_user_id] =>
> > [date_created] => 2009-08-13 18:45:50 [date_last_login] => 2009-08-17
> > 14:33:27 [email_updated] => 2009-08-13 18:45:50 ) [Account] => Array
> > ( ) )
>
> > User model code:
>
> > class User extends AppModel {
> >    var $name = 'User';
> >    var $recursive=2;
> >     var $hasAndBelongsToMany = array(
> >  'Account' =>
> >        array(
> >  'className' => 'Account',
> >  'joinTable' => 'account_user_assoc',
> >             'foreignKey' => 'user_id',
> >  'associationForeignKey' => 'account_id',
> > 'unique' => true
> >        )
> >    );
> >    function hashPasswords($data){
> >        $data['User']['password']=md5($data['User']['password']);
> >        return $data;
> >    }
>
> > }
>
> > Accounts model:
>
> > class Account extends AppModel {
> >    var $name = 'Account';
> >    var $primaryKey = 'account_id';
> > }
--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread Rich

Ok, for example sake, I created a test controller, and what do you
know, it does exactly the same thing as my other controller. Now I
purposefully left out a model and view, just so I know that I am
getting a true blank page. There should be all kinds of Cake Errors,
but all I get is a blank page. Here is the contorller:




If you go to this controller in my fresh, brand new app, you get a
blank page. If you comment out one line, the 'TestModel' line
(rendering you an empty model array), it works. It doesn't matter what
name you give it, if the array has something in it, it comes back with
a blank page. Keep in mind there is not actually a model or view, so
there should be an error saying so, but there isn't.The only way I
have found to get something on the page besides not using a model, is
by erroring out php, IE causing PHP to have an error. Typing jibberish
in the middle of the file, or missing a semi-colon, or something like
that. As you see, this is a basic controller, and I have added nothing
else, the rest is a fresh cake install.

I have also tried various DB configs, with no change. No matter what I
do, I seem to get a blank page. I also can't do a Try-Catch or debug
simply because this is not happening inside a function, and PHP
doesn't allow you to use things like that outside functions. Hope this
helps describe the issue.

On Aug 18, 12:16 pm, brian  wrote:
> I'd make a backup of cake/libs/controller/controller.php then have a
> good look at loadModel(). Set debug = 2 and add some Debugger::log()
> statements here and there.
>
> Might you have a forgotten die() statement anywhere in your own code?
>
> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> > Ok, this is going to be a long post, so let me begin at when this all
> > started. This is a project for work, and what it essentially does is
> > generate reports using Cake and a PDF generator. Now, it is ready to
> > go live, and to get all that started we moved it to a dev server to
> > test it before we put it fully live. I had been developing the app on
> > my PC using WAMP for a while, inside a windows environment. The app
> > moved from my local development platform of WAMP on windows to a Linux
> > development server the company has.
>
> > As with any application, it never goes the way you want, but this time
> > is was completely weird what happened. After gettting all the basics
> > such as Mod Rewrite and whatnot to work, I noticed something. All you
> > every get was a blank page. Nothing, no body, no head, nothing. Like
> > any good developer, I checked all the logs. There are no errors in the
> > php log, no apache errors, not even anything out of the ordinary in
> > the Apache access log (typical mod rewrite access stuff was there).
>
> > So, I decided to go through my code, and I began commenting things
> > out. The problem seemed to disappear if I commented out the $uses
> > array, giving you basically: $uses = array(); Immediately, it became
> > clear that something was wrong with one of my models. I commented out
> > the model names in the $uses array one by one, and they all seemed to
> > give me a blank page. It is crazy how you can comment out the models
> > in your app and everything seems to work. No matter what model you
> > use, they all cause a completely blank page. Just to be sure, however,
> > I keep one model on and cleared out its contents, given me a blank
> > model, it still gave me a blank page.
>
> > I have spent the better part of a week trying to fix this issue,
> > spending most of that time trying various "blank page" fixes around
> > the internet, both php and cakephp solution. Here are just some of the
> > solutions I tried:
>
> > -Deleted all the App Cahce in the Cake App Cache Folder
> > -Checked every file for space after the PHP tags
> > -Checked all the logs for errors: PHP, Cake, and Apache show nothing
> > - Tried CakePHP Testing, Didn't really work that well, or help me find
> > an issue
> > -Looked at Blank page tickets over at the CakePHP Trac and This google
> > group
> > -Searched Google for Blank Page solutions, went through pages upon
> > pages with no solution
>
> > Now, keep in mind that I can get my app to show up as long as I don't
> > use any models. As soon as I include a model with the $uses array, I
> > get a blank page. It was suggested that it was linux being pick about
> > case sensitive files names, but if that was the case, then it would
> > never work.
>
> > I am also aware of using PDF generaters can cause blank pages, and
> > trust me, I know what and when to expect such a PDF error. I have been
> > working on this app for a couple of months, and with Cake longer than
> > that. This is something I have never seen before, and something I
> > can't seem to find anyone else having an issue with. The only time I
> > have ever seen a blank page like this is with Wordpress, and typically
> > that was because I had a space after the closing PHP tag.
>
> > I wish I could show you 

Fulltext Index with schema console

2009-08-18 Thread PaSToReT

Hi!

I have this table in mysql:

CREATE TABLE `search_index` (
  `id` int(11) NOT NULL auto_increment,
  `association_key` varchar(36) collate utf8_unicode_ci NOT NULL,
  `model` varchar(128) collate utf8_unicode_ci NOT NULL,
  `data` longtext collate utf8_unicode_ci NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `association_key` (`association_key`,`model`),
  FULLTEXT KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
COLLATE=utf8_unicode_ci;

I have generated a schema.php with 'cake schema generate'.
When I try to execute it ('cake schema run create') i get this error.

search_index: 1170: BLOB/TEXT column 'data' used in key specification
without a key length

I know that it is because of the key length is not specified in the
schema.php, but I don't know how to do it.

Could anyone help me?

Thanks a lot!

--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread Rich

You know brian, I don't have a single die() statement in my code. I
have gone through and created a Cake install from scratch, as in a
brand new copy of the newest cake. I added one controller of mine, and
I dont even get an error when I run the controller. No "No View for
this controller", no "Model Not Found", not even a "No index() method"
error. It is so weird. I appreciate the response, I really do. I will
try to go through and get some debugging done. I will post my results
if they are any better.

On Aug 18, 12:16 pm, brian  wrote:
> I'd make a backup of cake/libs/controller/controller.php then have a
> good look at loadModel(). Set debug = 2 and add some Debugger::log()
> statements here and there.
>
> Might you have a forgotten die() statement anywhere in your own code?
>
> On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> > Ok, this is going to be a long post, so let me begin at when this all
> > started. This is a project for work, and what it essentially does is
> > generate reports using Cake and a PDF generator. Now, it is ready to
> > go live, and to get all that started we moved it to a dev server to
> > test it before we put it fully live. I had been developing the app on
> > my PC using WAMP for a while, inside a windows environment. The app
> > moved from my local development platform of WAMP on windows to a Linux
> > development server the company has.
>
> > As with any application, it never goes the way you want, but this time
> > is was completely weird what happened. After gettting all the basics
> > such as Mod Rewrite and whatnot to work, I noticed something. All you
> > every get was a blank page. Nothing, no body, no head, nothing. Like
> > any good developer, I checked all the logs. There are no errors in the
> > php log, no apache errors, not even anything out of the ordinary in
> > the Apache access log (typical mod rewrite access stuff was there).
>
> > So, I decided to go through my code, and I began commenting things
> > out. The problem seemed to disappear if I commented out the $uses
> > array, giving you basically: $uses = array(); Immediately, it became
> > clear that something was wrong with one of my models. I commented out
> > the model names in the $uses array one by one, and they all seemed to
> > give me a blank page. It is crazy how you can comment out the models
> > in your app and everything seems to work. No matter what model you
> > use, they all cause a completely blank page. Just to be sure, however,
> > I keep one model on and cleared out its contents, given me a blank
> > model, it still gave me a blank page.
>
> > I have spent the better part of a week trying to fix this issue,
> > spending most of that time trying various "blank page" fixes around
> > the internet, both php and cakephp solution. Here are just some of the
> > solutions I tried:
>
> > -Deleted all the App Cahce in the Cake App Cache Folder
> > -Checked every file for space after the PHP tags
> > -Checked all the logs for errors: PHP, Cake, and Apache show nothing
> > - Tried CakePHP Testing, Didn't really work that well, or help me find
> > an issue
> > -Looked at Blank page tickets over at the CakePHP Trac and This google
> > group
> > -Searched Google for Blank Page solutions, went through pages upon
> > pages with no solution
>
> > Now, keep in mind that I can get my app to show up as long as I don't
> > use any models. As soon as I include a model with the $uses array, I
> > get a blank page. It was suggested that it was linux being pick about
> > case sensitive files names, but if that was the case, then it would
> > never work.
>
> > I am also aware of using PDF generaters can cause blank pages, and
> > trust me, I know what and when to expect such a PDF error. I have been
> > working on this app for a couple of months, and with Cake longer than
> > that. This is something I have never seen before, and something I
> > can't seem to find anyone else having an issue with. The only time I
> > have ever seen a blank page like this is with Wordpress, and typically
> > that was because I had a space after the closing PHP tag.
>
> > I wish I could show you some code, but being a work project, I don't
> > know how much I can show. Hopefully these descriptions help you. The
> > strangest thing is that I can type random gibberish in most of my
> > files and get a php error, indicating that php is still working. I
> > really stuck right now, so any suggestions would help a lot. I am not
> > a cake expert, but I am quite experienced in php and the web.
--~--~-~--~~~---~--~~
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: Add input field with jquery

2009-08-18 Thread brian

This is just off the top of my head:

function foo()
{
if (!empty($this->data)
{
$this->checkDynamicFields();

//...
}
//...
}


function checkDynamicFields()
{
$fields = array();

/* Go through $this->data looking for whatever dynamic fields
 * might be there. If found add its name & value to array.
 */
foreach($this->data['YOUR_MODEL'] as $key => $val)
{
if (IS_A_DYNAMIC_FIELD)
{
$fields[$key] = $val;
}
}
$this->set('dynamic_fields', $fields);
}

in the view:
if (isset($dynamic_fields) && isset($dynamic_fields['something']))
{
// create 'something' input


On Tue, Aug 18, 2009 at 12:01 PM, Luke wrote:
>
> Hi,
>
> I am having a form, where I want the User to be able to dynamically
> add input fields. I have found some jquery script to achieve this.
> Everything works fine, besides when I have a validation error and the
> Form needs to shown again, the new input field is gone.
>
> Does anyone got an idea how I could solve this? Thanks a lot.
>
> Luke
> >
>

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



Re: Auth + HATM problem when want to read user details

2009-08-18 Thread brian

Normally, with HABTM, you'd have these tables:

users:
id
...

accounts:
id
...

accounts_users:
account_id
user_id

I don't know if this is the reason for your trouble, but it's worth
starting from what Cake expects and see if that resolves it.

On Tue, Aug 18, 2009 at 8:09 AM, Ace wrote:
>
> I have my users in standard users table. There is also an account
> table. Every user can have many accounts (account is let's say a group
> of premissions, like a role) and every account can have many users so
> the relation is HABTM (there is a linking table - account_user_assoc).
> When the user is being logged in I want to know what roles does he
> have, but Account object is empty. Can anyone tell me what do I do
> wrong?
>
> Cake generates query without even mentioning the Accounts table:
>
> SELECT `User`.`user_id`, `User`.`contact_name`,
> `User`.`email_address`, `User`.`username`, `User`.`password`,
> `User`.`language`, `User`.`default_account_id`, `User`.`comments`,
> `User`.`active`, `User`.`sso_user_id`, `User`.`date_created`,
> `User`.`date_last_login`, `User`.`email_updated` FROM `ox2_users` AS
> `User` WHERE `User`.`username` = 'root' AND `User`.`password` =
> '7a89a595cfc6de85480202a143e37d2e' LIMIT 1
>
> Results:
> Array ( [User] => Array ( [user_id] => 1 [contact_name] =>
> Administrator [email_address] => t...@test.pl [username] => root
> [password] => 7a89a595cfc6de85480202a143e37d2e [language] => pl
> [default_account_id] => 2 [comments] => [active] => 1 [sso_user_id] =>
> [date_created] => 2009-08-13 18:45:50 [date_last_login] => 2009-08-17
> 14:33:27 [email_updated] => 2009-08-13 18:45:50 ) [Account] => Array
> ( ) )
>
> User model code:
>
> class User extends AppModel {
>    var $name = 'User';
>    var $recursive=2;
>     var $hasAndBelongsToMany = array(
>  'Account' =>
>        array(
>  'className' => 'Account',
>  'joinTable' => 'account_user_assoc',
>             'foreignKey' => 'user_id',
>  'associationForeignKey' => 'account_id',
> 'unique' => true
>        )
>    );
>    function hashPasswords($data){
>        $data['User']['password']=md5($data['User']['password']);
>        return $data;
>    }
>
> }
>
> Accounts model:
>
> class Account extends AppModel {
>    var $name = 'Account';
>    var $primaryKey = 'account_id';
> }
>
> >
>

--~--~-~--~~~---~--~~
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 a planner - calendar to integrate, please suggest

2009-08-18 Thread Brendon Kozlowski (Realm)

Why not simply use Google Calendar in your site itself?

http://simplepie.org/wiki/plugins/start
http://bakery.cakephp.org/articles/view/icalendar-event-generator
* http://britg.com/2008/07/07/using-the-zend-framework-in-cakephp/
<--- probably the most useful
http://www.hotscripts.com/listing/integrate-google-calendar-in-your-website-using-ajax/

I used the google terms: "cakephp 'google calendar' integrate
integration"

On Aug 18, 12:15 am, "adilraufk...@gmail.com" 
wrote:
> just a simple calendar... or atmost a week planner from dhtmlgoodies .
> i need one that resembles googlecalendar
>
> On Aug 17, 8:19 pm, AD7six  wrote:
>
>
>
> > On Aug 17, 10:35 am, "adilraufk...@gmail.com" 
> > wrote:
>
> > > I urgently need a weekly/monthly/daily planner similar to google
> > > calender to be integrated in my current project, please suggest that
> > > uses prototype etc.
>
> > What did urgently googling yield ;) ?- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Blank Page on Models

2009-08-18 Thread brian

I'd make a backup of cake/libs/controller/controller.php then have a
good look at loadModel(). Set debug = 2 and add some Debugger::log()
statements here and there.

Might you have a forgotten die() statement anywhere in your own code?

On Tue, Aug 18, 2009 at 9:20 AM, Rich wrote:
>
> Ok, this is going to be a long post, so let me begin at when this all
> started. This is a project for work, and what it essentially does is
> generate reports using Cake and a PDF generator. Now, it is ready to
> go live, and to get all that started we moved it to a dev server to
> test it before we put it fully live. I had been developing the app on
> my PC using WAMP for a while, inside a windows environment. The app
> moved from my local development platform of WAMP on windows to a Linux
> development server the company has.
>
> As with any application, it never goes the way you want, but this time
> is was completely weird what happened. After gettting all the basics
> such as Mod Rewrite and whatnot to work, I noticed something. All you
> every get was a blank page. Nothing, no body, no head, nothing. Like
> any good developer, I checked all the logs. There are no errors in the
> php log, no apache errors, not even anything out of the ordinary in
> the Apache access log (typical mod rewrite access stuff was there).
>
> So, I decided to go through my code, and I began commenting things
> out. The problem seemed to disappear if I commented out the $uses
> array, giving you basically: $uses = array(); Immediately, it became
> clear that something was wrong with one of my models. I commented out
> the model names in the $uses array one by one, and they all seemed to
> give me a blank page. It is crazy how you can comment out the models
> in your app and everything seems to work. No matter what model you
> use, they all cause a completely blank page. Just to be sure, however,
> I keep one model on and cleared out its contents, given me a blank
> model, it still gave me a blank page.
>
> I have spent the better part of a week trying to fix this issue,
> spending most of that time trying various "blank page" fixes around
> the internet, both php and cakephp solution. Here are just some of the
> solutions I tried:
>
> -Deleted all the App Cahce in the Cake App Cache Folder
> -Checked every file for space after the PHP tags
> -Checked all the logs for errors: PHP, Cake, and Apache show nothing
> - Tried CakePHP Testing, Didn't really work that well, or help me find
> an issue
> -Looked at Blank page tickets over at the CakePHP Trac and This google
> group
> -Searched Google for Blank Page solutions, went through pages upon
> pages with no solution
>
> Now, keep in mind that I can get my app to show up as long as I don't
> use any models. As soon as I include a model with the $uses array, I
> get a blank page. It was suggested that it was linux being pick about
> case sensitive files names, but if that was the case, then it would
> never work.
>
> I am also aware of using PDF generaters can cause blank pages, and
> trust me, I know what and when to expect such a PDF error. I have been
> working on this app for a couple of months, and with Cake longer than
> that. This is something I have never seen before, and something I
> can't seem to find anyone else having an issue with. The only time I
> have ever seen a blank page like this is with Wordpress, and typically
> that was because I had a space after the closing PHP tag.
>
> I wish I could show you some code, but being a work project, I don't
> know how much I can show. Hopefully these descriptions help you. The
> strangest thing is that I can type random gibberish in most of my
> files and get a php error, indicating that php is still working. I
> really stuck right now, so any suggestions would help a lot. I am not
> a cake expert, but I am quite experienced in php and the web.
> >
>

--~--~-~--~~~---~--~~
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: Certain strings crashing CakePHP - where do I look first?

2009-08-18 Thread Brendon Kozlowski (Realm)

I like archF6's suggestion, it's easy to test, and if it doesn't solve
it, continue from there.  It might work, it might not.  I don't think
a 500 server error would automatically redirect (but instead stop
execution).  Regardless, it's about a 20 second test.  With Dreamhost
I can enable/disable mod_security, I'm not sure if you would be able
to test that on your host or not.  To be clear - I don't know why
mod_security would mess with this, but it can't hurt to take a look if
you're able to make such changes.

On Aug 17, 11:23 am, technicaltitch  wrote:
> App was built Oct 2007 but it's taken the organization this long to
> find funding for someone to test and work on it, (hence I'm struggling
> to get my head round stuff again).
>
> I will have a go at creating a test subdirectory and adding that debug
> code- fantastic fantastic ideas thanks - probably blindingly obvious
> to PHPers but not to me (a decade working with C, Java and .NET but
> only ever used PHP on volunteer projects).
>
> Is it possible that a phpBB install may have had this as a side-
> effect? Ie, can filters be set up on all form input for a given space
> on a shared CPanel server?
>
> I have commented out my controller method and seen the error, so I'm
> assuming the redirect is called elsewhere, where do I put the redirect
> override code pls?
>
> As far as I can tell it isn't my code requesting the redirect but
> perhaps I'm missing something obvious? I commented out my controller
> method, route.php just has the default page specified. Tried debug
> level 1 and 2 and nothing is displayed about the error, or anything
> preceding the current page.
>
> Thanks SO much for your help - this is all so useful and despite my
> wandering off-subject, absolutely exactly how I hoped people would
> help me and I'm massively grateful,
> Chris
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Add input field with jquery

2009-08-18 Thread Luke

Hi,

I am having a form, where I want the User to be able to dynamically
add input fields. I have found some jquery script to achieve this.
Everything works fine, besides when I have a validation error and the
Form needs to shown again, the new input field is gone.

Does anyone got an idea how I could solve this? Thanks a lot.

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



Data Formatting Errors

2009-08-18 Thread Andy

Greetings, all,
 I'm working on a CMS based on CakePHP and I've been enjoying
working with Cake so far. However, I'm having some issues saving
information. My CMS has a normal post-oriented setup in which each
post can be related to multiple tags and multiple categories. I've set
up the associations correctly in the models and the views generated by
Bake seem to work fine.

However, I'm using a custom client and building my array inside the
client. The client has the capability of adding new tags to each post,
then saving the tags at the same time as the post. However, when I try
to save all the data, it fails to save either the categories or the
tags.

Here's an example of the array that the client generates:

[Post] => Array
(
[user_id] => 11
[posted] => 2009-08-18 10:20:00
[title] => This is a Great Post!
[comments_allowed] => 1
[media_id] => 1
[slug] => this-is-a-great-post
[seo_title] => SEO rocks.
[status] => 1
[created] => 2009-08-18 10:25:53
[id] => 2
[content] => whatever
)

[Category] => Array
(
[0] => Array
(
[id] => 1
[name] => Latest News
[slug] => news
)

[1] => Array
(
[id] => 3
[name] => Stuff
[slug] => stuff
)

)

[Tag] => Array
(
[0] => Array
(
[id] => 3
[name] => college
[slug] => college
)

[1] => Array
(
[name] => snap
[slug] => snap
)

[2] => Array
(
[name] => fish
[slug] => fish
)

)

Right now I'm passing this into Cake and doing a saveAll() call. It
saves the post correctly, but erases all related tags and categories.
Would you all have any comments or suggestions on what I need to do to
get this working correctly? Thanks for your time!

~Andy

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



i18n

2009-08-18 Thread RhythmicDevil

Hello,
I am having some trouble understanding exactly how to use i18n. I have
tried a couple of different things and its basically working but I am
still really sketchy on the details and cannot seem to find a
definitive source on what exactly I am supposed to do.

Using CakePHP Console

>From what I have read I gather that I wrap all my strings in my views
with __(). Create language directories in /app/locale like the
following:
/app/locale/
  eng/
   LC_MESSAGES/
   en_GB/
   LC_MESSAGES/
Then I go to the console and run $cake i18n. I give that the path
where the files I want to extract reside and then give it the path
where I want it output the files. The paths I used were:

/home/swright/vhosts/solowsc/app/views
/home/swright/vhosts/solowsc/app/locale

This created a file called default.pot in the following location:
/home/swright/vhosts/solowsc/app/locale

Thats about as far as I get. I have no idea what to do with the
created file. Where do the .po and .mo files come in? Do I have to
create them? I also would have thought that the output path should
have been a particular language directory. I get the impression from
what I have read that the translation and file creation is an
automated process, is that correct?

Using PoEdit
I created some files manually and edited them using PoEdit. This
created a .po and a .mo file. However I am still very unclear on the
relationships of all these moving parts.

I have a basic test working but the files are hand created and I dont
think thats the correct way to do it. I would really appreciate if
someone could fill in the holes with, perhaps, a set of detailed steps
what will work for CakePHP1.2.

Thanks
Steve

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



HABTM problem

2009-08-18 Thread Ace

I have standard users table. Every user can have many accounts
(account is a group of permissions, like a role) and every account can
be linked to many users. Relation is HABTM as you can see. When I
call:

$accounts=$this->User->find('first', array('conditions' => array
('User.user_id' => 1)));

i get:

Array ( [User] => Array ( [user_id] => 1 [contact_name] =>
Administrator [email_address] => t...@test.pl [username] => root
[password] => 7a89a595cfcjeb85480202a143e37d2e [language] => pl
[default_account_id] => 2 [comments] => [active] => 1 [sso_user_id] =>
[date_created] => 2009-08-13 18:45:50 [date_last_login] => 2009-08-17
14:33:27 [email_updated] => 2009-08-13 18:45:50 ) [Account] => Array
( ) )

Account array is empty. SQL generated by cake doesn't even mention
accounts or account_user_assoc table:

SELECT `User`.`user_id`, `User`.`contact_name`,
`User`.`email_address`, `User`.`username`, `User`.`password`,
`User`.`language`, `User`.`default_account_id`, `User`.`comments`,
`User`.`active`, `User`.`sso_user_id`, `User`.`date_created`,
`User`.`date_last_login`, `User`.`email_updated` FROM `ox2_users` AS
`User` WHERE `User`.`user_id` = 1 LIMIT 1

Can anyone help me with this?

My User model code:

class User extends AppModel {
var $name = 'User';
var $recursive=1;
 var $hasAndBelongsToMany = array(
 'Account' =>
array(
 'className' => 'Account',
 'joinTable' => 'account_user_assoc',
 'foreignKey' => 'user_id',
 'associationForeignKey' => 'account_id',
'unique' => true
)
);
function hashPasswords($data){
$data['User']['password']=md5($data['User']['password']);
return $data;
}

}

Account model code:

class Account extends AppModel {
var $name = 'Account';
var $primaryKey = 'account_id';
}




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



Auth + HATM problem when want to read user details

2009-08-18 Thread Ace

I have my users in standard users table. There is also an account
table. Every user can have many accounts (account is let's say a group
of premissions, like a role) and every account can have many users so
the relation is HABTM (there is a linking table - account_user_assoc).
When the user is being logged in I want to know what roles does he
have, but Account object is empty. Can anyone tell me what do I do
wrong?

Cake generates query without even mentioning the Accounts table:

SELECT `User`.`user_id`, `User`.`contact_name`,
`User`.`email_address`, `User`.`username`, `User`.`password`,
`User`.`language`, `User`.`default_account_id`, `User`.`comments`,
`User`.`active`, `User`.`sso_user_id`, `User`.`date_created`,
`User`.`date_last_login`, `User`.`email_updated` FROM `ox2_users` AS
`User` WHERE `User`.`username` = 'root' AND `User`.`password` =
'7a89a595cfc6de85480202a143e37d2e' LIMIT 1

Results:
Array ( [User] => Array ( [user_id] => 1 [contact_name] =>
Administrator [email_address] => t...@test.pl [username] => root
[password] => 7a89a595cfc6de85480202a143e37d2e [language] => pl
[default_account_id] => 2 [comments] => [active] => 1 [sso_user_id] =>
[date_created] => 2009-08-13 18:45:50 [date_last_login] => 2009-08-17
14:33:27 [email_updated] => 2009-08-13 18:45:50 ) [Account] => Array
( ) )

User model code:

class User extends AppModel {
var $name = 'User';
var $recursive=2;
 var $hasAndBelongsToMany = array(
 'Account' =>
array(
 'className' => 'Account',
 'joinTable' => 'account_user_assoc',
 'foreignKey' => 'user_id',
 'associationForeignKey' => 'account_id',
'unique' => true
)
);
function hashPasswords($data){
$data['User']['password']=md5($data['User']['password']);
return $data;
}

}

Accounts model:

class Account extends AppModel {
var $name = 'Account';
var $primaryKey = 'account_id';
}

--~--~-~--~~~---~--~~
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: actual CakePHP books

2009-08-18 Thread FrederickD

Hopefully I don't get flamed for saying this... but "anders" has a
point. The senior contributors to this group already understand Cake,
possibly even contributing to the development of Cake or writing
articles on it. Thank you for your contributions!

That being said, there is a lot of misleading and conflicting
information about Cake out there. It takes hours to research a topic
(like how to use ExtJS with Cake) and then filter through the results
to make sure it is Cake 1.2 compatible and the code suggested actually
works. Often it does not, as comments to the posts frequently point
out. Yes, the API is a great resource as is the "book." When reading
those docs it helps to already understand some things about Cake. For
newcomers to Cake, perhaps coming to Cake with a lot of experience in
procedural languages but not OO languages, it is a daunting task to
learn what the official docs are explaining.

Add to this that not everyone learns the same way. It is a simple fact
that educators have begun to recognize over the last 10 to 15 years.
Different styles of learning need to accommodated. That's why there
are books, tutorials, articles, samples, even video tutorials now.

"[Write] some of your own stuff…" is good advice to contribute back to
the Cake community. However it is a 'chicken and egg' scenario.

When you read reviews about the available Cake books, there are some
comments that are quite critical indicating that the code in the book
is not correct. That's not good. I've found the style of the books
from Packt Publishing to be helpful to my style of learning. Their
book "CakePHP Application Development" presents theory first, what we
are going to do with it, the code, then a section "What just
happened?" That fits the classic model for teaching: tell them what
you are going to tell them, tell them, then tell them what you told
them. Ancient principle but it works.

After reading a book, plus countless hours researching and filtering
information from tutorials, I've found I tend to approach vague
awareness and then I am more equipped to understand what I read in the
API or official docs.

What was the catch line for X Files? "The truth is out there." Be
patient "anders" and you will slowly start to increase your fund of
knowledge about Cake.

On Aug 17, 10:58 am, thatsgreat2345  wrote:
> Read the API, don't like the docs? Right some of your own stuff if you
> believe you can present it clearer. But the API and Book are very nice
> and show everything that is needed.
>
> On Aug 17, 6:29 am, anders als  wrote:
>
> > hi there,
>
> > i like cake but my problem is finding ressources from which i can
> > learn.
>
> > The cake manual does not provide every data i need, and often i have
> > to test something 1000 times after shutting down my computer going
> > outside and yelling "** it does not work".
>
> > The problem is not the amount of information, it is the way how
> > information were present in the manual.
> > I look for code snippets and examples which aren't that much complex
> > AND which are up2date (1.2 - 1.3).
>
> > My next point is, that i can not find any book which is about cakephp
> > and is not older than 1 1/2 years :(
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Blank Page on Models

2009-08-18 Thread Rich

Ok, this is going to be a long post, so let me begin at when this all
started. This is a project for work, and what it essentially does is
generate reports using Cake and a PDF generator. Now, it is ready to
go live, and to get all that started we moved it to a dev server to
test it before we put it fully live. I had been developing the app on
my PC using WAMP for a while, inside a windows environment. The app
moved from my local development platform of WAMP on windows to a Linux
development server the company has.

As with any application, it never goes the way you want, but this time
is was completely weird what happened. After gettting all the basics
such as Mod Rewrite and whatnot to work, I noticed something. All you
every get was a blank page. Nothing, no body, no head, nothing. Like
any good developer, I checked all the logs. There are no errors in the
php log, no apache errors, not even anything out of the ordinary in
the Apache access log (typical mod rewrite access stuff was there).

So, I decided to go through my code, and I began commenting things
out. The problem seemed to disappear if I commented out the $uses
array, giving you basically: $uses = array(); Immediately, it became
clear that something was wrong with one of my models. I commented out
the model names in the $uses array one by one, and they all seemed to
give me a blank page. It is crazy how you can comment out the models
in your app and everything seems to work. No matter what model you
use, they all cause a completely blank page. Just to be sure, however,
I keep one model on and cleared out its contents, given me a blank
model, it still gave me a blank page.

I have spent the better part of a week trying to fix this issue,
spending most of that time trying various "blank page" fixes around
the internet, both php and cakephp solution. Here are just some of the
solutions I tried:

-Deleted all the App Cahce in the Cake App Cache Folder
-Checked every file for space after the PHP tags
-Checked all the logs for errors: PHP, Cake, and Apache show nothing
- Tried CakePHP Testing, Didn't really work that well, or help me find
an issue
-Looked at Blank page tickets over at the CakePHP Trac and This google
group
-Searched Google for Blank Page solutions, went through pages upon
pages with no solution

Now, keep in mind that I can get my app to show up as long as I don't
use any models. As soon as I include a model with the $uses array, I
get a blank page. It was suggested that it was linux being pick about
case sensitive files names, but if that was the case, then it would
never work.

I am also aware of using PDF generaters can cause blank pages, and
trust me, I know what and when to expect such a PDF error. I have been
working on this app for a couple of months, and with Cake longer than
that. This is something I have never seen before, and something I
can't seem to find anyone else having an issue with. The only time I
have ever seen a blank page like this is with Wordpress, and typically
that was because I had a space after the closing PHP tag.

I wish I could show you some code, but being a work project, I don't
know how much I can show. Hopefully these descriptions help you. The
strangest thing is that I can type random gibberish in most of my
files and get a php error, indicating that php is still working. I
really stuck right now, so any suggestions would help a lot. I am not
a cake expert, but I am quite experienced in php and the web.
--~--~-~--~~~---~--~~
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: Complex Find Conditions

2009-08-18 Thread Martin Westin

What if you ask the question naming the Models and associations
between them, and what you were expecting to get back as the result of
the query. Finds and conditions depend greatly on the associations
between the models involded. Some use joins, most do not and all that.

SQL syntax also looks like a mess after google has messed with it.
Starting with a query and trying to duplicate it is usually more
complex than working from the Cake point of view... at least when
trying to build a find.

I am guesssing, but I think your main problem might be that Cake does
very few joins by default.
For example:
Post hasMany Comment - a find where you contain the comments to those
by a certain commenter will return ALL Posts and all will contain the
Comment key in the array. Contain will only make sure that some
Comment keys are empty and some have comments by that one commenter.

With a join you were expecting to only get the Post that actually have
Comments by that commenter. Not so with containable, sorry.

If you need to force Cake to do joins you can still paginate if you
build something like what Nate wrote about in january:
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

I took some ideas from that and made a joining feature that would join
models for me when needed.
http://bin.cakephp.org/saved/49446

I have linked to these before but I think they are still valid
techniques in some cases.


Martin


On Aug 18, 12:08 pm, gjofum  wrote:
> I have no idea.
>
> I tried many things and nothing works.
> For exampple:
> $this->Item->find("all", array("fields" => array("Item.id",
> "Item.thumb"),
> "contain" => array(
>   "ItemContent" => array(
>           "conditions" => array("ItemContent.language_id" => 
> $this->language_id),
>
>           "fields" => array( "ItemContent.name",
> "ItemContent.description", "ItemContent.url")))
> ));
>
>  I'll have to use $this->Model->query() but then I won't be able to
> paginate it.
--~--~-~--~~~---~--~~
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: Routing with slugs.

2009-08-18 Thread Martin Westin


You should be alright with something like:

Router::connect('/optimised_category_name/*', array('controller' =>
'controller_from_cake', 'action' => 'view'));

Anything beginning with desired controller name is routed to the view
action. You would also need to add specific routes (above that one)
for any edit, delete.. and so on.



On Aug 18, 2:25 pm, Taff  wrote:
> Hey Martin,
>
> thanks for the reply. That is currently how I have it working. My
> intention is to do away with the view part of the URL to all intensive
> purposes so that an call to
>
> controller/slug
>
> actually reroutes to controller/view/slug
>
> The other issue was that I have rerouted my controller from its
> original name to something a little more search engine friendly.
>
> controller_from_cake/view/4
>
> to
>
> optimised_category_name/optimised_page_name/
>
> I have no need to visit the frontends controller_from_cakes other
> methods (just the view).
>
> Thanks again
> Taff
>
> On Aug 18, 1:49 pm, Martin Westin  wrote:
>
>
>
> > I should also say that the routing bit is useful as a first line of
> > defence against bad slugs.
>
> > On Aug 18, 12:46 pm, Taff  wrote:
>
> > > After reading throughhttp://book.cakephp.org/view/46/Routes-Configuration
> > > along withhttp://c7y.phparch.com/c/entry/1/art,cake-seoandpottering
> > > around for quite some time, I have come to the conclusion that I need
> > > some help. Here is the scenario:
>
> > > I am rerouting a controllername to a different name that is SEO
> > > friendlier:
>
> > > Router::connect('/consulting/:action/*', array('controller' =>
> > > 'consultingskills', 'action' => 'index'));
>
> > > This works just fine, and I can now go to site/consulting/view/4 and
> > > it will load the relevant information.
>
> > > How would I go about routing to make a URL such as site/consulting/seo
> > > redirect to site/consultingskills/view/4
>
> > > whereby id 4 in the database has a slug called "seo".
>
> > > I found a random post with
>
> > > Router::connect('/consultingskills/:slug',
> > >         array('controller' => 'consultingskills', 'action' => 'view'),
> > >         array('slug' => '[-_A-Za-z0-9]+')
> > >         );
>
> > > Can anyone walk me through what steps I need to take?
> > > Thanks,
> > > Taff
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



$paginator->hasNext bug?

2009-08-18 Thread Eddy Josafat

I use $paginator->hasNext() function in order to decide if application
shows $paginator->next link. It works properly, but when I set the
limit to 0 (showing all results in one page), hasNext returns true.

Is this a cakephp bug? Anyone has seen this issue?

--~--~-~--~~~---~--~~
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: Strange contain/find issue

2009-08-18 Thread MonkeyGirl

I believe this may be the same issue I'm experiencing.  After a bit of
investigation, I've found out the issue is that specifying "contain"
would appear to affect things in subsequent queries.

For example, say I have Cart hasMany CartedProduct belongsTo Product
belongsTo Brand.  Product also belongsTo VatRate.  (In other words,
CartedProduct is a linking table between Cart and Product.  It has a
quantity column, hence I'm not using hABTM.)  I might have a piece of
code like this, in a method of the Cart model:

// This is fine.  It displays products along with their brand.
$products = $this->CartedProduct->Product->find('all', array(
  'contain' => array(
'Brand'
  )
));

pr($products);

// This causes issues
$ignore = $this->find('first', array(
  'conditions' => array(
'Cart.id' => $cartID
  ),
  'contain' => array(
'CartedProduct.Product.VatRate' => array(
  'fields' => array(
'percentage'
  )
)
  )
));

// This is now broken.  The brand is no longer displayed.
$products = $this->CartedProduct->Product->find('all', array(
  'contain' => array(
'Brand'
  )
));

pr($products);

There are a few interesting things to note here:

Product is now broken, even though the query that broke it was
performed on Cart.

If I contain 'CartedProduct.Product.VatRate' then it's fine, but as
soon as I get as far as specifying its field, in this case
"percentage", it breaks.  This is regardless of whether I specify
'CartedProduct.Product.VatRate.percentage' or use the proper array-
based method above.

By "breaking", I specifically mean that any subsequent queries
regarding products will only show data that meet the contain criteria
above as well as any new contain criteria.

I would expect this from unbindModel() if I was telling it to remember
the unbinding, but I wouldn't expect it from a contain argument passed
to find().

I've checked, and yes, Product does still belongTo both Brand and
VatRate after the query.  A pr() of $this->CartedProduct->Product and
of $this (the Cart) show that both are identical before and after the
troublesome query.

Before anyone asks, I'm using CakePHP version 8166.

I've implemented a temporary workaround: because I know I want Brand
in a subsequent query, I'm including it in the contain in the query
that breaks the subsequent ones.  However, that's not a viable long-
term solution as I'm concerned that I may have some other piece of
code somewhere that thinks it's pulling out important data that it now
isn't.

Is this a bug?  should I go ahead and report it?
--~--~-~--~~~---~--~~
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: Routing with slugs.

2009-08-18 Thread Taff

Hey Martin,

thanks for the reply. That is currently how I have it working. My
intention is to do away with the view part of the URL to all intensive
purposes so that an call to

controller/slug

actually reroutes to controller/view/slug

The other issue was that I have rerouted my controller from its
original name to something a little more search engine friendly.

controller_from_cake/view/4

to

optimised_category_name/optimised_page_name/

I have no need to visit the frontends controller_from_cakes other
methods (just the view).

Thanks again
Taff

On Aug 18, 1:49 pm, Martin Westin  wrote:
> I should also say that the routing bit is useful as a first line of
> defence against bad slugs.
>
> On Aug 18, 12:46 pm, Taff  wrote:
>
> > After reading throughhttp://book.cakephp.org/view/46/Routes-Configuration
> > along withhttp://c7y.phparch.com/c/entry/1/art,cake-seoandpottering
> > around for quite some time, I have come to the conclusion that I need
> > some help. Here is the scenario:
>
> > I am rerouting a controllername to a different name that is SEO
> > friendlier:
>
> > Router::connect('/consulting/:action/*', array('controller' =>
> > 'consultingskills', 'action' => 'index'));
>
> > This works just fine, and I can now go to site/consulting/view/4 and
> > it will load the relevant information.
>
> > How would I go about routing to make a URL such as site/consulting/seo
> > redirect to site/consultingskills/view/4
>
> > whereby id 4 in the database has a slug called "seo".
>
> > I found a random post with
>
> > Router::connect('/consultingskills/:slug',
> >         array('controller' => 'consultingskills', 'action' => 'view'),
> >         array('slug' => '[-_A-Za-z0-9]+')
> >         );
>
> > Can anyone walk me through what steps I need to take?
> > Thanks,
> > Taff
--~--~-~--~~~---~--~~
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: blog tutorial + images

2009-08-18 Thread majna

http://bakery.cakephp.org/articles/search/tags/upload

look out for 1.2 cake version..

On Aug 18, 12:37 pm, "dole.doug"  wrote:
> Hi there
>
> I wish to enrich my application made starting from the blog tutorial.
> I wish to add a image field. I know that i have to add an $form->file
> (), but i don't know about what modification I have to made into the
> model.
>
> who can guide me into this or give me some links with samples?
>
> many 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing with slugs.

2009-08-18 Thread Martin Westin

I should also say that the routing bit is useful as a first line of
defence against bad slugs.



On Aug 18, 12:46 pm, Taff  wrote:
> After reading throughhttp://book.cakephp.org/view/46/Routes-Configuration
> along withhttp://c7y.phparch.com/c/entry/1/art,cake-seoand pottering
> around for quite some time, I have come to the conclusion that I need
> some help. Here is the scenario:
>
> I am rerouting a controllername to a different name that is SEO
> friendlier:
>
> Router::connect('/consulting/:action/*', array('controller' =>
> 'consultingskills', 'action' => 'index'));
>
> This works just fine, and I can now go to site/consulting/view/4 and
> it will load the relevant information.
>
> How would I go about routing to make a URL such as site/consulting/seo
> redirect to site/consultingskills/view/4
>
> whereby id 4 in the database has a slug called "seo".
>
> I found a random post with
>
> Router::connect('/consultingskills/:slug',
>         array('controller' => 'consultingskills', 'action' => 'view'),
>         array('slug' => '[-_A-Za-z0-9]+')
>         );
>
> Can anyone walk me through what steps I need to take?
> Thanks,
> Taff
--~--~-~--~~~---~--~~
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: Routing with slugs.

2009-08-18 Thread Martin Westin

if you are going for slugs with the controller prefixed (/consulting/
some_slug_of_mine) and not application-global slugs (/
a_globally_unique_slug) then you don't really have to do anything to
the routing settings.

I have just gone from a controller with:

function view($id) {
$this->data = $this->Model->findById($id);
}

to:

function view($slug) {
$this->data = $this->Model->findBySlug($slug);
}

Those were just a liiitle abbreviated. As long as the slugs are kept
unique you can treat them like the id in finds.




On Aug 18, 12:46 pm, Taff  wrote:
> After reading throughhttp://book.cakephp.org/view/46/Routes-Configuration
> along withhttp://c7y.phparch.com/c/entry/1/art,cake-seoand pottering
> around for quite some time, I have come to the conclusion that I need
> some help. Here is the scenario:
>
> I am rerouting a controllername to a different name that is SEO
> friendlier:
>
> Router::connect('/consulting/:action/*', array('controller' =>
> 'consultingskills', 'action' => 'index'));
>
> This works just fine, and I can now go to site/consulting/view/4 and
> it will load the relevant information.
>
> How would I go about routing to make a URL such as site/consulting/seo
> redirect to site/consultingskills/view/4
>
> whereby id 4 in the database has a slug called "seo".
>
> I found a random post with
>
> Router::connect('/consultingskills/:slug',
>         array('controller' => 'consultingskills', 'action' => 'view'),
>         array('slug' => '[-_A-Za-z0-9]+')
>         );
>
> Can anyone walk me through what steps I need to take?
> Thanks,
> Taff
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



blog tutorial + images

2009-08-18 Thread dole.doug

Hi there

I wish to enrich my application made starting from the blog tutorial.
I wish to add a image field. I know that i have to add an $form->file
(), but i don't know about what modification I have to made into the
model.

who can guide me into this or give me some links with samples?

many 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: saveAll() with $fieldList problem

2009-08-18 Thread MrMistral

Hi,
after some trial-and-error I found the solution (and simple of
course ... why did I spend so much time on that?!):
fields in fieldList must not contain the modelname (i.e. not
"model.field") but just the fieldnames of the models to be saved.
So in your case, jakobjp, your fieldList-Array should look like this:
array( "first_name", "last_name", "street", "city" ).
Additionally, equal fieldnames in different models do not matter.

--~--~-~--~~~---~--~~
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 a planner - calendar to integrate, please suggest

2009-08-18 Thread adilraufk...@gmail.com

just a simple calendar... or atmost a week planner from dhtmlgoodies .
i need one that resembles googlecalendar

On Aug 17, 8:19 pm, AD7six  wrote:
> On Aug 17, 10:35 am, "adilraufk...@gmail.com" 
> wrote:
>
> > I urgently need a weekly/monthly/daily planner similar to google
> > calender to be integrated in my current project, please suggest that
> > uses prototype etc.
>
> What did urgently googling yield ;) ?

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



HABTM Delete problem

2009-08-18 Thread Bryan Paddock
Hey all,
I'm having a strange problem - My HABTM relationship seems to be working out
alright except I cannot remove the last remaining entry.

This is the situation:

areas
channels
areas_channels

I have no problem in adding ares to channels. I can remove areas from
channels too... I just cannot remove the last area assigned to a channel.

I have:

$channel =

[Channel] => Array(
  [id], etc etc
)

[Area] => Array(
)

$this->Channel->save($channel);

And that saves without a problem except it does not remove all the areas
from that channel.

Is there something I am missing?

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



Routing with slugs.

2009-08-18 Thread Taff

After reading through http://book.cakephp.org/view/46/Routes-Configuration
along with http://c7y.phparch.com/c/entry/1/art,cake-seo and pottering
around for quite some time, I have come to the conclusion that I need
some help. Here is the scenario:

I am rerouting a controllername to a different name that is SEO
friendlier:

Router::connect('/consulting/:action/*', array('controller' =>
'consultingskills', 'action' => 'index'));

This works just fine, and I can now go to site/consulting/view/4 and
it will load the relevant information.

How would I go about routing to make a URL such as site/consulting/seo
redirect to site/consultingskills/view/4

whereby id 4 in the database has a slug called "seo".

I found a random post with

Router::connect('/consultingskills/:slug',
array('controller' => 'consultingskills', 'action' => 'view'),
array('slug' => '[-_A-Za-z0-9]+')
);

Can anyone walk me through what steps I need to take?
Thanks,
Taff
--~--~-~--~~~---~--~~
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: Admin Routing

2009-08-18 Thread DiRN

Check out http://book.cakephp.org/view/544/Prefix-Routing and
http://bakery.cakephp.org/articles/view/secrets-of-admin-routing.
--~--~-~--~~~---~--~~
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: Complex Find Conditions

2009-08-18 Thread gjofum

I have no idea.

I tried many things and nothing works.
For exampple:
$this->Item->find("all", array("fields" => array("Item.id",
"Item.thumb"),
"contain" => array(
  "ItemContent" => array(
  "conditions" => array("ItemContent.language_id" => $this-
>language_id),
  "fields" => array( "ItemContent.name",
"ItemContent.description", "ItemContent.url")))
));

 I'll have to use $this->Model->query() but then I won't be able to
paginate it.
--~--~-~--~~~---~--~~
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 i can use after properties in textarea.

2009-08-18 Thread arif hossen
Dear all,

How i can use after properties in textarea.

such as :below textfield after properties
echo $form->input('name',array('label'=>'name','after'=>'Must be 6
character'));

i need used it textarea field.
-- 


Regards,
Mohammad Arif Hossen
Web Developer
United Group International(UGIBD)
www.ugibd.net
Mobile no:  +88 01714355911
Mobile no:  +88 01922110308

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



Complex Find Conditions

2009-08-18 Thread gjofum

I don't know how to make my own sql code into Complex Find Conditions.
Especially with use of INNER JOIN or LEFT INNER.

For example:
$items = $this->Tag->query("SELECT Item.id, Item.thumb,
ItemContent.name, ItemContent.description, ItemContent.url,
Module.code FROM items AS Item INNER JOIN items_content AS ItemContent
ON ItemContent.item_id = Item.id INNER JOIN modules AS Module ON
Module.id = Item.module_id INNER JOIN items_tags AS ItemTag ON
ItemTag.item_id = Item.id WHERE ItemContent.language_id = $this-
>language_id AND ItemTag.tag_id = $id AND Item.visible = 0 ORDER BY
Item.id DESC");

Please 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: Custom error messages of the model

2009-08-18 Thread jordicakephp

Thanks a lot! :-D

$this->invalidate worked perfectly.

On 17 ago, 07:54, "Dr. Loboto"  wrote:
> You can try to do $this->invalidate('myField', 'myMessage') in your
> myCustomRule() method and do not use 'message' key in $validate for
> this rule at all.
>
> On Aug 16, 1:11 am, jordicakephp  wrote:
>
>
>
> > Good afternoon everybody,
>
> > I would like thecustomvalidation functions of my models to return
> > differenterrormessages, depending on what the user has sent. That
> > is, to define these messages not in compilation time, but during the
> > execution of the model's logic.
>
> > I've tried to to that in the beforeValidate() method of the model,
> > when defining my validation rules, with the help of $errorMessage (a
> > class variable):
>
> > 'rule'  =>   'myCustomRule',
> > 'message' =>         $this->errorMessage.
>
> > Then, as I say, I manipulate the content of $this->errorMessage inside
> > myCustomRule, depending on what the user writes. But it doesn't
> > work... :-(
>
> > Could somebody please give me a clue about how to define manyerror
> > messages for just onecustomrule? Thanks a lot in advance for your
> > help! :-)- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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: Containable, Pagination and HABTM

2009-08-18 Thread Jacques

Hi All,

I have a similar problem and am hoping that by posting on this post we
can get a resolution and some good advice from the community for both
our problems

Here goes:

I have the following models (denoted by UPPERCASE) :

USERS belongsTo CLIENT,
CONTACTS belongsTo USERS and HABTM CONTACT_GROUPS.


I have a setting on the clients side that allows users to each others
clients, i.e. a company may have many contacts these could belong to
different users, however ultimately they belong to the company. Hence
at times a user should be able to see all the contacts for a company.

Now paginating all contacts is simple using Cakes pagination and even
paginating contacts that only belong to a specific user.

Where I need advise or help is paginating the contacts that belong to
a specific group and user. i.e. at times I will want to display all
contacts linked to a specific group and user and at other times I need
to limit this by displaying contacts that are linked to a specific
group and CLIENT (being the top level)


I have tried to use containable in the paginate method to no avail
what I need to know if there is a simple solution in passing two
related models fields into the conditions array of the paginate
function or if I have to override the paginate function in the model.

Again to simplify:

PAGINATE: GET CONTACTS WITH user_id IN (1,2,3) AND group_id = 1

or

PAGINATE: GET CONTACTS WITH user_id = 1 AND group_id IN (1,2,3)


Any advise or help will be appreciated.

Thanks
Jacques












I can easily paginate the contacts


On Aug 12, 7:37 pm, sunertl  wrote:
> On 12 Aug., 19:00, brian  wrote:
>
> > Why not just use find()? Can a User belong to so many Groups that you
> > need to paginate them?
>
> Normally, a user will belong to about 10 groups, but the "moderators"
> belong to much more (30-50). Also groups are used only for one year
> tops and I would like to keep an archive with all expired ones. So I
> think a pagination would be useful.
>
> And even if it wasn't for this case I still would like to know what's
> wrong here ;-).
>
> Btw: I just found a typo in my original post. The table for Group is
> "groups" of course, not "group" as stated above.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Possible, saving null with saveField?

2009-08-18 Thread Martin Westin

Hi,
I would prefer to be abel to use saveField for a simple ajax inline-
edit functionality. Setting a value is fine, clearing out the field
does not apear to work. I can't seem to call Model->saveField
('fieldname',null) or even pass an empty string.

Am I doing something wrong or is it just not possible, and I should do
a "normal" save?

/Martin
--~--~-~--~~~---~--~~
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: Certain strings crashing CakePHP - where do I look first?

2009-08-18 Thread Bert Van den Brande

The redirect method belongs to Controller in /cake/libs/controller.php .
That's the cake lib file, you don't want to edit that one.

You can either :
* define a new class or edit the existing class named 'AppController'
in /app/app_controller.php
* simply overwrite the 'redirect' function in your own controller
class, though I'm not sure this will be sufficient since we are in
doubt that Cake ever arrives at your own controller code

Good luck with it :)

On Mon, Aug 17, 2009 at 5:23 PM, technicaltitch wrote:
>
> App was built Oct 2007 but it's taken the organization this long to
> find funding for someone to test and work on it, (hence I'm struggling
> to get my head round stuff again).
>
> I will have a go at creating a test subdirectory and adding that debug
> code- fantastic fantastic ideas thanks - probably blindingly obvious
> to PHPers but not to me (a decade working with C, Java and .NET but
> only ever used PHP on volunteer projects).
>
> Is it possible that a phpBB install may have had this as a side-
> effect? Ie, can filters be set up on all form input for a given space
> on a shared CPanel server?
>
> I have commented out my controller method and seen the error, so I'm
> assuming the redirect is called elsewhere, where do I put the redirect
> override code pls?
>
> As far as I can tell it isn't my code requesting the redirect but
> perhaps I'm missing something obvious? I commented out my controller
> method, route.php just has the default page specified. Tried debug
> level 1 and 2 and nothing is displayed about the error, or anything
> preceding the current page.
>
>
> Thanks SO much for your help - this is all so useful and despite my
> wandering off-subject, absolutely exactly how I hoped people would
> help me and I'm massively grateful,
> Chris
> >
>

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