Component with Model access

2008-03-06 Thread Miguel

Hi all,

I'm starting with Cake 1.2. I'm very happy with cake.

In my little application, I'm adding a counter in one action. To do
this, I have written a CounterComponent. Here is the code:

class CounterComponent extends Object
{
var $disableStartup = false;
var $uses = array('Counter');

function startup(&$controller)  {
$Counter = new Counter;
}

function updateCounters() {
$counters = $this->Counter->findAll();
...
}
}

But, i have a "Class Counter not found" in the startup. And of course
I have a Counter in the models.

Any suggestion?

Thanks a lot:

Miki

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



Re: Saving two models from the same controller

2008-03-06 Thread Juan Luis Baptiste

On Thu, Mar 6, 2008 at 2:23 PM, Juan Luis Baptiste
<[EMAIL PROTECTED]> wrote:
> Hi Casey,
>
>
>  On Thu, Mar 6, 2008 at 11:29 AM, daphonz <[EMAIL PROTECTED]> wrote:
>  >
>  >  Use two save commands:
>  >
>  >  $this->A->save($this->data['A']);
>  >  $this->A->B->save($this->data['B']);
>  >
>  >  I think there's a new(er) function called saveAll(), which should do
>  >  what you want automatically.  I'm not sure about the level of
>  >  implementation for that yet, though, it may only be in the latest beta
>  >  release.
>  >
>
>  That was my last resort, but I wanted to avoid it because there is
>  some logic before the save call in B controller that I was trying to
>  avoid duplicating in A controller. I'll take a look at that saveAll
>  method. It's implemented in the last released beta of 1.2 or is in the
>  repository ?
>

Ok I tried it and works, you just need to be sure to call saveAll on
the model that has de hasMany association. Also there seems to be a
bug in that method, it never returns true as described in this ticket:

https://trac.cakephp.org/ticket/4091

Adding a return true at the end of saveAll fixes the problem.

Thanks.

-- 
Juan Luis Baptiste

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



Re: CakePHP performance

2008-03-06 Thread R. Rajesh Jeba Anbiah

On Feb 29, 6:06 am, Jon <[EMAIL PROTECTED]> wrote:
> Like many other I'm shopping around for a framework. I'm playing with
> both CI and Cake.
   

FWIW, of late, I found that Kohana is the active fork of CI

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Fatal error: Allowed memory size of..."

2008-03-06 Thread R. Rajesh Jeba Anbiah

On Mar 7, 9:01 am, Baz <[EMAIL PROTECTED]> wrote:
> Exhausting 16MB is not impossible. This topic has come up before. I leave
> you with this: Out of the Box, Wordpress uses 5 MB. I run a blog that tops
> out at 15MB with a nice size database and a ton of plugins.
>
> So, for a project that actually DOES stuff, 16MB is simply not enough.

 I can't quite agree here. This is where we have to use
optimization and data structure. More memory means usually poor
architecture or less optimization. There is always a limit by how much
we can stretch on the hardwares.

FWIW, I recently had to do a svn spy--which is extremely simple 3
liner script if I had used array and sort functions: shell_exec('find /
svn/repos -cmin -420 -printf \'%T+ %p\n\' | grep "/db/revs/"'); But, I
can't stretch the memory limit to high number; but solved it by
dumping to file and reading line by line.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Fatal error: Allowed memory size of..."

2008-03-06 Thread DJ Spark

sometimes, bake used to create 'Parent' keys for associations. this
name, when already existent, used to gives memory errors.
I could work around by baking this model, changing do
'AnotherparentName' and continued baking happily ever after.

spark

On Thu, Mar 6, 2008 at 11:09 PM, Vangel <[EMAIL PROTECTED]> wrote:
>
>  I have noticed this happening when baking quite often. Reproducable if
>  you bake models or controllers when the model contains Data.
>  Especially large amount of data. I really dunno much about the cake
>  core to know the real reason. When using an empty database the problem
>  goes away.
>  I would suggest increasing the memory limit in you PHP CLI
>  configuration. In my setup, changing the regular php.ini also works. I
>  have set it to 24MB, seems to do the trick.
>
>
>
>  On Mar 7, 7:42 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
>  > I lately am getting this:
>  >
>  > Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
>  > allocate 2873212 bytes) in C:\Users\Aaron\workspace\cake\libs\cache
>  > \file.php on line 138
>  >
>  > Is this a bug in Cake?
>  >
>  > I haven't been getting this before. Any ideas on how to prevent it? I
>  > would hope that I wouldn't have to keep upping the memory?
>
>  >
>



-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

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



Re: "Fatal error: Allowed memory size of..."

2008-03-06 Thread Baz
Exhausting 16MB is not impossible. This topic has come up before. I leave
you with this: Out of the Box, Wordpress uses 5 MB. I run a blog that tops
out at 15MB with a nice size database and a ton of plugins.

So, for a project that actually DOES stuff, 16MB is simply not enough.

On Thu, Mar 6, 2008 at 8:09 PM, Vangel <[EMAIL PROTECTED]> wrote:

>
> I have noticed this happening when baking quite often. Reproducable if
> you bake models or controllers when the model contains Data.
> Especially large amount of data. I really dunno much about the cake
> core to know the real reason. When using an empty database the problem
> goes away.
> I would suggest increasing the memory limit in you PHP CLI
> configuration. In my setup, changing the regular php.ini also works. I
> have set it to 24MB, seems to do the trick.
>
> On Mar 7, 7:42 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> > I lately am getting this:
> >
> > Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
> > allocate 2873212 bytes) in C:\Users\Aaron\workspace\cake\libs\cache
> > \file.php on line 138
> >
> > Is this a bug in Cake?
> >
> > I haven't been getting this before. Any ideas on how to prevent it? I
> > would hope that I wouldn't have to keep upping the memory?
>
> >
>

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



Re: unconventional database structure

2008-03-06 Thread Adam Royle

You can override most of cake's model conventions.

var $useTable = 'tblSomethingCrazy';
var $primaryKey = 'num';
var $displayField = 'str_name';

And when creating associations be sure to specify all of your join
table and field names (joinTable, foreignKey, foreignKeyAssoc).

Hope this helps.

Cheers,
Adam

dietcheese wrote:
> Hi all,
>
> I've very new to CakePHP and probably in way over my head.
>
> I am using two databases, one is a mysql database which strictly
> follows Cake's naming conventions and is working great so far.
>
> However, the other is a MS-SQL database, of which the tables and keys
> follow no conventions and cannot be changed.  This is the database I
> need to access.
>
> I'm connecting to the MS-SQL database fine, I simply want to know how
> to properly create a MVC to access records in this database.
> Additionally, is there a way to map an unconventionally-structured
> table so that it can take advantage of Cake's automagical abilities?
>
> I've been searching for hours and I still can't seem to get a simple
> select statement to function.
>
> I am properly using the useDbConfig variable to access the second
> database but my model, which is named Test, gives me a "Missing
> Database Table, No Database table for model Test (expected "tests"),
> create it first." error.
>
> I would really appreciate a quick example.
>
> Thanks,
> DC
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Integrate YUI Library as Helper Class

2008-03-06 Thread Chris Hartjes

On Thu, Mar 6, 2008 at 8:52 PM, Vangel <[EMAIL PROTECTED]> wrote:
>
>  Has anyone done this? I don't want to use 'vendor' method. Is it
>  possible to use YUI library like Helper. Any examples, samples would
>  help a lot. I am stumped. I found a little bit of code when searching
>  but it looks incomplete.
>

Why wouldn't you just include the YUI JS files in your views (or you
layouts if you like putting all your javascript in your  section
of your page) and just write the YUI-specific stuff yourself?  I use
jQuery with CakePHP and that's exactly what I do.

No messing around with a helper either.  There has been talk of the
creation of a jQuery helper for Cake, but that's probably a Cake 2.0
thing.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Which CakePHP version should I use?

2008-03-06 Thread SumanRS

> Oh I forget about:
>
> * Improved models validation
> * Localization and Internationalization
> * New Shells

Baking (to automatically generate models, views, controllers and
more)! :)

I would vote this as the best new feature and a really powerful one.
It makes development on CakePHP so much easier...

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



Integrate YUI Library as Helper Class

2008-03-06 Thread Vangel

Has anyone done this? I don't want to use 'vendor' method. Is it
possible to use YUI library like Helper. Any examples, samples would
help a lot. I am stumped. I found a little bit of code when searching
but it looks incomplete.



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



Dynamic Error Messages in 1.2?

2008-03-06 Thread Mike

Hello!

In CakePHP 1.2, one can define a validation rule (in a model) that
calls a method to do the validation.  If the method returns false,
then whatever message was specified for that rule is displayed in the
view, which is great for most of data validation needs.

However, in the case that the method returns false, I'd to have that
method change the 'message' to be something new (which the method just
generated).  It looks like I can do this by hacking the cake/  file,
and by tweaking some code in the invalidFields method (right around
the calls to call_user_func_array).

Is it possible to do this (to have the validation method set/change
the message dynamically) without hacking Cake itself?  I'm really
sorry if I've missed this, but I've looked around, but haven't found
anything that seems directly applicable.

Thanks!
---Mike

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



unconventional database structure

2008-03-06 Thread dietcheese

Hi all,

I've very new to CakePHP and probably in way over my head.

I am using two databases, one is a mysql database which strictly
follows Cake's naming conventions and is working great so far.

However, the other is a MS-SQL database, of which the tables and keys
follow no conventions and cannot be changed.  This is the database I
need to access.

I'm connecting to the MS-SQL database fine, I simply want to know how
to properly create a MVC to access records in this database.
Additionally, is there a way to map an unconventionally-structured
table so that it can take advantage of Cake's automagical abilities?

I've been searching for hours and I still can't seem to get a simple
select statement to function.

I am properly using the useDbConfig variable to access the second
database but my model, which is named Test, gives me a "Missing
Database Table, No Database table for model Test (expected "tests"),
create it first." error.

I would really appreciate a quick example.

Thanks,
DC

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



Re: "Fatal error: Allowed memory size of..."

2008-03-06 Thread Vangel

I have noticed this happening when baking quite often. Reproducable if
you bake models or controllers when the model contains Data.
Especially large amount of data. I really dunno much about the cake
core to know the real reason. When using an empty database the problem
goes away.
I would suggest increasing the memory limit in you PHP CLI
configuration. In my setup, changing the regular php.ini also works. I
have set it to 24MB, seems to do the trick.

On Mar 7, 7:42 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> I lately am getting this:
>
> Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
> allocate 2873212 bytes) in C:\Users\Aaron\workspace\cake\libs\cache
> \file.php on line 138
>
> Is this a bug in Cake?
>
> I haven't been getting this before. Any ideas on how to prevent it? I
> would hope that I wouldn't have to keep upping the memory?

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



Re: selecting extra info from related fields for an association

2008-03-06 Thread Adam Royle

generateList() has been replaced by find('list')

I know people have spoke previously of select inputs not showing
correctly, and often I think it is because they didn't have a field
"name" or "title" in their model. Customising the find('list') is one
way of doing it, alternatively you can also set var $displayField =
"mytitle"; in the model to fix this.

I've also seen this issue occur when people have not set their
recursive level high enough, but without seeing your code it's hard to
debug. My suggestion is still to look at what data you are getting
from find('list') and go from there.

Cheers,
Adam

On Mar 7, 12:36 pm, jaypee <[EMAIL PROTECTED]> wrote:
> I'm glad you saw it because I only looked at that 15 times or so. Oh
> well.
>
> Now off to find more on the list generating issues. I think
> generateList might be what is required.
>
> Thanks Adam.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: selecting extra info from related fields for an association

2008-03-06 Thread jaypee

I'm glad you saw it because I only looked at that 15 times or so. Oh
well.

Now off to find more on the list generating issues. I think
generateList might be what is required.

Thanks Adam.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread nate

Dude, Rob, you can be as proletarian as you want in your own
applications, just don't come polluting our mailing list with your
uneducated drivel.

On Mar 6, 9:25 pm, rtconner <[EMAIL PROTECTED]> wrote:
> Ya Novice Programmer, don't listen to me. It's not recomended.
>
> Nate:
> You be happy to know, one of my favourite bootrap functions ..
> function user($key = null) {
>     global $AUTH_COMPONENT;
>     return $AUTH_COMPONENT->user($key);}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread rtconner

Ya Novice Programmer, don't listen to me. It's not recomended.

Nate:
You be happy to know, one of my favourite bootrap functions ..
function user($key = null) {
global $AUTH_COMPONENT;
return $AUTH_COMPONENT->user($key);
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread nate

On Mar 6, 8:56 pm, rtconner <[EMAIL PROTECTED]> wrote:
> global $SESSION;
> $SESSION = $this->Session;
>
> screw this not getting at the session from the model crap, there are
> exceptions to every rule and this is one of them
>

rtconner:
OMG u r teh N00Bzorz!!1one!

Novice Programmer:
There are two right ways of doing this.  One is to make the session a
formal part of your domain model, i.e. model it.  This allows it to
interact with other models at the model level.  The model, like the
view, should never directly query a tier outside its own.  The other
is to use a callback to notify the model of the user's state.
Assuming you are following proper convention, this can be handled
across your entire application in one fell swoop:

class AppController extends Controller {

var $components = array("Auth");

function beforeFilter() {
$this->{$this->modelClass}->setUserState($this->Auth->user());
   }
}

class AppModel extends Model {

function setUserState($user) {
// Handle authentication data/set local variables in prep for
validation
}
}

Hope that helps.  If you're not able to get it to work, reply to this
thread and myself or someone else knowledgeable in proper OO/MVC
design will respond.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread rtconner

global $SESSION;
$SESSION = $this->Session;

screw this not getting at the session from the model crap, there are
exceptions to every rule and this is one of them

On Mar 6, 6:33 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Auth should go in controller, that said you can assign the session
> object to the model $this->Model->Session = $this->Session;
>
> On Thu, Mar 6, 2008 at 9:50 PM, Novice Programmer
>
> <[EMAIL PROTECTED]> wrote:
> > yeah thats another way... I got another way though ... will do the
> > controller errors using the hidden divs and enable them in view when
> > controller throws an error.. what say?
>
> > Thanks.
>
> >  On Fri, Mar 7, 2008 at 3:11 AM, Baz <[EMAIL PROTECTED]> wrote:
> > > Dude, you asked the question.
>
> > > MVC is a nice model, but if you claim you "NEED" something that it doesn't
> > support please understand that it's just a bunch of classes.
>
> > > On Thu, Mar 6, 2008 at 1:01 PM, Novice Programmer
> > <[EMAIL PROTECTED]> wrote:
>
> > > > Hello Baz,
>
> > > > What do you suggest then? Should i assign the value of error in
> > controller to the array that comes out from validation? Doesn't it break MVC
> > paridigm. I mean model is supposed to give us data and we are still not
> > satisifed with what it has outputted to us?
>
> > > > Thanks.
>
> > > > On Thu, Mar 6, 2008 at 11:39 PM, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > > Anything is possible...
>
> > > > > But I think the general consensus is that you should not.
>
> > > > > With that said, please remember that with MVC we are still dealing
> > with classes, member variables and methods here.
>
> > > > > There is nothing stopping you from assigning a Model member variable
> > in your controller, based on the session, then using that in your Model code
> > as needed.
>
> > > > > On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer
> > <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hello All,
>
> > > > > > I want to thro a validation error if a user is not logged in. This
> > is because i have a mechanism to display model validation errors in the view
> > and dont want to add controller level error displaying handler. Please
> > suggest that how can i proceed to check the session in the model. I dont
> > think that it is possible to access Session component in the model. Is It?
>
> > > > > > --
> > > > > > Thanks & Regards,
> > > > > > Novice (http://ishuonweb.wordpress.com/).
>
> > > > --
> > > > Thanks & Regards,
> > > > Novice (http://ishuonweb.wordpress.com/).
>
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread Dardo Sordi Bogado

Auth should go in controller, that said you can assign the session
object to the model $this->Model->Session = $this->Session;

On Thu, Mar 6, 2008 at 9:50 PM, Novice Programmer
<[EMAIL PROTECTED]> wrote:
> yeah thats another way... I got another way though ... will do the
> controller errors using the hidden divs and enable them in view when
> controller throws an error.. what say?
>
> Thanks.
>
>
>
>  On Fri, Mar 7, 2008 at 3:11 AM, Baz <[EMAIL PROTECTED]> wrote:
> > Dude, you asked the question.
> >
> > MVC is a nice model, but if you claim you "NEED" something that it doesn't
> support please understand that it's just a bunch of classes.
> >
> >
> > On Thu, Mar 6, 2008 at 1:01 PM, Novice Programmer
> <[EMAIL PROTECTED]> wrote:
> >
> > > Hello Baz,
> > >
> > > What do you suggest then? Should i assign the value of error in
> controller to the array that comes out from validation? Doesn't it break MVC
> paridigm. I mean model is supposed to give us data and we are still not
> satisifed with what it has outputted to us?
> > >
> > > Thanks.
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Thu, Mar 6, 2008 at 11:39 PM, Baz <[EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > > Anything is possible...
> > > >
> > > > But I think the general consensus is that you should not.
> > > >
> > > > With that said, please remember that with MVC we are still dealing
> with classes, member variables and methods here.
> > > >
> > > > There is nothing stopping you from assigning a Model member variable
> in your controller, based on the session, then using that in your Model code
> as needed.
> > > >
> > > >
> > > >
> > > > On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer
> <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > Hello All,
> > > > >
> > > > > I want to thro a validation error if a user is not logged in. This
> is because i have a mechanism to display model validation errors in the view
> and dont want to add controller level error displaying handler. Please
> suggest that how can i proceed to check the session in the model. I dont
> think that it is possible to access Session component in the model. Is It?
> > > > >
> > > > > --
> > > > > Thanks & Regards,
> > > > > Novice (http://ishuonweb.wordpress.com/).
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
>
>
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
>  >
>

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



Re: "Fatal error: Allowed memory size of..."

2008-03-06 Thread DJ Spark

 It seems to be what it says: memory usage beyond PHP limits.
 In some test I ran , cakephp 1.2 uses around 4MB of memory with one
controller instantiated. [but i'm not a benchmark freak, should
something like this be on docs ?]
 So, it's certainly the data or associated data you are fetching from
database. a simple data) ?> in your view or
controllers should tell you.
 To find out, try using in your controller something like this:
$this->ModelName->recursive = -1;

  If it is effectivelly the problem, try the bindable behaviour:
http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings

  spark

On Thu, Mar 6, 2008 at 8:42 PM, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote:
>
>  I lately am getting this:
>
>  Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
>  allocate 2873212 bytes) in C:\Users\Aaron\workspace\cake\libs\cache
>  \file.php on line 138
>
>  Is this a bug in Cake?
>
>  I haven't been getting this before. Any ideas on how to prevent it? I
>  would hope that I wouldn't have to keep upping the memory?
>  >
>



-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

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



Worker component and checking process table in Win32

2008-03-06 Thread mixersoft

I've built a Job/Worker component that I'm happy to share when it's
done.

It includes a Job table to schedule Jobs (URIs) in a Job queue, and a
Worker component that starts up to n background processes in a shell
to run Jobs in a Job table. By using a shell, I'm not limited to any
Apache/PHP max execution time. I can count Workers in linux using 'ps
ax', but I cannot figure out how to do the same in Win32. Without it,
I'm forced to keep track in a db table, and it's not been very
accurate.

Also, even with a MAX_CONCURRENT_WORKER limit, I still can overwhelm
my server or Apache2.

Q1: How do count the number of background Worker processes in Win32
Q2: What should I check for in both linux and Win32 to prevent this?

many thanks.

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



Re: Checking user session in model

2008-03-06 Thread Novice Programmer
yeah thats another way... I got another way though ... will do the
controller errors using the hidden divs and enable them in view when
controller throws an error.. what say?

Thanks.

On Fri, Mar 7, 2008 at 3:11 AM, Baz <[EMAIL PROTECTED]> wrote:

> Dude, you asked the question.
>
> MVC is a nice model, but if you claim you "NEED" something that it doesn't
> support please understand that it's just a bunch of classes.
>
> On Thu, Mar 6, 2008 at 1:01 PM, Novice Programmer <
> [EMAIL PROTECTED]> wrote:
>
> > Hello Baz,
> >
> > What do you suggest then? Should i assign the value of error in
> > controller to the array that comes out from validation? Doesn't it break MVC
> > paridigm. I mean model is supposed to give us data and we are still not
> > satisifed with what it has outputted to us?
> >
> > Thanks.
> >
> >
> > On Thu, Mar 6, 2008 at 11:39 PM, Baz <[EMAIL PROTECTED]> wrote:
> >
> > > Anything is possible...
> > >
> > > But I think the general consensus is that you should not.
> > >
> > > With that said, please remember that with MVC we are still dealing
> > > with classes, member variables and methods here.
> > >
> > > There is nothing stopping you from assigning a Model member variable
> > > in your controller, based on the session, then using that in your Model 
> > > code
> > > as needed.
> > >
> > > On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <
> > > [EMAIL PROTECTED]> wrote:
> > >
> > > > Hello All,
> > > >
> > > > I want to thro a validation error if a user is not logged in. This
> > > > is because i have a mechanism to display model validation errors in the 
> > > > view
> > > > and dont want to add controller level error displaying handler. Please
> > > > suggest that how can i proceed to check the session in the model. I dont
> > > > think that it is possible to access Session component in the model. Is 
> > > > It?
> > > >
> > > > --
> > > > Thanks & Regards,
> > > > Novice (http://ishuonweb.wordpress.com/).
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
> >
> >
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Session problems on redirect

2008-03-06 Thread Novice Programmer
yeah i did typo when writing the query.. otherwise it is fine in code... My
problem is still not solved and before moving to global _SESSION i made sure
that it failed on my dev server too and it is failing consistently on dev
server as well.. ;)..

Thanks.

On Fri, Mar 7, 2008 at 4:09 AM, b logica <[EMAIL PROTECTED]> wrote:

>
> It only fails on the prod server? That suggests it's an issue with
> php.ini maybe. Or some funky domain issue.
>
> I'm sure this isn't it but you have a typo above:
>
> $this->Session-read('User.info').
>
> $this->Session->read('User.info').
>
> My session problem seems to have resolved itself. I have no idea why.
>
> On Thu, Mar 6, 2008 at 6:31 AM, Novice <[EMAIL PROTECTED]> wrote:
> >
> >  Hello guys,
> >
> >  I got a hint to this... The session is there on the second page but
> >  its like that the reading of the session variables fails when i try to
> >  read it using $this->Session-read('User.info') Any idea on what
> >  this might be.. and note that every thing works on my system it fials
> >  on the production server. Please help.
> >
> >  Thanks.
> >
> >  On Mar 3, 10:58 pm, "Novice Programmer" <[EMAIL PROTECTED]>
> >  wrote:
> >
> > > Any Help on this one? ME still stuck.. :(
> >  >
> >  > On Mon, Mar 3, 2008 at 9:50 PM, Novice Programmer <
> [EMAIL PROTECTED]>
> >
> > > wrote:
> >  >
> >  >
> >  >
> >  > > Here is how i am writing the session variables.
> >  >
> >  > > if(($user = $this->User->validateLogin($this->data['User'])) ==
> true) {
> >  > > $this->Session->write('User', $user);
> >  > > $this->Session->setFlash('You\'ve successfully
> logged
> >  > > in.');
> >  > > $this->redirect('/');
> >  > >  }
> >  >
> >  > > The function validateLogin is as(please ignore typos etc.. all that
> is
> >  > > working fine):
> >  >
> >  > > $user = $this->find(array('email_address' =>
> $data['email_address'],
> >  > >  'password' => 'password']), array('id', 'email_address'));
> >  >
> >  > >  if(empty($user) == false)
> >  > >  return $user['User'];
> >  >
> >  > >  return false;
> >  >
> >  > > Here is how I read the session.. in the other controller ..
> >  >
> >  > > if ($this->Session->check('User')) {
> >  > > $this->log('Got the user');
> >  > > }
> >  > > else {
> >  > >  $this->log('No Session Yet');
> >  > >   }
> >  >
> >  > > Thanks.
> >  >
> >  > > On Mon, Mar 3, 2008 at 9:43 PM, Novice Programmer <
> >
> > > > [EMAIL PROTECTED]> wrote:
> >  >
> >  > > > Hello,
> >  >
> >
> > > > > using activate does not resolve the issue and i dont know that why
> i
> >  > > > would need to call activate since activate is a turned on in
> core.php.
> >  > > > Any other suggestions?
> >  >
> >  > > > Thanks.
> >  >
> >
> > > > > On Mon, Mar 3, 2008 at 9:43 AM, abiram <[EMAIL PROTECTED]>
> wrote:
> >  >
> >  > > > > Hai u use session->activate function
> >  > > > > also see
> >  > > > >
> http://groups.google.co.in/group/cake-php/browse_thread/thread/75946f...
> >
> >
> > >
> >  > > > > On Mar 3, 2:58 am, "Novice Programmer" <
> [EMAIL PROTECTED]>
> >  > > > > wrote:
> >  > > > > > Hello,
> >  >
> >  > > > > > I am facing session problems on redirection. The function
> >  > > > > session->read()
> >  > > > > > returns nothing on the session stored before redirection. I
> searched
> >  > > > > on the
> >  > > > > > google and found some solutions one of them was modifying
> htaccess
> >  > > > > which i
> >  > > > > > can't do because of shared host. Another was to put session
> id in
> >  > > > > url which
> >  > > > > > is not secure enough. Was wondering on how other people
> handle this
> >  > > > > problem.
> >  > > > > > Please help.
> >  >
> >  > > > > > --
> >  > > > > > Thanks & Regards,
> >  > > > > > Novice (http://ishuonweb.wordpress.com/).
> >  >
> >  > > > --
> >  > > > Thanks & Regards,
> >  > > > Novice (http://ishuonweb.wordpress.com/).
> >  >
> >  > > --
> >  > > Thanks & Regards,
> >  > > Novice (http://ishuonweb.wordpress.com/).
> >  >
> >  > --
> >  > Thanks & Regards,
> >  > Novice (http://ishuonweb.wordpress.com/).
> >  >
> >
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



"Fatal error: Allowed memory size of..."

2008-03-06 Thread Aaron Shafovaloff

I lately am getting this:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
allocate 2873212 bytes) in C:\Users\Aaron\workspace\cake\libs\cache
\file.php on line 138

Is this a bug in Cake?

I haven't been getting this before. Any ideas on how to prevent it? I
would hope that I wouldn't have to keep upping the memory?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: override foreign key name with HABTM

2008-03-06 Thread Adam Royle

HABTM associations have another config value that you need to specify
- associationForeignKey

 class Term extends AppModel {
var $name = 'Term';
var $displayField = 'term_nice';
var $primaryKey = 'no';

var $hasAndBelongsToMany = array('Context' =>
array('className'=> 'Context',
 'joinTable' =>
'contexts_terms',
 'conditions'   => '',
 'order'=> '',
 'foreignKey'   => 'term_no',
 'associationForeignKey' =>
'context_no'
   )
);

}

You'll need to do the same with your other models. Also since you have
created a model for your join table, I would suggest using the 'with'
association.

Cheers,
Adam

On Mar 7, 5:07 am, Lisa B <[EMAIL PROTECTED]> wrote:
> In my project I can't use the default 'id' name for primary key
> fields, I have to use 'no'.  I have to change a cake I already baked
> from using 'no' to 'id' everywhere.  I hadn't customized it much and I
> could easily change the database and everywhere I could see in the
> views and models, and most pages work perfectly as before, except this
> one where the join is a HABTM.
>
> It is a dictionary app where a term can have many contexts and a
> context many terms.  The query that is failing when I visit
> /contexts/view/5 is still looking for an '_id' field on the join, like
> this:
>
> Query: SELECT `Term`.`no`, `Term`.`term`, `Term`.`term_nice`,
> `Term`.`display`, `Term`.`import_date`, `ContextsTerm`.`context_no`,
> `ContextsTerm`.`term_no` FROM `terms` AS `Term` JOIN `contexts_terms`
> AS `ContextsTerm` ON (`ContextsTerm`.`context_no` IN (5) AND
> `ContextsTerm`.`term_id` = `Term`.`no`)
>
> In the view I'm not even trying to view the list of terms, I removed
> that section from the view that it baked, so I wish it weren't trying
> to do that query, but it's just a warning not an error, but that query
> crops up and breaks on another page as well where I do need it and I
> don't know where to look..  Perplexed, I am new to cake, thanks..
>
> term.php:
> class Term extends AppModel {
> var $name = 'Term';
> var $displayField = 'term_nice';
> var $primaryKey = 'no';
>
> var $hasAndBelongsToMany = array('Context' =>
> array('className'=> 'Context',
>  'joinTable' => 'contexts_terms',
>  'conditions'   => '',
>  'order'=> '',
>  'foreignKey'   => 'term_no'
>)
> );
>
> }
>
> context.php:
> class Context extends AppModel {
> var $name = 'Context';
> var $displayField = 'name';
> var $primaryKey = 'no';
>
> var $hasAndBelongsToMany = array('Term' =>
> array('className'=> 'Term',
>  'joinTable' => 'contexts_terms',
>  'conditions'   => '',
>  'order'=> '',
>  'foreignKey'   => 'context_no'
> )
> );
> }
>
> // I have modeled this so I can get easy pagination on another page
> which is also broken on that join
> class ContextsTerm extends AppModel {
> var $belongsTo = array('Context','Term');
> var $primaryKey = 'context_no';
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: selecting extra info from related fields for an association

2008-03-06 Thread Adam Royle

Hi Joshua,

The generated SQL looks wrong to me. It should be something like this
(see `User`.`id` = `Referrer`.`referrer_id`):

SELECT `User`.`id`, `User`.`created_by`, `Referrer`.`id`,
`Referrer`.`created_by` FROM `users` AS `User` LEFT JOIN `users` AS
`Referrer` ON (`User`.`id` = `Referrer`.`referrer_id`) WHERE 1 = 1
LIMIT 20

Check your association foreignKey to make sure you've specified it
correctly.

In your add and edit views, the select should be filled correctly as
long as you are passing $referrers to your view. Check the $referrers
array to see what data is in there.

Cheers,
Adam


On Mar 7, 8:52 am, jaypee <[EMAIL PROTECTED]> wrote:
> Gday Adam,
>
> Done that. Referrer|name just brings up the users name.. not the
> referrers name. It seems as if the only record it returns is the users
> except when i look at the sql dump it is SELECT `User`.`id`,
> `User`.`created_by`, etc, `Referrer`.`id`, `Referrer`.`created_by`,
> etc, FROM `users` AS `User` LEFT JOIN `users` AS `Referrer` ON
> (`User`.`id` = `Referrer`.`id`) WHERE 1 = 1 LIMIT 20
>
> The two things I can't do that I would like to is display the names of
> the 'referrers' in the select lists that is in the edit and add views,
> and output their names in the view and index views.
>
> From going through the controller, I need more code in the view and
> index functions. I have tried different variations of find() but I am
> stabbing in the dark. I have yet to find some documentation to make
> sense to me (im guessing this because the add and edit have $referrers
> = $this->User->Referrer->find('list'); in their functions).
>
> Also, in the add and edit views, I am trying to figure out to add to
> the existing helper code so that the output would allow me to  id=>
> >input('referrer_id');"
>
> Thanks in advance,
>
> Joshua.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: url internationalization

2008-03-06 Thread b logica

I think what you need to do is add something to your AppController to
look for $this->params['lang'] and
$this->Session->write('Config.language', $lang);

I'm really not sure but this is what I had in mind. I'll need to do
this same thing very shortly. If you figure it out, please post your
solution.

BTW, I think you need to use the 3-letter code. I prefer 2-letter
myself but it seems Cake needs the 3-letter version. Correct me if I'm
wrong (the information on I18N, L10N, etc. is very confusing).

On Thu, Mar 6, 2008 at 6:19 AM, TriLLi <[EMAIL PROTECTED]> wrote:
>
>  I need help
>  How can I tell cake that first paramter in routing is language
>  Router:Connect('/en/products/index/', Array('lang' =>'en',
>  'controller'=>'products', 'action'=>'index'));
>
>  so it can rewrite links in my views
>  $html->link(__('New Product', true), array('action'=>'add'));
>  so link can be
>  http://www.example.com/en/products/add
>
>  this is because I have dozen languages on web site...
>  npr for bosnian link should be
>
>  http://www.example.com/ba/proizvodi/dodaj
>
>  I have routing file filled with all routes
>  like
>  Router:Connect('/ba/products/pocetna/', Array('lang' =>'ba',
>  'controller'=>'products', 'action'=>'index'));
>
>  >
>

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



Re: Model related(hasMany) as condition of paginate

2008-03-06 Thread b logica

This might do it:

var $paginate = array(
'limit' => 20,
'page' => 1,
'order'=>array('Client.last_name' => 'ASC'),  // for example
'fields' => array(
'Client.id',
'Client.first_name',
'Client.last_name',
'Purchase.id,
'Purchase.name',
...
)
);

function whatever()
{
$this->paginate(array('Client.first_name' => 'John', 'Purchase.name' => 'car'))
}

On Thu, Mar 6, 2008 at 7:29 AM, dandreta <[EMAIL PROTECTED]> wrote:
>
>  Hi!
>  I have two models:(Client,purchase)
>  One client has many purchases.
>
>  In clients_controller:
>
>  If I want to paginate all clients with name John I do:
>  $this->paginate(array('Client.name' => 'John'))
>
>  But how can I paginate all clients who have bought a certain product
>  (for example, condition: purchase.name='car')?
>
>  Thanks and regards
>  >
>

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



Re: selecting extra info from related fields for an association

2008-03-06 Thread jaypee

Gday Adam,

Done that. Referrer|name just brings up the users name.. not the
referrers name. It seems as if the only record it returns is the users
except when i look at the sql dump it is SELECT `User`.`id`,
`User`.`created_by`, etc, `Referrer`.`id`, `Referrer`.`created_by`,
etc, FROM `users` AS `User` LEFT JOIN `users` AS `Referrer` ON
(`User`.`id` = `Referrer`.`id`) WHERE 1 = 1 LIMIT 20

The two things I can't do that I would like to is display the names of
the 'referrers' in the select lists that is in the edit and add views,
and output their names in the view and index views.

>From going through the controller, I need more code in the view and
index functions. I have tried different variations of find() but I am
stabbing in the dark. I have yet to find some documentation to make
sense to me (im guessing this because the add and edit have $referrers
= $this->User->Referrer->find('list'); in their functions).

Also, in the add and edit views, I am trying to figure out to add to
the existing helper code so that the output would allow me to >input('referrer_id');"

Thanks in advance,

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



Re: Session problems on redirect

2008-03-06 Thread b logica

It only fails on the prod server? That suggests it's an issue with
php.ini maybe. Or some funky domain issue.

I'm sure this isn't it but you have a typo above:

$this->Session-read('User.info').

$this->Session->read('User.info').

My session problem seems to have resolved itself. I have no idea why.

On Thu, Mar 6, 2008 at 6:31 AM, Novice <[EMAIL PROTECTED]> wrote:
>
>  Hello guys,
>
>  I got a hint to this... The session is there on the second page but
>  its like that the reading of the session variables fails when i try to
>  read it using $this->Session-read('User.info') Any idea on what
>  this might be.. and note that every thing works on my system it fials
>  on the production server. Please help.
>
>  Thanks.
>
>  On Mar 3, 10:58 pm, "Novice Programmer" <[EMAIL PROTECTED]>
>  wrote:
>
> > Any Help on this one? ME still stuck.. :(
>  >
>  > On Mon, Mar 3, 2008 at 9:50 PM, Novice Programmer <[EMAIL PROTECTED]>
>
> > wrote:
>  >
>  >
>  >
>  > > Here is how i am writing the session variables.
>  >
>  > > if(($user = $this->User->validateLogin($this->data['User'])) == true) {
>  > > $this->Session->write('User', $user);
>  > > $this->Session->setFlash('You\'ve successfully logged
>  > > in.');
>  > > $this->redirect('/');
>  > >  }
>  >
>  > > The function validateLogin is as(please ignore typos etc.. all that is
>  > > working fine):
>  >
>  > > $user = $this->find(array('email_address' => $data['email_address'],
>  > >  'password' => 'password']), array('id', 'email_address'));
>  >
>  > >  if(empty($user) == false)
>  > >  return $user['User'];
>  >
>  > >  return false;
>  >
>  > > Here is how I read the session.. in the other controller ..
>  >
>  > > if ($this->Session->check('User')) {
>  > > $this->log('Got the user');
>  > > }
>  > > else {
>  > >  $this->log('No Session Yet');
>  > >   }
>  >
>  > > Thanks.
>  >
>  > > On Mon, Mar 3, 2008 at 9:43 PM, Novice Programmer <
>
> > > [EMAIL PROTECTED]> wrote:
>  >
>  > > > Hello,
>  >
>
> > > > using activate does not resolve the issue and i dont know that why i
>  > > > would need to call activate since activate is a turned on in core.php.
>  > > > Any other suggestions?
>  >
>  > > > Thanks.
>  >
>
> > > > On Mon, Mar 3, 2008 at 9:43 AM, abiram <[EMAIL PROTECTED]> wrote:
>  >
>  > > > > Hai u use session->activate function
>  > > > > also see
>  > > > 
> >http://groups.google.co.in/group/cake-php/browse_thread/thread/75946f...
>
>
> >
>  > > > > On Mar 3, 2:58 am, "Novice Programmer" <[EMAIL PROTECTED]>
>  > > > > wrote:
>  > > > > > Hello,
>  >
>  > > > > > I am facing session problems on redirection. The function
>  > > > > session->read()
>  > > > > > returns nothing on the session stored before redirection. I 
> searched
>  > > > > on the
>  > > > > > google and found some solutions one of them was modifying htaccess
>  > > > > which i
>  > > > > > can't do because of shared host. Another was to put session id in
>  > > > > url which
>  > > > > > is not secure enough. Was wondering on how other people handle this
>  > > > > problem.
>  > > > > > Please help.
>  >
>  > > > > > --
>  > > > > > Thanks & Regards,
>  > > > > > Novice (http://ishuonweb.wordpress.com/).
>  >
>  > > > --
>  > > > Thanks & Regards,
>  > > > Novice (http://ishuonweb.wordpress.com/).
>  >
>  > > --
>  > > Thanks & Regards,
>  > > Novice (http://ishuonweb.wordpress.com/).
>  >
>  > --
>  > Thanks & Regards,
>  > Novice (http://ishuonweb.wordpress.com/).
>  >
>

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



Re: Excerpt functionality

2008-03-06 Thread b logica

You want:
echo("" . $text->truncate($thisstory['Story']['plot']) . "");


FWIW, I wrote a function just last night that acts the same as
Text::truncate() but for HTML content. There are a couple of problems
with using the Text method on HTML content:

1) It will count the characters of your tags as part of the text
length to limit to. My function takes these into consideration, so the
limit you pass will be honoured.

2) It will inevitably leave you with an unbalanced HTML snippet. So,
an unclosed  will ruin the rest of your page. My function
relies on the Tidy extension to clean up. If Tidy isn't available, it
passes the string to Text::truncate().

I found and fixed a couple of bugs this morning but there's still one
(that I know of) left. I'll post it later when I get a chance to have
another look at it. Although, I was planning to turn the function into
a Helper first. Maybe I'll do that.

I'll also post easy instructions for installing libtidy and the Tidy ext.

On Thu, Mar 6, 2008 at 1:08 PM, Toon Gorissen <[EMAIL PROTECTED]> wrote:
>
>  I managed to include the TextHelper in the controller, but I don't
>  understand where to actually use the excerpt function. I'm new to
>  CakePHP.
>
>  My controller:
>  var $helpers = array('Html','Javascript', 'Ajax', 'RfRating', 'Text');
>
>  My view:
>  echo("" . truncate($thisstory['Story']['plot']) . "");
>
>  But that doesn't seem to work:
>  Fatal error: Call to undefined function truncate() in /Applications/
>  MAMP/htdocs/metatube/app/views/stories/index.thtml on line 7
>
>
>
>  On 6 mrt, 18:36, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>  > Well, if your stories are plain text data, you need to use TextHelper
>  > (http://api.cakephp.org/1.2/class_text_helper.html) in your view. The
>  > ticket you posted is a patch for making excerpts of html data.
>  >
>  > Toon Gorissen wrote:
>  > > I'm using the following code in my stories_controller:
>  >
>  > > function index(){
>  > >$stories = $this->Story->findAll(null, array('id', 'plot', 'author',
>  > > 'created'), 'created DESC');
>  > >$stories_array = array();
>  > >foreach($stories as $story){
>  > >$story_id = $story['Story']['id'];
>  > >$stories_array[$story_id] = $this->RfRating-
>  > > >getRatingInfo($story_id, $_SERVER['REMOTE_ADDR']);
>  > >}
>  > >//$this->set('stories', $this->Story->findAll(null, array('id',
>  > > 'plot', 'author', 'created'), 'created DESC'));
>  > >$this->set('stories', $stories);
>  > >$this->set('ratingInfo', $stories_array);
>  > > }
>  >
>  > > Now I would like to truncate (or make an excerpt of) the plot
>  > > variable. I've read a ticket on makings exerpts (https://
>  > > trac.cakephp.org/ticket/2306), but I don't quite understand how to
>  > > implement it.
>  >
>  > > Could someone help me? Thanks!
>  >
>

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



Re: Checking user session in model

2008-03-06 Thread Baz
Dude, you asked the question.

MVC is a nice model, but if you claim you "NEED" something that it doesn't
support please understand that it's just a bunch of classes.

On Thu, Mar 6, 2008 at 1:01 PM, Novice Programmer <[EMAIL PROTECTED]>
wrote:

> Hello Baz,
>
> What do you suggest then? Should i assign the value of error in controller
> to the array that comes out from validation? Doesn't it break MVC paridigm.
> I mean model is supposed to give us data and we are still not satisifed with
> what it has outputted to us?
>
> Thanks.
>
>
> On Thu, Mar 6, 2008 at 11:39 PM, Baz <[EMAIL PROTECTED]> wrote:
>
> > Anything is possible...
> >
> > But I think the general consensus is that you should not.
> >
> > With that said, please remember that with MVC we are still dealing with
> > classes, member variables and methods here.
> >
> > There is nothing stopping you from assigning a Model member variable in
> > your controller, based on the session, then using that in your Model code as
> > needed.
> >
> > On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <
> > [EMAIL PROTECTED]> wrote:
> >
> > > Hello All,
> > >
> > > I want to thro a validation error if a user is not logged in. This is
> > > because i have a mechanism to display model validation errors in the view
> > > and dont want to add controller level error displaying handler. Please
> > > suggest that how can i proceed to check the session in the model. I dont
> > > think that it is possible to access Session component in the model. Is It?
> > >
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
> > >
> > >
> >
> >
> >
>
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
> >
>

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



Re: Propagating query string with paginator?

2008-03-06 Thread Lisa B

you can add stuff to the url of sort and nex/prev links with
paginator, it's in the api, so a sort table header maybe something
like:

$paginator->sort('no','Media.no',array('url'=>array($term)));

hope that helps..

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



override foreign key name with HABTM

2008-03-06 Thread Lisa B

In my project I can't use the default 'id' name for primary key
fields, I have to use 'no'.  I have to change a cake I already baked
from using 'no' to 'id' everywhere.  I hadn't customized it much and I
could easily change the database and everywhere I could see in the
views and models, and most pages work perfectly as before, except this
one where the join is a HABTM.

It is a dictionary app where a term can have many contexts and a
context many terms.  The query that is failing when I visit
/contexts/view/5 is still looking for an '_id' field on the join, like
this:

Query: SELECT `Term`.`no`, `Term`.`term`, `Term`.`term_nice`,
`Term`.`display`, `Term`.`import_date`, `ContextsTerm`.`context_no`,
`ContextsTerm`.`term_no` FROM `terms` AS `Term` JOIN `contexts_terms`
AS `ContextsTerm` ON (`ContextsTerm`.`context_no` IN (5) AND
`ContextsTerm`.`term_id` = `Term`.`no`)

In the view I'm not even trying to view the list of terms, I removed
that section from the view that it baked, so I wish it weren't trying
to do that query, but it's just a warning not an error, but that query
crops up and breaks on another page as well where I do need it and I
don't know where to look..  Perplexed, I am new to cake, thanks..

term.php:
class Term extends AppModel {
var $name = 'Term';
var $displayField = 'term_nice';
var $primaryKey = 'no';

var $hasAndBelongsToMany = array('Context' =>
array('className'=> 'Context',
 'joinTable' => 'contexts_terms',
 'conditions'   => '',
 'order'=> '',
 'foreignKey'   => 'term_no'
   )
);
}

context.php:
class Context extends AppModel {
var $name = 'Context';
var $displayField = 'name';
var $primaryKey = 'no';

var $hasAndBelongsToMany = array('Term' =>
array('className'=> 'Term',
 'joinTable' => 'contexts_terms',
 'conditions'   => '',
 'order'=> '',
 'foreignKey'   => 'context_no'
)
);
}


// I have modeled this so I can get easy pagination on another page
which is also broken on that join
class ContextsTerm extends AppModel {
var $belongsTo = array('Context','Term');
var $primaryKey = 'context_no';
}

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



Re: Bindable behaviour experts?

2008-03-06 Thread Baz
You don't really supply much useful information. But, maybe you're confused:

The bindable behavior doesn't dynamically bind stuff. It *restricts* you to
a subset of what is already defined. In other words, you can't add new
stuff.

So if AssocExpense and Account are not part of original assosiations, then
everything is going to be empty.

The purpose of the Bindable Behavior is so that you don't get ALL your
associations when you only want ONE or TWO.

On Thu, Mar 6, 2008 at 11:22 AM, the_woodsman <[EMAIL PROTECTED]>
wrote:

>
> Hi,
>
> I'm having problems with using restrict() to change my model bindings.
>
> I'm passing the following array into restrict:
>
> Array
> (
>[AssocExpense] => Array
>(
>[conditions] => Array
>(
>[ExpenseReconciliation.reconciliation_id] => 1
>[expense_id] => Array
>(
>[0] => 79
>)
>)
>)
>
>[Account] => Array
>(
>[fields] => Array
>(
>[0] => id
>[1] => Account.name` as `displayField
>[2] => date
>[3] => amount` as `value
>)
>)
> )
>
> When I dump the model after calling restrict(), all the relationships
> now appear empty(hasMany, etc).
>
> When I run findAll, none of it takes effect (none of my original
> relationship bindings work either) and no errors are thown.
>
> Any ideas? I have no real clue how to debug this, and I don't want to
> resort to bindModel etc.
>
> Cheers...
>
> >
>

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



Re: $this->create() //confusion

2008-03-06 Thread daphonz

I had a similar problem.  If you read the API entry for the create()
function, you'll see that it says it "Initializes the model for
writing a new record, loading the default values for those fields that
are not defined in $data."  So any default conditions you set in your
DB fields are auto-loaded into the Model's data variable.  I think
saveField then sees these entries and includes them in the save
action.  Why it does this, I'm not sure.

So yeah, you probably shouldn't use it before saveField.

If you want to be safe, you can wipe out the Model's data array before
using saveField, and then set the ID:

$this->ModelName->data = array();
$this->ModelName->id = $your_record_id;
$this->ModelName->saveField('field',$data);

And that should do it.

Casey

On Mar 5, 9:29 am, bingo <[EMAIL PROTECTED]> wrote:
> hi all,
>
> Can someone explain me when to use create() function.
>
> I believe it make sense to use it when adding a record. But should it
> be used before saving a particular field. It seems if you use create
> function before saveField, CakePHP update all the fields with default
> values. Is this an expected behaviour or some bug ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model->find('list') with conditions

2008-03-06 Thread Baz
Read the api:

find('list', array('conditions' => 'my conditions'))

On Thu, Mar 6, 2008 at 12:43 PM, Greg Baker <[EMAIL PROTECTED]>
wrote:

>
> Anybody know how to use Model->find('list') but supply conditions to
> that?
>
> Or
>
> Anybody know how to generate a similar list using another method so I
> can use conditions?
> >
>

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



Re: Best way to pass information from the app controller to the controllers

2008-03-06 Thread Dardo Sordi Bogado

Also maybe you are better wrapping that functionality in a component
(just a thought).

On Thu, Mar 6, 2008 at 1:53 PM, dr. Hannibal Lecter <[EMAIL PROTECTED]> wrote:
>
>  Is this what you need?
>
>  class AppController extends Controller
>  {
> var $_myPassedVar;
>
> function beforeFilter()
> {
> $this->_myPassedVar = 'somevalue';
>
>
> }
>  }
>
>  On Mar 6, 4:43 pm, CrazyDave <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  > Does anyone know the recommend or best way of passing information from
>  > the app_controller to the other controllers.  I'm probably missing
>  > something or overlooked something in the manual but I didn't see any
>  > clear defined root.
>  >
>  > I have an app_controller that processes certain params from the URL
>  > that are optionally present for all controllers.  These are used to
>  > get data from a model and then need to be access throughout the rest
>  > of the site controllers.
>  >
>  > What's the best way?
>  >
>  > Thanks,
>  > Dave
>  >
>  > http://youmuppet.com
>  >
>

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



Re: Model->find('list') with conditions

2008-03-06 Thread rtconner

->find('list', array('conditions'=>$conditions))

On Mar 6, 11:43 am, Greg Baker <[EMAIL PROTECTED]> wrote:
> Anybody know how to use Model->find('list') but supply conditions to
> that?
>
> Or
>
> Anybody know how to generate a similar list using another method so I
> can use conditions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Checking user session in model

2008-03-06 Thread Novice Programmer
$_SESSION... :(.. .This will even break cake paradigms along with the MVC
paradigms.. one on one free bonanza... :).. Just kidding..

On Fri, Mar 7, 2008 at 12:24 AM, MattC <[EMAIL PROTECTED]> wrote:

>
> Or you can cheat and use $_SESSION...but you didn't hear that from me.
>
> -Matt
> www.pseudocoder.com
>
> On Mar 6, 1:09 pm, Baz <[EMAIL PROTECTED]> wrote:
> > Anything is possible...
> >
> > But I think the general consensus is that you should not.
> >
> > With that said, please remember that with MVC we are still dealing with
> > classes, member variables and methods here.
> >
> > There is nothing stopping you from assigning a Model member variable in
> your
> > controller, based on the session, then using that in your Model code as
> > needed.
> >
> > On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > > Hello All,
> >
> > > I want to thro a validation error if a user is not logged in. This is
> > > because i have a mechanism to display model validation errors in the
> view
> > > and dont want to add controller level error displaying handler. Please
> > > suggest that how can i proceed to check the session in the model. I
> dont
> > > think that it is possible to access Session component in the model. Is
> It?
> >
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Saving two models from the same controller

2008-03-06 Thread Juan Luis Baptiste

Hi Casey,

On Thu, Mar 6, 2008 at 11:29 AM, daphonz <[EMAIL PROTECTED]> wrote:
>
>  Use two save commands:
>
>  $this->A->save($this->data['A']);
>  $this->A->B->save($this->data['B']);
>
>  I think there's a new(er) function called saveAll(), which should do
>  what you want automatically.  I'm not sure about the level of
>  implementation for that yet, though, it may only be in the latest beta
>  release.
>

That was my last resort, but I wanted to avoid it because there is
some logic before the save call in B controller that I was trying to
avoid duplicating in A controller. I'll take a look at that saveAll
method. It's implemented in the last released beta of 1.2 or is in the
repository ?


Thanks,
-- 
Juan Luis Baptiste

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



Re: Checking user session in model

2008-03-06 Thread Novice Programmer
Hello Baz,

What do you suggest then? Should i assign the value of error in controller
to the array that comes out from validation? Doesn't it break MVC paridigm.
I mean model is supposed to give us data and we are still not satisifed with
what it has outputted to us?

Thanks.

On Thu, Mar 6, 2008 at 11:39 PM, Baz <[EMAIL PROTECTED]> wrote:

> Anything is possible...
>
> But I think the general consensus is that you should not.
>
> With that said, please remember that with MVC we are still dealing with
> classes, member variables and methods here.
>
> There is nothing stopping you from assigning a Model member variable in
> your controller, based on the session, then using that in your Model code as
> needed.
>
> On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <
> [EMAIL PROTECTED]> wrote:
>
> > Hello All,
> >
> > I want to thro a validation error if a user is not logged in. This is
> > because i have a mechanism to display model validation errors in the view
> > and dont want to add controller level error displaying handler. Please
> > suggest that how can i proceed to check the session in the model. I dont
> > think that it is possible to access Session component in the model. Is It?
> >
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
> >
> >
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Checking user session in model

2008-03-06 Thread MattC

Or you can cheat and use $_SESSION...but you didn't hear that from me.

-Matt
www.pseudocoder.com

On Mar 6, 1:09 pm, Baz <[EMAIL PROTECTED]> wrote:
> Anything is possible...
>
> But I think the general consensus is that you should not.
>
> With that said, please remember that with MVC we are still dealing with
> classes, member variables and methods here.
>
> There is nothing stopping you from assigning a Model member variable in your
> controller, based on the session, then using that in your Model code as
> needed.
>
> On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <[EMAIL PROTECTED]>
> wrote:
>
> > Hello All,
>
> > I want to thro a validation error if a user is not logged in. This is
> > because i have a mechanism to display model validation errors in the view
> > and dont want to add controller level error displaying handler. Please
> > suggest that how can i proceed to check the session in the model. I dont
> > think that it is possible to access Session component in the model. Is It?
>
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model->find('list') with conditions

2008-03-06 Thread Greg Baker

Anybody know how to use Model->find('list') but supply conditions to
that?

Or

Anybody know how to generate a similar list using another method so I
can use conditions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking via web

2008-03-06 Thread Baz
Think you got the URL flipped:
http://codegen.devayd.com/

On Thu, Mar 6, 2008 at 7:53 AM, DanielZ <[EMAIL PROTECTED]> wrote:

>
>
>
> On 6 mar, 13:51, Greg Baker <[EMAIL PROTECTED]> wrote:
> > Is it possible to run the bake script through the web?  Is it strictly
> > a console app?
>
> Hey,
>
> check http://codegen.devyad.com
>
> regards
> dz
>
> >
>

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



Re: Checking user session in model

2008-03-06 Thread Baz
Anything is possible...

But I think the general consensus is that you should not.

With that said, please remember that with MVC we are still dealing with
classes, member variables and methods here.

There is nothing stopping you from assigning a Model member variable in your
controller, based on the session, then using that in your Model code as
needed.

On Thu, Mar 6, 2008 at 10:49 AM, Novice Programmer <[EMAIL PROTECTED]>
wrote:

> Hello All,
>
> I want to thro a validation error if a user is not logged in. This is
> because i have a mechanism to display model validation errors in the view
> and dont want to add controller level error displaying handler. Please
> suggest that how can i proceed to check the session in the model. I dont
> think that it is possible to access Session component in the model. Is It?
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
> >
>

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



Re: Excerpt functionality

2008-03-06 Thread Toon Gorissen

I managed to include the TextHelper in the controller, but I don't
understand where to actually use the excerpt function. I'm new to
CakePHP.

My controller:
var $helpers = array('Html','Javascript', 'Ajax', 'RfRating', 'Text');

My view:
echo("" . truncate($thisstory['Story']['plot']) . "");

But that doesn't seem to work:
Fatal error: Call to undefined function truncate() in /Applications/
MAMP/htdocs/metatube/app/views/stories/index.thtml on line 7

On 6 mrt, 18:36, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> Well, if your stories are plain text data, you need to use TextHelper
> (http://api.cakephp.org/1.2/class_text_helper.html) in your view. The
> ticket you posted is a patch for making excerpts of html data.
>
> Toon Gorissen wrote:
> > I'm using the following code in my stories_controller:
>
> > function index(){
> >    $stories = $this->Story->findAll(null, array('id', 'plot', 'author',
> > 'created'), 'created DESC');
> >    $stories_array = array();
> >    foreach($stories as $story){
> >            $story_id = $story['Story']['id'];
> >            $stories_array[$story_id] = $this->RfRating-
> > >getRatingInfo($story_id, $_SERVER['REMOTE_ADDR']);
> >    }
> >    //$this->set('stories', $this->Story->findAll(null, array('id',
> > 'plot', 'author', 'created'), 'created DESC'));
> >    $this->set('stories', $stories);
> >    $this->set('ratingInfo', $stories_array);
> > }
>
> > Now I would like to truncate (or make an excerpt of) the plot
> > variable. I've read a ticket on makings exerpts (https://
> > trac.cakephp.org/ticket/2306), but I don't quite understand how to
> > implement it.
>
> > Could someone help me? Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Shell function createFile() and the "dont_ask" variable

2008-03-06 Thread Sliv

Was just looking through this:

http://api.cakephp.org/1.2/shell_8php-source.html#l00410

I wanted to see if there was a way to override the prompt to overwrite
files when using bake in 1.2.6311  I noticed that in the "createFile"
function, there is a couple of lines for entering "a" to the overwrite
prompt and then setting a "dont_ask" variable. However, "a" isn't one
of the prompt options and there doesn't appear to be any other logic
that references "dont_ask".

Is this a bit of unfinished code or is it something that was
abandoned, etc?  I'm interested in the possibility of "cake bake all
modelName" overwriting files without prompting, so this peaked my
curiosity...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with parameter:value notation

2008-03-06 Thread Greg Baker

OMG nevermind I found the solution about 5 seconds after I posted
this...  $this->params

On Mar 6, 3:02 pm, Greg Baker <[EMAIL PROTECTED]> wrote:
> I can't seem to get parameter passing in URLs to work when using the
> ':' separator...
>
> $html->link(__('List Registration Fees', true), array('controller'=>
> 'registration_fees', 'action'=>'index', 'conference'=>
> $conference['Conference']['id']));
>
> generates a link like this:
>
> http://localhost/conferences/admin/registration_fees/index/conference...
>
> and in my admin_index($conference = null) {} method I echo out my
> $conference variable and its always empty...
> however if I change the URL to conference/47d02855-7270-430f-
> a533-2e55cabe3434 the echo works.
>
> So is there a special switch I have to turn on to get the former to
> work?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with parameter:value notation

2008-03-06 Thread Greg Baker

I can't seem to get parameter passing in URLs to work when using the
':' separator...

$html->link(__('List Registration Fees', true), array('controller'=>
'registration_fees', 'action'=>'index', 'conference'=>
$conference['Conference']['id']));

generates a link like this:

http://localhost/conferences/admin/registration_fees/index/conference:47d02855-7270-430f-a533-2e55cabe3434

and in my admin_index($conference = null) {} method I echo out my
$conference variable and its always empty...
however if I change the URL to conference/47d02855-7270-430f-
a533-2e55cabe3434 the echo works.

So is there a special switch I have to turn on to get the former to
work?

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



Re: Some doubts with Dynamic Content Localization

2008-03-06 Thread Fran Iglesias


El 06/03/2008, a las 9:57, ninjapiza escribió:

> What's your question about your doubt is with associated models ?

I don't know if the translate behavior is able to retrieve  
translations for the associated models. And if so, how?

>> Another bit confusing me after reading some tutorials is how to set a
>> default language for the behavior. I mean: is there a CakePHP setting
>> for this or you must set one of your own?.


For this, I found that Config.language is the key in Configure.

--
Fran Iglesias
[EMAIL PROTECTED]





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



Bindable behaviour experts?

2008-03-06 Thread the_woodsman

Hi,

I'm having problems with using restrict() to change my model bindings.

I'm passing the following array into restrict:

Array
(
[AssocExpense] => Array
(
[conditions] => Array
(
[ExpenseReconciliation.reconciliation_id] => 1
[expense_id] => Array
(
[0] => 79
)
)
)

[Account] => Array
(
[fields] => Array
(
[0] => id
[1] => Account.name` as `displayField
[2] => date
[3] => amount` as `value
)
)
)

When I dump the model after calling restrict(), all the relationships
now appear empty(hasMany, etc).

When I run findAll, none of it takes effect (none of my original
relationship bindings work either) and no errors are thown.

Any ideas? I have no real clue how to debug this, and I don't want to
resort to bindModel etc.

Cheers...

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



Re: another dumb question

2008-03-06 Thread dr. Hannibal Lecter

Is this what you were looking for:

$session->flash('auth');

?

On Mar 6, 6:26 pm, leo <[EMAIL PROTECTED]> wrote:
> I can't get the auth failure message to display. What do I have to put
> in my view file (if anything)? I can't seem to find anything in the
> docs.
>
> L
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Excerpt functionality

2008-03-06 Thread dr. Hannibal Lecter

Well, if your stories are plain text data, you need to use TextHelper
(http://api.cakephp.org/1.2/class_text_helper.html) in your view. The
ticket you posted is a patch for making excerpts of html data.

Toon Gorissen wrote:
> I'm using the following code in my stories_controller:
>
> function index(){
>   $stories = $this->Story->findAll(null, array('id', 'plot', 'author',
> 'created'), 'created DESC');
>   $stories_array = array();
>   foreach($stories as $story){
>   $story_id = $story['Story']['id'];
>   $stories_array[$story_id] = $this->RfRating-
> >getRatingInfo($story_id, $_SERVER['REMOTE_ADDR']);
>   }
>   //$this->set('stories', $this->Story->findAll(null, array('id',
> 'plot', 'author', 'created'), 'created DESC'));
>   $this->set('stories', $stories);
>   $this->set('ratingInfo', $stories_array);
> }
>
> Now I would like to truncate (or make an excerpt of) the plot
> variable. I've read a ticket on makings exerpts (https://
> trac.cakephp.org/ticket/2306), but I don't quite understand how to
> implement it.
>
> Could someone help me? Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



another dumb question

2008-03-06 Thread leo

I can't get the auth failure message to display. What do I have to put
in my view file (if anything)? I can't seem to find anything in the
docs.

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



Re: http authentication with php running under cgi

2008-03-06 Thread nate

From http://us.php.net/manual/en/features.http-auth.php:

"The HTTP Authentication hooks in PHP are only available when it is
running as an Apache module and is hence not available in the CGI
version."

On Mar 6, 5:22 am, Sebastian <[EMAIL PROTECTED]> wrote:
> anyone???
>
> On Mar 5, 9:53 pm, Sebastian <[EMAIL PROTECTED]> wrote:
>
> > Hi y'all,
>
> > I just deployed a cakePHP application to a client's fatcow webspace.
> > However, now the admin route's http authentication stopped working. In
> > the beforeFilter of the AppController I have:
>
> > if (isset($this->params['admin'])) {
> >             $this->Security->requireLogin(
> >             '*',
> >             array('users' => array("admin" => "password"),
> >             'type' => 'basic',
> >             'realm'=>'admin')
> >             );
> >             $this->Auth->allow();
> >             $this->layout = 'admin_default';
>
> > }
>
> > When I direct my browser to an admin page, I get the authentication
> > window, but when I put in admin and password the window just pops up
> > and prompts me over and over again.
> > I guess, fatcow is running its PHP under CGI. Could this be why the
> > Security component is bailing out now? Is there any way to get it
> > working again?
>
> > Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SWFUpload and CakePHP 1.2

2008-03-06 Thread Chris Hartjes

On Thu, Mar 6, 2008 at 6:11 AM, keerthi <[EMAIL PROTECTED]> wrote:
>
>  Please help me to find out some step-wise guide to implement SWFUpload
>  with CakePHP 1.2.
>
>  The bakery tutorial 
> http://bakery.cakephp.org/articles/view/swfupload-and-multipurpose-uploader
>  did not work for me.
>
>  I'm struggling with this for few days but still not successful.
>
>  Please mention even if is any alternative for this. Thanks

Does nobody know how to use a search engine any more?  C'mon people,
do some research before asking.  Or at least lie and say that you did.

I found this in under 5 seconds using Google and the phrase 'swfupload
cakephp 1.2'

http://www.pagebakers.nl/2006/12/19/swfupload-part-ii/

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Excerpt functionality

2008-03-06 Thread Toon Gorissen

I'm using the following code in my stories_controller:

function index(){
$stories = $this->Story->findAll(null, array('id', 'plot', 'author',
'created'), 'created DESC');
$stories_array = array();
foreach($stories as $story){
$story_id = $story['Story']['id'];
$stories_array[$story_id] = $this->RfRating-
>getRatingInfo($story_id, $_SERVER['REMOTE_ADDR']);
}
//$this->set('stories', $this->Story->findAll(null, array('id',
'plot', 'author', 'created'), 'created DESC'));
$this->set('stories', $stories);
$this->set('ratingInfo', $stories_array);
}

Now I would like to truncate (or make an excerpt of) the plot
variable. I've read a ticket on makings exerpts (https://
trac.cakephp.org/ticket/2306), but I don't quite understand how to
implement it.

Could someone help me? Thanks!

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



Checking user session in model

2008-03-06 Thread Novice Programmer
Hello All,

I want to thro a validation error if a user is not logged in. This is
because i have a mechanism to display model validation errors in the view
and dont want to add controller level error displaying handler. Please
suggest that how can i proceed to check the session in the model. I dont
think that it is possible to access Session component in the model. Is It?

-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Saving two models from the same controller

2008-03-06 Thread daphonz

Use two save commands:

$this->A->save($this->data['A']);
$this->A->B->save($this->data['B']);

I think there's a new(er) function called saveAll(), which should do
what you want automatically.  I'm not sure about the level of
implementation for that yet, though, it may only be in the latest beta
release.

Casey

On Mar 6, 11:19 am, "Juan Luis Baptiste" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I have two models that have associations between them. Let call them A
> and B. B has a belongsTo association with A and A has a hasMany
> association with B. For model A I have an action called "register" and
> the form in it's view has fields for both models so I can use the same
> for to save the info for both. Someone on IRC told me that cake was
> able to save both models when the method $this->A->save($this->data)
> was called but that isn't working for me, it only saves data for model
> A. I tried doing it the other way, adding the register action to B
> controller and doing $this->B->save($this->data) there but it doesn't
> work either. I also tried calling the add method in B controller from
> A controller but it seems that cake tries to excecute "add" as an SQL
> string and get an SQL error instead of calling the method.
>
> So is there a way to save both models from same controller ?
>
> Thanks,
> --
> Juan Luis Baptiste
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Saving two models from the same controller

2008-03-06 Thread Juan Luis Baptiste

Hi,

I have two models that have associations between them. Let call them A
and B. B has a belongsTo association with A and A has a hasMany
association with B. For model A I have an action called "register" and
the form in it's view has fields for both models so I can use the same
for to save the info for both. Someone on IRC told me that cake was
able to save both models when the method $this->A->save($this->data)
was called but that isn't working for me, it only saves data for model
A. I tried doing it the other way, adding the register action to B
controller and doing $this->B->save($this->data) there but it doesn't
work either. I also tried calling the add method in B controller from
A controller but it seems that cake tries to excecute "add" as an SQL
string and get an SQL error instead of calling the method.

So is there a way to save both models from same controller ?

Thanks,
-- 
Juan Luis Baptiste

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



Re: design guidance with respect to cakephp's automagic

2008-03-06 Thread Carlos Tejada

Are Counsellor and Coordinator two kind of users of your system?
If it is so, then you are talking about roles here. You can implement
roles using CakePHP's Access Control Lists (ACL).

For more information on Access Control Lists you can check the manual:
http://manual.cakephp.org/chapter/acl


On Mar 4, 5:31 am, chefsmart <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I just started out with cakePHP and am quite impressed by how much can
> be achieved in a short time.
>
> I'm stuck with a design issue and need some guidance. Please.
>
> Let's say I have two models: 1) Counsellor 2) Coordinator. There is a
> third model called Agency. An Agency can only be created by a
> Counsellor or a Coordinator. I need to store information in the
> database about each Agency's creator.
>
> Now if I call my database field agencies.createdby, how would I go
> about tying it up with cakePHP's convention? How would I go about
> determining whether the creator was a Counsellor or a Coordinator?
> Should I have two fields (coordinator_id, and counsellor_id) in the
> database in place of one createdby field?
>
> Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



i18n - translate behavior with associated models

2008-03-06 Thread ninjapiza

Hi,
I do not understand why the following code does not work properly.
I need help.

I use this Model Class :
class Product extends AppModel
{
var $name = 'Product';

var $hasOne = array(
'Post' =>
array('className'=> 'Post',
'dependent'=>  true,
'foreignKey'   => 'product_id')
);
}

And I I'd like to apply translation on this Model :
class Post extends AppModel
{
var $name = 'Post';
var $actsAs = array('Translate' => array(
'body' => 'TranslationPostBody'));

var $hasMany = array('Comment' =>
array(
'className' => 'Comment',
'conditions'=> '',//Comment.moderated = 1',
'order'   => 'Comment.created DESC',
'limit'   => '5',
'foreignKey'=> 'post_id',
'dependent' => true,
'exclusive' => false,
'finderQuery'   => '',
'fields'  => '',
'offset'  => '',
'counterQuery'  => ''
));
}

My Post.body data are well stored in database, in my i18n table.
But I can't get this data doing like that in my ProductsController
class:
$this->Product->id = $id;
$product = $this->Product->read();

$product['Post']['body'] is empty.

Why ? Any idea ?

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



Propagating query string with paginator?

2008-03-06 Thread sam

Hello, I am new to CakePHP and trying the following:

I have a search controller that redirects to the Model to be searched,
passing the search term a query string:

/cake/media/search?term=foo

Then from the search() method in the controller, I call

$this->set('media', $this->paginate(Medium, $conditionStr));

And the "search" view basically just includes the "index" view.

Now, what I'm looking for is how to modify my code so that the column
headings and the next page items etc in the index view automatically
include the search term parameter. For instance, the page 3 link
should link to /cake/media/search/page:3?term=foo instead of /cake/
media/search/page:3.

What's the Cake-way of doing this? Manually attaching
$_SERVER['QUERY_STRING'] seems very sloppy and it also includes the "?
url=media/search" parameter...

Thank you for your time!

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



SWFUpload and CakePHP 1.2

2008-03-06 Thread keerthi

Please help me to find out some step-wise guide to implement SWFUpload
with CakePHP 1.2.

The bakery tutorial 
http://bakery.cakephp.org/articles/view/swfupload-and-multipurpose-uploader
did not work for me.

I'm struggling with this for few days but still not successful.

Please mention even if is any alternative for this. Thanks

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



url internationalization

2008-03-06 Thread TriLLi

I need help
How can I tell cake that first paramter in routing is language
Router:Connect('/en/products/index/', Array('lang' =>'en',
'controller'=>'products', 'action'=>'index'));

so it can rewrite links in my views
$html->link(__('New Product', true), array('action'=>'add'));
so link can be
http://www.example.com/en/products/add

this is because I have dozen languages on web site...
npr for bosnian link should be

http://www.example.com/ba/proizvodi/dodaj

I have routing file filled with all routes
like
Router:Connect('/ba/products/pocetna/', Array('lang' =>'ba',
'controller'=>'products', 'action'=>'index'));

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



Re: Baking via web

2008-03-06 Thread DanielZ



On 6 mar, 13:51, Greg Baker <[EMAIL PROTECTED]> wrote:
> Is it possible to run the bake script through the web?  Is it strictly
> a console app?

Hey,

check http://codegen.devyad.com

regards
dz

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



Re: 'Notice: undefined index' only in baked views

2008-03-06 Thread J05hu4

Hi BeetleJuice,

I have the same problem using v1.1.19.6305. Can't tell if I have the
Bake script warning as I can't seem to find the php error log on my
local installation, it doesn't show the warning when baking.

Double checked the model relations and can't see any problem there,
baking seems to fail when it has to insert the hasOne-related fields.
My guess is it must be a Bake bug as the scaffolded views work fine.

Hopefully someone has a solution to share with us, until then I'm not
Baking anymore and correcting the Views by hand.

grtz, Joshua

On Feb 14, 12:50 pm, beetlejuice <[EMAIL PROTECTED]> wrote:
> hi all,
>
> i uses cake 1.1.19.6305 and got pb while baking views.
>
> i got 'Notice:Undefinedindex'
> when cake is trying to build a link to the view of an associated
> model.
> in the baked source of aindex.thtml, you clearly see the problem :
> e.g.
> link($catwalk['']['id'], '/admin/catwalkhomes/
> view/' .$catwalk['']['id'])?>
> instead of :
> link($catwalk['catwalkhomes']['id'], '/admin/
> catwalkhomes/view/' .$catwalk['catwalkhomes']['id'])?>
>
> i don't have this pb if i'm using 'pure' scaffolding
> so the pb must be in bake ?
>
> FYI : i got this warning (don't know if related)
> Warning: Invalid argument supplied for foreach() in D:\...
> \cake_1.1.19.6305\cake\scripts\bake.php on line 917
>
> what am i missing ?
> thanks in advance   :)

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



Re: Some doubts with Dynamic Content Localization

2008-03-06 Thread ninjapiza

Hi,
What's your question about your doubt is with associated models ?

On 26 fév, 13:34, Fran Iglesias <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to implement dynamic content localization in one project
> usingtranslatebehavior and the i18n table.
>
> One doubt is withassociatedmodels. Looking at theTranslate
> behavior code seems that at least hasMany associations could be
> managed by the behavior itself, but it's no clear to me how to
> achieve this in theactsAsarrayof the model. How to specify the
> field and FieldAssoc.
>
> Another bit confusing me after reading some tutorials is how to set a
> default language for the behavior. I mean: is there a CakePHP setting
> for this or you must set one of your own?.
>
> Thanks.
>
> --
> Fran Iglesias
> [EMAIL PROTECTED]

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



translate behavior and association model

2008-03-06 Thread ninjapiza

Hi,
I can't save my data in two locale.

I explain :
I use this translate behavior in my Post Model, in association with
Product Model:

class Post extends AppModel
{
var $name = 'Post';
var $actsAs = array('Translate' => array(
'body' => 'TranslationPostBody'));

var $hasMany = array('Comment' =>
array(
'className' => 'Comment',
'foreignKey'=> 'post_id'
));
}

class Product extends AppModel
{
var $name = 'Product';
var $hasOne = array(
'Post' =>
array('className'=> 'Post',
'conditions'   => '',
'order'=> '',
'dependent'=>  true,
'foreignKey'   => 'product_id')
);
}

In my ProductsController class, I use the following code to save my
data :
if (!$this->Product->Post->save($this->data)) {
$this->flash('Echec de sauvegarde du 
post','/products');
$error = true;
}
It works the first time, for instance when a use 'fre' locale. Data
are well stored in database, in i18N table.
The next time, I use 'eng' locale and It does not save my post. Why ?
I do not know how to debug this.

An idea ?

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



Re: Best way to pass information from the app controller to the controllers

2008-03-06 Thread dr. Hannibal Lecter

Is this what you need?

class AppController extends Controller
{
var $_myPassedVar;

function beforeFilter()
{
$this->_myPassedVar = 'somevalue';
}
}

On Mar 6, 4:43 pm, CrazyDave <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Does anyone know the recommend or best way of passing information from
> the app_controller to the other controllers.  I'm probably missing
> something or overlooked something in the manual but I didn't see any
> clear defined root.
>
> I have an app_controller that processes certain params from the URL
> that are optionally present for all controllers.  These are used to
> get data from a model and then need to be access throughout the rest
> of the site controllers.
>
> What's the best way?
>
> Thanks,
> Dave
>
> http://youmuppet.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking via web

2008-03-06 Thread Baz
Someone had developed a plugin that looked promising. But it wasn't well
publicized and had a weird name. Makes finding it rather difficult.

On Thu, Mar 6, 2008 at 8:06 AM, Chris Hartjes <[EMAIL PROTECTED]> wrote:

>
> On Thu, Mar 6, 2008 at 7:51 AM, Greg Baker <[EMAIL PROTECTED]>
> wrote:
> >
> >  Is it possible to run the bake script through the web?  Is it strictly
> >  a console app?
> >  >
>

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



Best way to pass information from the app controller to the controllers

2008-03-06 Thread CrazyDave

Hi,

Does anyone know the recommend or best way of passing information from
the app_controller to the other controllers.  I'm probably missing
something or overlooked something in the manual but I didn't see any
clear defined root.

I have an app_controller that processes certain params from the URL
that are optionally present for all controllers.  These are used to
get data from a model and then need to be access throughout the rest
of the site controllers.

What's the best way?

Thanks,
Dave

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



Re: CakePHP v1.2 stable enough for production?

2008-03-06 Thread dr. Hannibal Lecter

My share of shameless plugs:

http://dsi.vozibrale.com/articles/view/which-version-of-cakephp-is-good-for-you

On Mar 6, 3:30 pm, DragonI <[EMAIL PROTECTED]> wrote:
> Also check open bugs!https://trac.cakephp.org/report/1
>
> On Mar 6, 7:44 am, Greg Baker <[EMAIL PROTECTED]> wrote:
>
> > thanks for the tips.  sorry to rehash an already answered question.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



View this page "Cake Apps/Sites In The Wild"

2008-03-06 Thread Reggie Mason

Added http://www.todaysvalue.com - Realtor's Service - Find out how
much your home is worth today!

-reggieb

Click on http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild
- or copy & paste it into your browser's address bar if that doesn't
work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can't scaffold a table named line_items in cake_1.1.19.6305

2008-03-06 Thread Carlos Tejada

Two other bugs I found in version 1.1.19.6305 when using scaffold with
underscored table names can be fixed with the following changes:

Filename: %root%/cake/libs/view/templates/scaffolds/index.thtml line
68
$otherModelKey = Inflector::underscore($value['modelKey']);
to
$otherModelKey = $value['modelKey'];

Filename: %root%/cake/libs/view/templates/scaffolds/view.thtml line 51
$otherModelObject =&
ClassRegistry::getObject(Inflector::underscore($objModel-
>tableToModel[$value['table']]));
to
$otherModelObject =& ClassRegistry::getObject($objModel-
>tableToModel[$value['table']]);

%root% is your cake application root directory.

On Mar 5, 9:37 pm, Carlos Tejada <[EMAIL PROTECTED]> wrote:
> To fix the problem in version 1.1.19.6305 you have to change the
> following lines:
>
> Filename: %root%/cake/libs/controller/controller.php line 664
> $objRegistryModel =& ClassRegistry::getObject($modelKey);
> to
> $objRegistryModel =& ClassRegistry::getObject($model);
>
> Filename: %root%/cake/libs/view/templates/scaffolds/view.thtml line 30
> $objModel =& ClassRegistry::getObject($modelKey);
> to
> $objModel =& ClassRegistry::getObject($modelName);
>
> This bug has been fixed in version 1.2.0.6311 beta.
> %root% is your cake application root directory.
>
> [EMAIL PROTECTED] wrote:
> > CREATE TABLE IF NOT EXISTS `line_items` (
> >   `id` int(11) NOT NULL auto_increment,
> >   `title` varchar(32) NOT NULL,
> >   PRIMARY KEY  (`id`)
> > ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
>
> > The model in models/line_item.php:
> >  > class LineItem extends AppModel {
> >   var $name = 'LineItem';
> > }
> > ?>
>
> > The controller in controllers/line_items_controller.php
> >  > class LineItemsController extends AppController {
> >   var $name = 'LineItems';
> >   var $scaffold;
> > }
> > ?>
>
> > The errors fromhttp://localhost/line_items/:
> > Notice: Trying to get property of non-object in /home/scott/
> > public_html/cakeblog/cake/libs/controller/controller.php on line 666
>
> > Notice: Trying to get property of non-object in /home/scott/
> > public_html/cakeblog/cake/libs/controller/controller.php on line 666
>
> > Warning: Invalid argument supplied for foreach() in /home/scott/
> > public_html/cakeblog/cake/libs/controller/controller.php on line 666
>
> > Notice: Trying to get property of non-object in /home/scott/
> > public_html/cakeblog/cake/libs/controller/controller.php on line 801
>
> > Warning: Invalid argument supplied for foreach() in /home/scott/
> > public_html/cakeblog/cake/libs/controller/controller.php on line 801
>
> > The table displayed in the view doesn't have the 'id' or 'title'
> > column. What's wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking Cake with EasyPHP

2008-03-06 Thread Fahad

i installed joomla and phpbb too. they worked absolutely fine

according to the error report,
the problem occurs on cake/libs/class_registry.php on line 128.
any clue how it can be fixed (for wamp)?

On Mar 6, 8:32 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 6, 2008 at 7:36 AM, fahad19 <[EMAIL PROTECTED]> wrote:
>
> >  installed wampserver. the same problem exists here also.
> >  i think there must be something wrong with cake1.2 somewhere.
> >  isnt there anyone else having this problem?
>
> I'm thinking that if there was really a bug with CakePHP this severe,
> other people would've reported it.  Perhaps I have missed those
> anguished pleas for help on the mailing list.
>
> If you're getting the code itself being displayed in the browser, then
> your web server is not properly configured for serving up PHP pages.
>
> I know this is hard for some people to accept, but when there is a
> problem with a Cake application it is not always Cake's fault.
>
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking Cake with EasyPHP

2008-03-06 Thread Chris Hartjes

On Thu, Mar 6, 2008 at 7:36 AM, fahad19 <[EMAIL PROTECTED]> wrote:
>
>  installed wampserver. the same problem exists here also.
>  i think there must be something wrong with cake1.2 somewhere.
>  isnt there anyone else having this problem?
>

I'm thinking that if there was really a bug with CakePHP this severe,
other people would've reported it.  Perhaps I have missed those
anguished pleas for help on the mailing list.

If you're getting the code itself being displayed in the browser, then
your web server is not properly configured for serving up PHP pages.

I know this is hard for some people to accept, but when there is a
problem with a Cake application it is not always Cake's fault.

Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: how to include/escape html in .po files

2008-03-06 Thread leo

Forget it!
I ate my lunch and now it works!

On Mar 6, 12:10 pm, leo <[EMAIL PROTECTED]> wrote:
> Does anyone know how to enter html tagged strings in po files so that
> they come out unescaped (that is they display according to the
> markup)?
>
> I have tried this:
> Envia  -  (Envia with bold 'E' and bold 'a')
>
> which comes out like this:
> Envi<b>a</b>
>
> I know that somehow I need to escape the entities/chars, but my
> escapes get escaped. Is it escape proof? Do I need to wrap the __()
> function in something like htmlspecialchars_decode() ??
>
> All help appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP v1.2 stable enough for production?

2008-03-06 Thread DragonI

Also check open bugs! https://trac.cakephp.org/report/1

On Mar 6, 7:44 am, Greg Baker <[EMAIL PROTECTED]> wrote:
> thanks for the tips.  sorry to rehash an already answered question.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: spanning a form

2008-03-06 Thread Reggie Mason

bob,

Try the Wizard Component in the bakery - 
http://bakery.cakephp.org/articles/view/wizard-component
There is also a tutorial - 
http://bakery.cakephp.org/articles/view/wizard-component-tutorial

It already does what you want.  It controls the flow from one page to
the next, gives you callbacks for setting up and processing the wizard
pages.  And stores the data in a session variable for you.

-cjames

On Mar 5, 5:10 am, bob <[EMAIL PROTECTED]> wrote:
> In cakephp 1.2, if i submit a form from the view to the controller, the data
> will be stored in $this->data. But If I will to span the form across 2
> views, how would I keep the form data from the first view?
>
> For example, if I have controller A and add1 and add2 as the actions. I want
> to set it up so that I have a form in add1 which the user submits, then goes
> to add2. In add2, when the user submits the form, only at this point will I
> save all the data to the database.
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakephp 1.2 find('list') changing displayField

2008-03-06 Thread clrockwell

Works like a charm, thanks much Guillaume!

On Mar 6, 4:03 am, Guillaume <[EMAIL PROTECTED]> wrote:
> I think you just have to set the $displayField var in your model
> tag.php
>
> $displayField = 'word';
>
> Guillaume
> --http://cherryonthe.popnews.com
>
> On 6 mar, 03:25, clrockwell <[EMAIL PROTECTED]> wrote:
>
> > Using 1.2, i have a tag table that has two fields -> 'id' and 'word',
> > when i use $this->Tag->find('list'), the result is like:
> > 1 or Tag['id'] > option>
>
> > What I want is:
> > Parking or  > value=Tag['id']>Tag['word']
>
> > I tried using $this->Tag->find('list', array('word')), and 
> > $this->Tag->find('list', array('fields' => 'word'))
>
> > but neither return the desired results.
>
> > Thanks in advance for any direction you can give
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking via web

2008-03-06 Thread Chris Hartjes

On Thu, Mar 6, 2008 at 7:51 AM, Greg Baker <[EMAIL PROTECTED]> wrote:
>
>  Is it possible to run the bake script through the web?  Is it strictly
>  a console app?
>  --~--~-~--~~~---~--~~

Strictly console.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



RE: Alternative way of loading a model

2008-03-06 Thread Mariano Iglesias

Actually that should be:

$Model =& ClassRegistry::init('Model');

-MI

---

CakeFest Hispano: December, 2008 - Buenos Aires, Argentina -
http://es.cakefest.org

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

BAKE ON!

blog: http://www.MarianoIglesias.com.ar

-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Dr. Tarique Sani
Enviado el: Jueves, 06 de Marzo de 2008 10:28 a.m.
Para: cake-php@googlegroups.com
Asunto: Re: Alternative way of loading a model

Try App::Import('Model', 'Modelname'); or try to get an instance from
the ClassRegistry::getInstance( ) if the model already has an instance
but is not there in the controller for whatever reason


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



Re: Alternative way of loading a model

2008-03-06 Thread fahad19

thanks for your quick response.
can you please tell me how to use it?

is it like this?
test_controller.php
=
class TestController extends AppController
{
var $name = 'Test';
App::Import('Model', 'ModelName');
}
=

On Mar 6, 7:28 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 6, 2008 at 6:37 PM, fahad19 <[EMAIL PROTECTED]> wrote:
>
> >  is there any other way how you can load models in a controller without
> >  'var $uses'?
>
> Yes,
>
> Try App::Import('Model', 'Modelname'); or try to get an instance from
> the ClassRegistry::getInstance( ) if the model already has an instance
> but is not there in the controller for whatever reason
>
> HTH
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Alternative way of loading a model

2008-03-06 Thread Dr. Tarique Sani

On Thu, Mar 6, 2008 at 6:37 PM, fahad19 <[EMAIL PROTECTED]> wrote:
>
>  is there any other way how you can load models in a controller without
>  'var $uses'?

Yes,

Try App::Import('Model', 'Modelname'); or try to get an instance from
the ClassRegistry::getInstance( ) if the model already has an instance
but is not there in the controller for whatever reason

HTH

Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Re: Baking Cake with EasyPHP

2008-03-06 Thread fahad19

this is the output i receive when i visit this page:
http://localhost/cake1.2/comments/

===
(HTML output from browser source)

Fatal error:  Class 'Comment' not found in E:\wamp\www
\cake1.2\cake\libs\class_registry.php on line 128
===



Controller file:
comments_controller.php
===

===


Model file:
comment.php
===

===

On Mar 6, 6:36 pm, fahad19 <[EMAIL PROTECTED]> wrote:
> installed wampserver. the same problem exists here also.
> i think there must be something wrong with cake1.2 somewhere.
> isnt there anyone else having this problem?
>
> instead of loading the model files, their content (php code) appears
> right before the 'doctype' tag of html output.
> and cake says it cant load model files.
>
> i need to mention that cake1.1.x is also having this problem on
> wampserver2 and easyphp2
> cake1.1.x works fine on easyphp1.8
> but cake1.2.x crashes apache when run on easyphp1.8
>
> both the versions having problem when tested on easyphp2 and
> wampserver2
>
> On Mar 6, 4:34 pm, fahad19 <[EMAIL PROTECTED]> wrote:
>
> > have you used cake1.2 on XAMPP or Wampserver?
>
> > On Mar 6, 12:40 pm, Stephen Orr <[EMAIL PROTECTED]> wrote:
>
> > > Well, it could also be that EasyPHP just isn't very good.
>
> > > So far, my recommended WAMP setups are either XAMPP or Wampserver.
> > > I've had problems with several others, including Bitnami WampStack and
> > > EasyPHP.
>
> > > Steve
>
> > > On Mar 5, 9:15 pm, "Juan Luis Baptiste" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Wed, Mar 5, 2008 at 2:17 PM, fahad19 <[EMAIL PROTECTED]> wrote:
>
> > > > >  i just set up a basic model, and a 'scaffold' controller.
> > > > >  instead of loading the model, all the content of the 'model php file'
> > > > >  is shown in the 'html output' of cake.
>
> > > > Probably you don't have php support configured on apache.
>
> > > > Cheers,
> > > > --
> > > > Juan Luis Baptiste
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Alternative way of loading a model

2008-03-06 Thread fahad19

is there any other way how you can load models in a controller without
'var $uses'?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Baking via web

2008-03-06 Thread Greg Baker

Is it possible to run the bake script through the web?  Is it strictly
a console app?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP v1.2 stable enough for production?

2008-03-06 Thread Greg Baker

thanks for the tips.  sorry to rehash an already answered question.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking Cake with EasyPHP

2008-03-06 Thread fahad19

installed wampserver. the same problem exists here also.
i think there must be something wrong with cake1.2 somewhere.
isnt there anyone else having this problem?

instead of loading the model files, their content (php code) appears
right before the 'doctype' tag of html output.
and cake says it cant load model files.

i need to mention that cake1.1.x is also having this problem on
wampserver2 and easyphp2
cake1.1.x works fine on easyphp1.8
but cake1.2.x crashes apache when run on easyphp1.8

both the versions having problem when tested on easyphp2 and
wampserver2

On Mar 6, 4:34 pm, fahad19 <[EMAIL PROTECTED]> wrote:
> have you used cake1.2 on XAMPP or Wampserver?
>
> On Mar 6, 12:40 pm, Stephen Orr <[EMAIL PROTECTED]> wrote:
>
> > Well, it could also be that EasyPHP just isn't very good.
>
> > So far, my recommended WAMP setups are either XAMPP or Wampserver.
> > I've had problems with several others, including Bitnami WampStack and
> > EasyPHP.
>
> > Steve
>
> > On Mar 5, 9:15 pm, "Juan Luis Baptiste" <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Wed, Mar 5, 2008 at 2:17 PM, fahad19 <[EMAIL PROTECTED]> wrote:
>
> > > >  i just set up a basic model, and a 'scaffold' controller.
> > > >  instead of loading the model, all the content of the 'model php file'
> > > >  is shown in the 'html output' of cake.
>
> > > Probably you don't have php support configured on apache.
>
> > > Cheers,
> > > --
> > > Juan Luis Baptiste
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model related(hasMany) as condition of paginate

2008-03-06 Thread dandreta

Hi!
I have two models:(Client,purchase)
One client has many purchases.

In clients_controller:

If I want to paginate all clients with name John I do:
$this->paginate(array('Client.name' => 'John'))

But how can I paginate all clients who have bought a certain product
(for example, condition: purchase.name='car')?

Thanks and regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Session problems on redirect

2008-03-06 Thread Novice

Hello guys,

I got a hint to this... The session is there on the second page but
its like that the reading of the session variables fails when i try to
read it using $this->Session-read('User.info') Any idea on what
this might be.. and note that every thing works on my system it fials
on the production server. Please help.

Thanks.

On Mar 3, 10:58 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Any Help on this one? ME still stuck.. :(
>
> On Mon, Mar 3, 2008 at 9:50 PM, Novice Programmer <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Here is how i am writing the session variables.
>
> > if(($user = $this->User->validateLogin($this->data['User'])) == true) {
> > $this->Session->write('User', $user);
> > $this->Session->setFlash('You\'ve successfully logged
> > in.');
> > $this->redirect('/');
> >  }
>
> > The function validateLogin is as(please ignore typos etc.. all that is
> > working fine):
>
> > $user = $this->find(array('email_address' => $data['email_address'],
> >  'password' => 'password']), array('id', 'email_address'));
>
> >  if(empty($user) == false)
> >  return $user['User'];
>
> >  return false;
>
> > Here is how I read the session.. in the other controller ..
>
> > if ($this->Session->check('User')) {
> > $this->log('Got the user');
> > }
> > else {
> >  $this->log('No Session Yet');
> >   }
>
> > Thanks.
>
> > On Mon, Mar 3, 2008 at 9:43 PM, Novice Programmer <
> > [EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > using activate does not resolve the issue and i dont know that why i
> > > would need to call activate since activate is a turned on in core.php.
> > > Any other suggestions?
>
> > > Thanks.
>
> > > On Mon, Mar 3, 2008 at 9:43 AM, abiram <[EMAIL PROTECTED]> wrote:
>
> > > > Hai u use session->activate function
> > > > also see
> > > >http://groups.google.co.in/group/cake-php/browse_thread/thread/75946f...
>
> > > > On Mar 3, 2:58 am, "Novice Programmer" <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > Hello,
>
> > > > > I am facing session problems on redirection. The function
> > > > session->read()
> > > > > returns nothing on the session stored before redirection. I searched
> > > > on the
> > > > > google and found some solutions one of them was modifying htaccess
> > > > which i
> > > > > can't do because of shared host. Another was to put session id in
> > > > url which
> > > > > is not secure enough. Was wondering on how other people handle this
> > > > problem.
> > > > > Please help.
>
> > > > > --
> > > > > Thanks & Regards,
> > > > > Novice (http://ishuonweb.wordpress.com/).
>
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
>
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Pagination of temporary tables

2008-03-06 Thread leo

Thanks. In the end I did something very similar, creating a custom
page method with hardcoded SQL. It's not generic, but I only need it
for one view.

On Mar 4, 12:57 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Try implementing Model::paginate() and Model::paginateCount().
>
> On Tue, Mar 4, 2008 at 9:29 AM, leo <[EMAIL PROTECTED]> wrote:
>
> >  I have two problems (that I wish to talk about):
>
> >  1. I need to paginate the results from a temporary table.
>
> >  2. I need to incorporate a "SELECT DISTINCT" clause into the paginator
> >  query.
>
> >  Has anyone done either of these two or can anybody offer pointers as
> >  to what I should do? So far, I have created a model for the temporary
> >  table with a method that generates and executes the query.
>
> >  I don't want to spend hours trying to achieve an impossibility if my
> >  time would be better spent coding around this.
>
> >  Thanks,
>
> >  Leo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model associations to generate a history

2008-03-06 Thread Jon Bennett

>  http://cakeforge.org/projects/version/
>
>  You mean like that?

that would probably do the trick yes!

jb


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



how to include/escape html in .po files

2008-03-06 Thread leo

Does anyone know how to enter html tagged strings in po files so that
they come out unescaped (that is they display according to the
markup)?

I have tried this:
Envia  -  (Envia with bold 'E' and bold 'a')

which comes out like this:
Envi<b>a</b>

I know that somehow I need to escape the entities/chars, but my
escapes get escaped. Is it escape proof? Do I need to wrap the __()
function in something like htmlspecialchars_decode() ??

All help appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What am I doing wrong???

2008-03-06 Thread Dardo Sordi Bogado

First make sure you have enabled mod_rewrite and have write
permissions in app/tmp. Then point your webroot to /path/to/cake or to
/path/to/cake/app/webroot (the one you are using shoud work too, but
try another if don't). And if you don't want to read the manual, I
don't think I can help you further. Sorry, but many people have put a
big effort in making good quality docs and you are ignoring it.

On Thu, Mar 6, 2008 at 8:44 AM, damo <[EMAIL PROTECTED]> wrote:
>
>  thanks for your reply.
>
>  Am using CakePHP 1.2
>  the only files I have added are IAW with the aforementioned tutorial:
>  ~/app/controllers/items_controller.php   and
>  ~/app/models/item.php
>
>  I've set the apache document root to the /app directory of Cake, and
>  when I go localhost/item(s) I get no reply - not to my suprise as
>  there is no directory or anything else that seems to have been
>  created.
>
>  Will go through the above docs.  I have skipped through the manual, it
>  does seem a little all over the place at the moment, but I hope to
>  make sense of it.
>
>  Many thanks,
>  Damo.
>
>
>  On Mar 5, 2:52 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>  > Oh, I forgot:
>  >
>  > This are other important sources of information:
>  >
>  > http://book.cakephp.org(CakePHP 1.2 Manual, start by the blog 
> tutorial)http://manual.cakephp.org(CakePHP 1.2 Manual, start by the blog 
> tutorial)
>  >
>  > Ibm tutorial (5 part series, requieres free 
> registration):http://www.ibm.com/developerworks/edu/os-dw-os-php-cake1.html
>  >
>
> > On Wed, Mar 5, 2008 at 9:46AM, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote:
>  >
>  > > Ok, fist welcome to CakePHP ;)
>  >
>  > >  You seem to have installed cake properly, that's good. Now, if you
>  > >  don't show us what you have (models, controllers, database) and where
>  > >  (cake version also) we can do nothig for you.
>  >
>  > >  Anyway, from reading the pdf, you should point your browser to:
>  > >  http://localhost/items/. What do you see there? Also check the
>  > >  error_logs.
>  >
>
>
> > >  On Wed, Mar 5, 2008 at 3:31AM, damo <[EMAIL PROTECTED]> wrote:
>  >
>  > >  >  I'm a complete newbie to CakePHP, and also have very limited
>  > >  >  experience of this kind of thing... but I'm giving it a shot!
>  >
>  > >  >  So, I have MySQL, Apache and CakePHP all installed and seemingly
>  > >  >  working correctly.  I built a simple database and some PHP scripts 
> and
>  > >  >  that all worked fine. So cake is installed at /var/www/cake , and I
>  > >  >  have also set that up as the webroot.  I have 'AllowedOverride All'
>  > >  >  and configured the database.php.  It all works fine when I go to
>  > >  >  http://localhost- I get the 'Your database configuration file is
>  > >  >  present' and 'Cake is able to connect to the database' messages.
>  > >  >  Below that is a list of resources and no mention of the tmp directory
>  > >  >  is writable or cache is setup as I have seen in screenshots from
>  > >  >  walkthroughs.  So all seems to be fine.
>  >
>  > >  >  Now I follow the instructions in the following guide
>  > >  >  www.davidgoldingdesign.com/newbie-cakephp.pdf
>  >
>  > >  >  I have created all of the files correctly in /var/www/cake/app/
>  > >  >  controllers and /var/www/cake/app/models and so it should be creating
>  > >  >  a scaffolding for my table, but nothing changes.  When I go to the
>  > >  >  localhost/ it is exactly the same page displayed as is localhost/app.
>  > >  >  Localhost/items or localhost/app/items brings nothing, and no
>  > >  >  directories (or other files it seems) have been created.
>  >
>  > >  >  I would think that I need to 'execute' something, but nothing is
>  > >  >  outlined in the above document, or in another almost identical
>  > >  >  walkthrough I have gone through.  It is driving me slightly insane as
>  > >  >  I realise it is probably something so ridiculously simple.
>  >
>  > >  >  Any help will be most appreciated!!
>  >
>  > >  >  Damo
>  >
>

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



Re: What am I doing wrong???

2008-03-06 Thread damo

thanks for your reply.

Am using CakePHP 1.2
the only files I have added are IAW with the aforementioned tutorial:
~/app/controllers/items_controller.php   and
~/app/models/item.php

I've set the apache document root to the /app directory of Cake, and
when I go localhost/item(s) I get no reply - not to my suprise as
there is no directory or anything else that seems to have been
created.

Will go through the above docs.  I have skipped through the manual, it
does seem a little all over the place at the moment, but I hope to
make sense of it.

Many thanks,
Damo.

On Mar 5, 2:52 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Oh, I forgot:
>
> This are other important sources of information:
>
> http://book.cakephp.org(CakePHP 1.2 Manual, start by the blog 
> tutorial)http://manual.cakephp.org(CakePHP 1.2 Manual, start by the blog 
> tutorial)
>
> Ibm tutorial (5 part series, requieres free 
> registration):http://www.ibm.com/developerworks/edu/os-dw-os-php-cake1.html
>
> On Wed, Mar 5, 2008 at 9:46AM, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote:
>
> > Ok, fist welcome to CakePHP ;)
>
> >  You seem to have installed cake properly, that's good. Now, if you
> >  don't show us what you have (models, controllers, database) and where
> >  (cake version also) we can do nothig for you.
>
> >  Anyway, from reading the pdf, you should point your browser to:
> >  http://localhost/items/. What do you see there? Also check the
> >  error_logs.
>
> >  On Wed, Mar 5, 2008 at 3:31AM, damo <[EMAIL PROTECTED]> wrote:
>
> >  >  I'm a complete newbie to CakePHP, and also have very limited
> >  >  experience of this kind of thing... but I'm giving it a shot!
>
> >  >  So, I have MySQL, Apache and CakePHP all installed and seemingly
> >  >  working correctly.  I built a simple database and some PHP scripts and
> >  >  that all worked fine. So cake is installed at /var/www/cake , and I
> >  >  have also set that up as the webroot.  I have 'AllowedOverride All'
> >  >  and configured the database.php.  It all works fine when I go to
> >  >  http://localhost- I get the 'Your database configuration file is
> >  >  present' and 'Cake is able to connect to the database' messages.
> >  >  Below that is a list of resources and no mention of the tmp directory
> >  >  is writable or cache is setup as I have seen in screenshots from
> >  >  walkthroughs.  So all seems to be fine.
>
> >  >  Now I follow the instructions in the following guide
> >  >  www.davidgoldingdesign.com/newbie-cakephp.pdf
>
> >  >  I have created all of the files correctly in /var/www/cake/app/
> >  >  controllers and /var/www/cake/app/models and so it should be creating
> >  >  a scaffolding for my table, but nothing changes.  When I go to the
> >  >  localhost/ it is exactly the same page displayed as is localhost/app.
> >  >  Localhost/items or localhost/app/items brings nothing, and no
> >  >  directories (or other files it seems) have been created.
>
> >  >  I would think that I need to 'execute' something, but nothing is
> >  >  outlined in the above document, or in another almost identical
> >  >  walkthrough I have gone through.  It is driving me slightly insane as
> >  >  I realise it is probably something so ridiculously simple.
>
> >  >  Any help will be most appreciated!!
>
> >  >  Damo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking Cake with EasyPHP

2008-03-06 Thread fahad19

have you used cake1.2 on XAMPP or Wampserver?

On Mar 6, 12:40 pm, Stephen Orr <[EMAIL PROTECTED]> wrote:
> Well, it could also be that EasyPHP just isn't very good.
>
> So far, my recommended WAMP setups are either XAMPP or Wampserver.
> I've had problems with several others, including Bitnami WampStack and
> EasyPHP.
>
> Steve
>
> On Mar 5, 9:15 pm, "Juan Luis Baptiste" <[EMAIL PROTECTED]>
> wrote:
>
> > On Wed, Mar 5, 2008 at 2:17 PM, fahad19 <[EMAIL PROTECTED]> wrote:
>
> > >  i just set up a basic model, and a 'scaffold' controller.
> > >  instead of loading the model, all the content of the 'model php file'
> > >  is shown in the 'html output' of cake.
>
> > Probably you don't have php support configured on apache.
>
> > Cheers,
> > --
> > Juan Luis Baptiste
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   >