Friday, October 31, 2008

How to manage HABTM that is reflexive?

I have a table of users, and I want to make links between users, so
each user can have links to one or more other users. I can't see,
however, how to set this up in Cake. The linking table has two fields
that link to the Users table, but how to I create the correct model?

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

Re: Search Engine Bots Generating Strange Queries

Hi Mike,

Disallowing that in your robots.txt is a waste of time.

The robots.txt file was started by Google, and is not an officially
supported feature of all crawlers. So they don't have to follow it,
and I can tell you this doesn't sound like the google bot anyway,
because that bot doesn't generate phantom URIs.

Web crawlers can extract URIs from many different sources, and they
can generate URIs as they see fit. URIs can come from HTML, CSS, SWF,
JavaScript, and form post/get actions. I've even seen crawlers submit
post requests to generate more URIs to crawl.

Crawlers will also clean URIs removing ids, changing queries, fake
cookies, and sometimes rotate their IP address.

There are no rules about crawlers, no guidelines they have to follow,
or limits on how long they will crawl or how aggressively they will
request URIs from your server.

You should modify your Routes to point to a 404 if they request paths
that you don't want them to see.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Help with complex find() spanning several models

Awesome. Thanks.

On Oct 31, 4:37 pm, teknoid <teknoid.cake...@gmail.com> wrote:
> By default joins are only built for hasOne or belongsTo.
> Here's how to "trick" cake into building joins for deep model
> bindings:http://teknoid.wordpress.com/2008/07/17/forcing-an-sql-join-in-cakephp/
>
> there is another post on my blog if you search, which has a slightly
> more advanced example of the same principal.
>
> On Oct 31, 4:28 pm, 33rtp <aaronb...@gmail.com> wrote:
>
> > Thanks for the help teknoid.  I've done that, and I think there are
> > some possibilities there, but they are a little longer than I'd like.
>
> > For those who might come after this and not feel like reading the full
> > situation above, my question in a nut-shell really is:
>
> > How do you run a find on a field in a Model that is two associations
> > away rather than just one?
>
> > E.g. - When querying Post which belongsTo Artist which hasMany
> > Subscription, how do I compare a field in Post to a field in
> > Subscription?  Cake doesn't seem to want to create a second JOIN in
> > the SQL output.
>
> > On Oct 31, 3:28 pm, teknoid <teknoid.cake...@gmail.com> wrote:
>
> > > That's a lot to read, but I can point you in the direction of checking
> > > out the Containable behavior (in the manual).
> > > ... as well as really carefully reading up on the model associations
> > > and data retrieval.
>
> > > On Oct 31, 2:30 pm, 33rtp <aaronb...@gmail.com> wrote:
>
> > > > Hey all...
>
> > > > New to PHP, Cake, and MySQL so bear with me.
>
> > > > I've been searching high and low for the best way to make this query
> > > > work, but just haven't gotten it yet.
>
> > > > Here's my setup:
>
> > > > I have models for Users, Subscriptions, Authors, and Posts where:
> > > > User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
> > > > Author, HasMany Subscription (pk_Author.id,
> > > > fk_Subscription.author_id),
> > > > Author HasMany Post (pk_Author.id, fk_Post.author_id)
> > > > and all of the related BelongsTo's as well.
>
> > > > I want to search $this->User->Subscription->Author->Post (from the
> > > > UsersController) for all posts where the logged in user has a current
> > > > subscription to that(/those) author(s).
>
> > > > E.g. - ($this->Auth->user('id') = Subscription.user_id AND
> > > > Subscription.expiration_date >= date ('Y m d') AND
> > > > Subscription.author_id = Post.author_id).
>
> > > > Further, each Post contains a second field (INT) called
> > > > Post.access_level and this must be lower than the value stored in
> > > > Subscriptions.subscription_level.
>
> > > > The trick, of course, isn't just doing this, but doing it
> > > > efficiently.  Here are the options I've thought of.
>
> > > > - I could query $this->User->Subscriptions for relevant subscriptions
> > > > and return either the full array (set to $subscriptions) or a 'list'
> > > > of key/value pairs where key => author_id and value =>
> > > > subscription_level.  However, in issuing a second find() call to Post,
> > > > I don't know how I would compare the key/value pairs in the
> > > > $subscriptions array with the values for 'Post.author_id' and
> > > > 'Post.access_level' where the evaluation occurs at the row level in
> > > > $subscriptions.  With the find('all') array I mentioned first,
> > > > $subscriptions returns an array with [key][Subscription][field] so I
> > > > can't set conditions for 'Post.author_id' and 'Post.access_level'
> > > > without a foreach() which I don't want because of the extra database
> > > > queries it would generate.
>
> > > > -Alternately, I could use BindModel() to create a HABTM (or I could
> > > > just create it permanently in the models) relationship between
> > > > Subscription and Post.  This option requires an extra join table in my
> > > > database though, and may result in slower database queries as all the
> > > > joins are performed.  Additionally, there are other models (File,
> > > > Event, etc) that are owned by Author and each of these would require
> > > > an extra join table and HABTM relationship.  I could be wrong, but
> > > > doing all of this seems somehow redundant and there should be a more
> > > > elegant solution.
>
> > > > -There are also probably other ways using PHP functions to manipulate
> > > > the arrays after they have been returned from find calls (e.g.
> > > > Subscriptions->find w/ conditions and Post->find w/ conditions and
> > > > then some PHP array functions to compare those two arrays), but I'm
> > > > too new to this to know where to even start with that.
>
> > > > There's got to be a simple method I'm missing (or just don't know
> > > > about yet).  Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Test Suite and HABTM Models - Not Working

Thanks Anupom,

That got me past the missing table cake errors, but now 2/3 of the
tests that cake generated are failing.

Here is my post.test.php

App::import('Model', 'Post');


class PostTestCase extends CakeTestCase {
var $Post = null;
var $fixtures = array('app.post');

function start() {
parent::start();
$this->Post = & ClassRegistry::init('Post');
}

function testPostInstance() {
$this->assertTrue(is_a($this->Post, 'Post'));
}

function testPostFind() {
$results = $this->Post->recursive = -1;
$results = $this->Post->find('first');
$this->assertTrue(!empty($results));

$expected = array('Post' => array(
'id' => 1,
'name' => 'Lorem ipsum dolor sit amet'
));
$this->assertEqual($results, $expected);
}
}

The two cases that fail both reference testPostFind(). After a little
poking around, $this->Post->find('first') does not return anything at
all. The sql queries insert my data from the fixture and truncate it 3
times before finally dropping the tables. However, the query that I
believe is being generated from find('first') is being run on my
default connection, as opposed to the test connection. Shouldn't this
query be run on the test database since that's where the dummy data is
being inserted?

Any help is appreciated.

On Oct 31, 12:48 am, Anupom <anupom....@gmail.com> wrote:
> Hi Mike,
>
> I think the RC3 bake script still generates old style code, like the
> following -
>
> App::import('Model', 'Post');
>
> class TestPost extends Post {
>     var $cacheSources = false;
>     var $useDbConfig  = 'test_suite';
>
> }
>
> class PostTestCase extends CakeTestCase {
>     var $Post = null;
>     var $fixtures = array('app.post', 'app.tag');
>
>     function start() {
>         parent::start();
>         $this->Post = new TestPost();
>     }
> .....
> .....
> .....
>
> Unfortunately this old style is redundant and does not work with
> associations (without some hacks). But GOOD news is that - Tim and Nate have
> come up with an even better solution and that works with associations
> flawlessly. Edit your test files and make it like the following - it's gonna
> work like a charm.
>
> App::import('Model', 'Post');
>
> class PostTestCase extends CakeTestCase {
>     var $Post = null;
>     var $fixtures = array('app.post', 'app.tag');
>
>     function start() {
>         parent::start();
>         $this->Post =& ClassRegistry::init('Post');
>     }
> .....
> .....
> .....
>
> Read Tim's blog on this for more info.http://debuggable.com/posts/testing-models-in-cakephp---now-let%27s-g...
>
>
>
> On Fri, Oct 31, 2008 at 3:18 AM, MikeB <bern...@gmail.com> wrote:
>
> > I'm having a problem with the Cake Test Suite throwing errors about
> > HABTM join tables not being found. I've successfully recreated the
> > problem on a much smaller scale.
>
> > I've created a very basic 3 table database:
>
> > posts (id, name)
> > posts_tags (post_id, tag_id)
> > tags (id, name)
>
> > I've baked each model without incident. When I go to test.php and try
> > to run the post.test.php test that was generated for me, it gives me
> > this error:
>
> > Error:  Database table posts_tags for model PostsTag was not found.
>
> > I'm using a default AND test db connection.
> > Cake 1.2 rc3
> > CakePHP Test Suite v 1.2.0.0
> > SimpleTest v1.0.1
>
> > Keep in mind that I have not touched any of these files. They are all
> > freshly baked out the oven.
>
> > Any ideas?
>
> --
> Anupom Syamhttp://syamantics.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Jquery or Scriptalicious?

I perfer jQuery as well.
Many Bakers like prototype due to the javascript and ajax helpers that
come with CakePHP.
These make baking with JS quite a bit easier, not to mention faster
however many Javascript experts would cringe to think that developers
are using php helpers for the behavioral portion of their sites
because the scripts are no longer unobtrusive.

jQuery is very easy to learn and uses many of the same selectors that
CSS 2 and 3 use making it incredibly easy to develop around.
However, if you require a JS helper there is a jQuery helper for
CakePHP called pQuery.
http://www.ngcoders.com/php/pquery-php-and-jquery

If not then spend some time at the jQuery API and read through the
tutorials.
http://docs.jquery.com/Main_Page

I love jQuery.

On Oct 30, 5:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
> Hello,
>
> I'm gonna create a web app using CakePHP but I'm confused about
> chosing between Jquery or Scriptalious? Which one should I choose?
> Does it really matter? What's the differences between them?
>
> tks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Fatal error Call to undefined method Controller Html()

> <?php echo $html->link('Activate account',
> array('controller'=>'users', 'action' => 'activate', $userid); ?>

^
it's missing a close bracket here ---------------------------------^

anyway:

> Is there a way the above can be used to print out an absolute url ?

$html->link('Activate account', $html-
>url(array('controller'=>'users', 'action' => 'activate', $userid),
true));
or
$html->link('Activate account',
Helper::url(array('controller'=>'users', 'action' => 'activate',
$userid), true));
or
$html->link('Activate account',
Router::url(array('controller'=>'users', 'action' => 'activate',
$userid), true));

-the boring explanation:
you can use Router::url/Helper::url passing true as the second param
to get the full route out of the url you passed in the first param.
in case you ever extend Helper::url on AppHelper, use $html->url()
to use the overrided method.

LAST BUT CERTAINLY NOT LEAST,
CakePHP has documentation and API specifications that cover this
feature, please refer to http://api.cakephp.org and http://manual.cakephp.org
as often as possible to get in touch with all the features, power and
might and magic of CakePHP.

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

Re: Fatal error Call to undefined method Controller Html()

Try putting 'full_base' => true to your url array.

I haven't tried this myself, but if I'm reading the source right, it
should work.

Hope that helps!

On Oct 31, 2:21 pm, Malcolm Krugger <chennaiprogram...@gmail.com>
wrote:
> <?php echo $html->link('Activate  account',
> array('controller'=>'users', 'action' => 'activate', $userid); ?>
>
> The above works perfect except the fact that it is not the absolute
> URL
>
> $userid by the way is a raw parameter which I want to pass to an
> action
>
> Is there a way the above can be used to print out an absolute url ?
>
> Thanks again
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Fatal error Call to undefined method Controller Html()

<?php echo $html->link('Activate account',
array('controller'=>'users', 'action' => 'activate', $userid); ?>

The above works perfect except the fact that it is not the absolute
URL

$userid by the way is a raw parameter which I want to pass to an
action

Is there a way the above can be used to print out an absolute url ?

Thanks again


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

Re: Post Data

Maybe if I explain what I am doing better. Basically, I have a form
that asks for a birthday. We do not want the users to feel
uncomfortable by asking for thier year of birth so I have two drop
down boxes, one for the month (<select name='PostDobmonth'
id='PostDobmonth'>) and one for the year (<select name='PostDobday' id
= 'PostDobday' >). Then since the DB field is a date, I and creating
a default year by doing this:

$this->data['Customer']['dob'] = '1901'.$this-
>form['PostDobmonth'].'-'.$_POST['PostDobday'];

What is the correct format or way to use the form help and dropdown
boxes like this?

Thanks


On Oct 31, 8:25 am, "Gabriel Gilini" <gabr...@usosim.com.br> wrote:
> Are you building your form with the Form Helper? Because it seems to me that
> there are no naming conventions at all there.
>
> Cheers
>
> Gabriel Gilini
>
> www.usosim.com.br
> gabr...@usosim.com.br
> gabr...@souagil.com.br
>
>
>
> On Fri, Oct 31, 2008 at 9:46 AM, MDB <mdbev...@gmail.com> wrote:
>
> > The form values do not show up when I do that, they do when I do a
> > debug($this) and appear like this:
>
> > [form] => Array
> >                (
> >                    [Test1] => 04
> >                    [Test2] => 05
> >                )
>
> > How do I access these values?
> > I have tried $this->form and $_POST['Test1'] however I always get an
> > undefined index or property error.
>
> > On Oct 30, 9:21 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> > > add debug($this->data); to your controller that is receiving the
> > > submitted data. It will display the structure of $this->data
>
> > > On Oct 30, 6:59 am, MDB <mdbev...@gmail.com> wrote:
>
> > > > How do you get form data that is not part of a controller?  I have a
> > > > select / drop down box called dobDay, then in the controller, I have
> > > > tried $this->data['dobDay'], $_POST['dobDay'] and
> > $this->data['Customer']['dobDay'] (customer = name of form) and nothing
>
> > > > works.  Can someone please help? TIA- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Fatal error Call to undefined method Controller Html()

Perfect

Yes I have a component called Captcha

Oh silly me !


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

Re: Jquery or Scriptalicious?

Looks like I'm the only one who loves prototype here :)

Gabriel Gilini

www.usosim.com.br
gabriel@usosim.com.br
gabriel@souagil.com.br


On Fri, Oct 31, 2008 at 10:27 AM, Marcelius <mraaijmakers@gmail.com> wrote:

@Anupom: Any arguments?

Anupom schreef:
> I think PHP helper for writing Javascript is a very bad idea.
>
> On Fri, Oct 31, 2008 at 3:23 PM, martinp <hello@martinpetts.com> wrote:
>
> >
> > Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
> > Helper, I find JQuery so much easier to use that you don't really need
> > a helper.
> >
> > On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
> > wrote:
> > > jQuery .
> > >
> > > On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
> > >
> > > > Hello,
> > >
> > > > I'm gonna create a web app using CakePHP but I'm confused about
> > > > chosing between Jquery or Scriptalious? Which one should I choose?
> > > > Does it really matter? What's the differences between them?
> > >
> > > > tks
> > >
> >
>
>
> --
> Anupom Syam
> http://syamantics.com/



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

Re: Jquery or Scriptalicious?

@Anupom: Any arguments?

Anupom schreef:
> I think PHP helper for writing Javascript is a very bad idea.
>
> On Fri, Oct 31, 2008 at 3:23 PM, martinp <hello@martinpetts.com> wrote:
>
> >
> > Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
> > Helper, I find JQuery so much easier to use that you don't really need
> > a helper.
> >
> > On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
> > wrote:
> > > jQuery .
> > >
> > > On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
> > >
> > > > Hello,
> > >
> > > > I'm gonna create a web app using CakePHP but I'm confused about
> > > > chosing between Jquery or Scriptalious? Which one should I choose?
> > > > Does it really matter? What's the differences between them?
> > >
> > > > tks
> > >
> >
>
>
> --
> Anupom Syam
> http://syamantics.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Post Data

Are you building your form with the Form Helper? Because it seems to me that there are no naming conventions at all there.

Cheers

Gabriel Gilini

www.usosim.com.br
gabriel@usosim.com.br
gabriel@souagil.com.br


On Fri, Oct 31, 2008 at 9:46 AM, MDB <mdbevins@gmail.com> wrote:

The form values do not show up when I do that, they do when I do a
debug($this) and appear like this:

[form] => Array
               (
                   [Test1] => 04
                   [Test2] => 05
               )

How do I access these values?
I have tried $this->form and $_POST['Test1'] however I always get an
undefined index or property error.




On Oct 30, 9:21 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> add debug($this->data); to your controller that is receiving the
> submitted data. It will display the structure of $this->data
>
> On Oct 30, 6:59 am, MDB <mdbev...@gmail.com> wrote:
>
>
>
> > How do you get form data that is not part of a controller?  I have a
> > select / drop down box called dobDay, then in the controller, I have
> > tried $this->data['dobDay'], $_POST['dobDay'] and $this->data['Customer']['dobDay'] (customer = name of form) and nothing
>
> > works.  Can someone please help? TIA- Hide quoted text -
>
> - Show quoted text -



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

Re: Fatal error Call to undefined method Controller Html()

Helpers are not meant to be used in a controller, they are used in
your views/layouts/elements.

Could it be that you also have a component called Captcha? If you do,
that's the reason why $this->Captcha->show(); doesn't crash, but $this-
>Html('title' , ''); does.

On Oct 31, 1:15 pm, Malcolm Krugger <chennaiprogram...@gmail.com>
wrote:
> I have this
>
> var $helpers = array('Html', 'Form', 'Captcha');
>
> and now when I use
>
> $this->Captcha->show();  IT works perfectly..No issues there
>
> but when I use something like
>
> $this->Html('title' , '');
>
> The error given is
>
> Fatal error: Call to undefined method UsersController::Html()
>
> So what could be causing this error ?
>
> Any help would be greatly appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Fatal error Call to undefined method Controller Html()

I have this

var $helpers = array('Html', 'Form', 'Captcha');

and now when I use


$this->Captcha->show(); IT works perfectly..No issues there

but when I use something like

$this->Html('title' , '');

The error given is

Fatal error: Call to undefined method UsersController::Html()

So what could be causing this error ?

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

Re: Whats the best idea to keep DB under version control or under sync with server?

Joel, what advantages will cakephp-migrations provide over schema
shell?

On Oct 31, 2:31 pm, joelmoss <j...@developwithstyle.com> wrote:
> Take a look at this guys:http://code.google.com/p/cakephp-migrations/
>
> On Oct 31, 12:42 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>
> > I posted a small tutorial on same:
>
> >http://www.gigapromoters.com/blog/2008/10/30/how-to-keep-your-databas...
>
> > Hoping it will help others.
>
> > On Oct 30, 5:36 pm, Joel Perras <joelp...@gmail.com> wrote:
>
> > > Take a look at the built-in Cake schema shell.
>
> > > $ cake schema help
>
> > > -J.
>
> > > On Oct 30, 8:21 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>
> > > > I'm sorry this is not Cake related, but I feel its something which
> > > > most of developers are missing. I found info about Cake migrations and
> > > > think it would be too difficult to implement it in my team in short
> > > > time. What tools or techniques are you using to overcome this problem?
>
> > > > I'm aware of a tool called SqlYog or something, which is capable of
> > > > keeping database structured sync'ed from dev. machine to server, but
> > > > its paid, and I'm looking for some open source alternative, maybe a
> > > > simple PHP script or something. Please let me know what do you guys
> > > > use and recommend for a small team?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Post Data

The form values do not show up when I do that, they do when I do a
debug($this) and appear like this:

[form] => Array
(
[Test1] => 04
[Test2] => 05
)

How do I access these values?
I have tried $this->form and $_POST['Test1'] however I always get an
undefined index or property error.


On Oct 30, 9:21 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> add debug($this->data); to your controller that is receiving the
> submitted data. It will display the structure of $this->data
>
> On Oct 30, 6:59 am, MDB <mdbev...@gmail.com> wrote:
>
>
>
> > How do you get form data that is not part of a controller?  I have a
> > select / drop down box called dobDay, then in the controller, I have
> > tried $this->data['dobDay'], $_POST['dobDay'] and $this->data['Customer']['dobDay'] (customer = name of form) and nothing
>
> > works.  Can someone please help? TIA- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

The Cake way of doing this? Multiple models accessing a huge dataset

I am wondering did i chose the Cake way of doing things with this, or
atleast close :)

We have multiple models, all of which access same set of tables
handling massive amounts of data, searched using fulltext indexes.
There's additions, searches, modifies etc. from 2 different models, ah
but there's a gotcha! Most of these searches are slightly different,
along with some of the inserts.

So what i opted to do about handling this dataset is build an
component used by the controllers. This component rarely contacts the
model, and only one of the models for some assisting functions for
some metadata to attach to the actual dataset.

Is the component way the cake way to do something like this?

Different main search types is 4, with variations for 2 different
models.
Different inserts 1 with 2 variations.
Modifying pages 1. (Same form and everything, just some data used to
check to which model uses that data)

So i've done a "simple" component with a helper class to handle all of
that :)

Using cake 1.1

Main goal when i code is to get short, simple pieces of code together.

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

Re: Question about Data Sanitation in CAKEPHP

Ok Many Thanks

On 31 Ott, 11:29, "Dardo Sordi Bogado" <dardoso...@gmail.com> wrote:
> > If I would sanitaze my input from javascript code?
>
> No, you need to escape whenever you send dynamic content to de user
> (though the form helper will escape the inputs values), use the
> builtin h() function.
>
> echo h($comment['Comment']['content']);
>
> If you want to strip the tags or other bad content and avoid it from
> beign stored (they will be escaped by the dbo layer but will get
> inserted in the db anyway) you need to use Sanitize::clean() or
> Sanitize::strip<What>() where what is any of Tags, Images, Scripts,
> Whitespace, All.
>
> HTH,
> - Dardo Sordi.
>
>
>
> > On 30 Ott, 18:57, Gwoo <gwoo.cake...@gmail.com> wrote:
> >> The DBO layer handles proper escaping of your data to prevent SQL
> >> injection. You do not need to use Sanitize unless you are doing
> >> something out of the ordinary.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Position of label on checkbox inputs

It is common practice to have labels for most form elements before
(above or to the left of) the element itself, except for radio buttons
and checkboxes, where the norm is for the label to be on the right.

[x] Bacon
[x] Eggs
[x] Sausages

easier to read than

Bacon [x]
Eggs [x]
Sausages [x]

I've never had a problem styling forms with the standard form helper
methods.

(On an unrelated note, are there any collections of CSS files for
cakephp forms? Might be a handy resource to create one. The bakery
style is ok, but a drop-in solution for columnar forms that work
directly with the form helper would be cool. A sort of "CSS Cake
Garden" if you will.)

hth
grigri

On Oct 31, 9:52 am, Tom Singer <tomsin...@gmail.com> wrote:
> Hi,
>
> Is there a reason $out is appended to the end in form->input when
> $type is set to checkbox? This behaviour is different to all the other
> types which place label before the input and is causing me issues with
> my layout. I can fix this by moving the out variable between $before
> and the checkbox but i don't want to do this if $out is at the end by
> design and this will break something. I have had no issues so far but
> this may break somethign i have not come across yet.
>
> I am using version 1.2.0.7296 RC2
>
> Thanks,
>
> Tom
>
> tom@bender:~/jobzone$ git diff cake/libs/view/helpers/form.php
> diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
> form.php
> index 33639b2..35d06c6 100644
> --- a/cake/libs/view/helpers/form.php
> +++ b/cake/libs/view/helpers/form.php
> @@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
>                                 unset($divOptions);
>                         break;
>                         case 'checkbox':
> -                               $out = $before . $this->checkbox($fieldName, $options) . $between . $out;
>
> +                               $out = $before . $out . $this->checkbox($fieldName, $options) . $between;
>
>                         break;
>                         case 'radio':
>                                 $out = $before . $out . $this-
>
> >radio($fieldName, $radioOptions, $options) . $between;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: An OO question

Well I guess its Halloween so we can expect a few (help) vampires
right? hehe!

On Oct 31, 4:04 am, Calvin <wmbdmw.d...@gmail.com> wrote:
> Hi all,
>
> I am finding difficult to understand why this isn't working...
>
> <?php
>
> abstract class A {
>     protected static $property = false; # Q1
>     public static function method() { # Q2
>         return self::$property;
>     }
>
> }
>
> class B extends A {
>     protected static $property = true; # Q1
>
> }
>
> var_dump(B::method());
>
> It prints False and I expect it to be True...
>
> Q1. Does B::$property suppose to overwrite B::$property?
> Q2. when B::method() is called, shouldn't it return B::$property (even
> though the method is declared in A)?
> Q3. Anyways to change the code to work as my expectation?
>
> Thanks in advance
>
> - Calvin

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

AW: Translation and placeholders

Found something for my porblem.

Seems the good old sprintf ist still the solutionfro general strings:
E.g.
sprintf(__('Wollen Sie # %s wirklich löschen?', true), $ort['id'])

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von Liebermann, Anja Carolin
Gesendet: Freitag, 31. Oktober 2008 11:48
An: cake-php@googlegroups.com
Betreff: Translation and placeholders


Hi everybody,

I need a hint how I get my variables into a translateed string.

E.g. (you surely know that one *g*)
'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%'

Where do %page% etc come from?

I have several strings like that:
$this->Session->setFlash(__('This image %name% already exists.', true));

So how can I get my variable in this string?

Thanks a lot in advance!

Anja

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

Re: Jquery or Scriptalicious?

> JQuery or Scriptalicious?

Mootools for me. But to each his own...

On Oct 31, 10:18 am, "Dardo Sordi Bogado" <dardoso...@gmail.com>
wrote:
> I think Jquery is better, based purely in that it's so easy and
> intuitive to use/extend that you will need no helper.
>
> On Fri, Oct 31, 2008 at 7:26 AM, Anupom <anupom....@gmail.com> wrote:
> > I think PHP helper for writing Javascript is a very bad idea.
>
> > On Fri, Oct 31, 2008 at 3:23 PM, martinp <he...@martinpetts.com> wrote:
>
> >> Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
> >> Helper, I find JQuery so much easier to use that you don't really need
> >> a helper.
>
> >> On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
> >> wrote:
> >> > jQuery .
>
> >> > On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
>
> >> > > Hello,
>
> >> > > I'm gonna create a web app using CakePHP but I'm confused about
> >> > > chosing between Jquery or Scriptalious? Which one should I choose?
> >> > > Does it really matter? What's the differences between them?
>
> >> > > tks
>
> > --
> > Anupom Syam
> >http://syamantics.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

AW: Delete Auth Cookie on Logout

Hi,

What I have:

function logout()
{
// Redirect users to this action if they click on a Logout button.
// All we need to do here is trash the session information:

$this->Session->delete('User');

// And we should probably forward them somewhere, too...

$this->redirect('/users/login');
}

So you can choose your favourite forwanrd and you should be happy.

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von thatsgreat2345
Gesendet: Donnerstag, 30. Oktober 2008 21:25
An: CakePHP
Betreff: Re: Delete Auth Cookie on Logout


Not redirecting to the login page fixed it, I plan on sending it to the homepage after logout but the home page hasn't been created yet thus why i was just sending it back to the login page.

On Oct 30, 1:22 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> I have logout going back to the login page if this is the problem xD
>
> On Oct 30, 1:22 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
>
> > When I do a pr of it , on logout it does a dump of all the data
> > still in the session.
>
> > Array
> > (
> >     [Config] => Array
> >         (
> >             [userAgent] => f221f8a145cf92f820aefa5fc4a585bb
> >             [time] => 1225399272
> >             [rand] => 1107590627
> >             [timeout] => 7
> >         )
>
> >     [Auth] => Array
> >         (
> >             [User] => Array
> >                 (
> >                     [id] => 1
> >                     [created] => 2008-10-29 14:43:47
> >                     [modified] => 2008-10-29 14:43:49
> >                     [username] => thatsgreat2345
> >                     [level] => 9
> >                     [email] => thatsgreat2...@gmail.com
> >                 )
>
> >         )
>
> >     [Message] => Array
> >         (
> >         )
>
> > )
>
> > On Oct 30, 12:56 pm, teknoid <teknoid.cake...@gmail.com> wrote:
>
> > > Auth doesn't set any cookies...
>
> > > logout() should handle deleting the session for you.
> > > try to pr($this->Session->read()); anywhere after logout and see
> > > what happens.
>
> > > maybe the problem is somewhere else
>
> > > On Oct 30, 3:13 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
>
> > > > I have a users controller that when logs in redirects to another
> > > > controller that manages the redirects so if an admin logs in it
> > > > sends them to the admin controller and if a customer logs in it
> > > > sends them to the customers controller. They both have different
> > > > access levels, so when I logout I want the cookie deleted but I
> > > > can't seem to achieve it.
> > > > I have session in the components. Just wondering how I can get
> > > > the session to be deleted.
> > > > The problem arising is that when I logout and try to login as a
> > > > different user with a different level of access it throws an
> > > > authError but when I try to login with the same username and
> > > > access level it sends me to the right place.
>
> > > >   function logout() {
> > > >          // $this->Session->del('CAKEPHP');
> > > >           $this->Session->destroy();
> > > >           $this->Session->setFlash('You have logged out.');
> > > >           $this->redirect($this->Auth->logout());
> > > >   }


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

Translation and placeholders

Hi everybody,

I need a hint how I get my variables into a translateed string.

E.g. (you surely know that one *g*)
'Page %page% of %pages%, showing %current% records out of %count% total,
starting on record %start%, ending on %end%'

Where do %page% etc come from?

I have several strings like that:
$this->Session->setFlash(__('This image %name% already exists.', true));

So how can I get my variable in this string?

Thanks a lot in advance!

Anja

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

Re: Question about Data Sanitation in CAKEPHP

> If I would sanitaze my input from javascript code?

No, you need to escape whenever you send dynamic content to de user
(though the form helper will escape the inputs values), use the
builtin h() function.

echo h($comment['Comment']['content']);

If you want to strip the tags or other bad content and avoid it from
beign stored (they will be escaped by the dbo layer but will get
inserted in the db anyway) you need to use Sanitize::clean() or
Sanitize::strip<What>() where what is any of Tags, Images, Scripts,
Whitespace, All.

HTH,
- Dardo Sordi.

>
> On 30 Ott, 18:57, Gwoo <gwoo.cake...@gmail.com> wrote:
>> The DBO layer handles proper escaping of your data to prevent SQL
>> injection. You do not need to use Sanitize unless you are doing
>> something out of the ordinary.
> >
>

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

Re: Jquery or Scriptalicious?

I think Jquery is better, based purely in that it's so easy and
intuitive to use/extend that you will need no helper.

On Fri, Oct 31, 2008 at 7:26 AM, Anupom <anupom.nsu@gmail.com> wrote:
> I think PHP helper for writing Javascript is a very bad idea.
>
> On Fri, Oct 31, 2008 at 3:23 PM, martinp <hello@martinpetts.com> wrote:
>>
>> Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
>> Helper, I find JQuery so much easier to use that you don't really need
>> a helper.
>>
>> On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
>> wrote:
>> > jQuery .
>> >
>> > On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
>> >
>> > > Hello,
>> >
>> > > I'm gonna create a web app using CakePHP but I'm confused about
>> > > chosing between Jquery or Scriptalious? Which one should I choose?
>> > > Does it really matter? What's the differences between them?
>> >
>> > > tks
>>
>
>
>
> --
> Anupom Syam
> http://syamantics.com/
>
> >
>

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

Re: Whats the best idea to keep DB under version control or under sync with server?

I've been using cake schema from the beginning and (except for some
small bugs already fixed) it worked great out of the box.
Cake schema rocks!

On Thu, Oct 30, 2008 at 9:01 PM, Abhimanyu Grover
<gigapromoters@gmail.com> wrote:
>
> Thanks, looks like Cake schema would be the only problem solver in my
> case.
>
> @the_woodsman give it a try, works very well with RC3.
>
> On Oct 30, 5:36 pm, Joel Perras <joelp...@gmail.com> wrote:
>> Take a look at the built-in Cake schema shell.
>>
>> $ cake schema help
>>
>> -J.
>>
>> On Oct 30, 8:21 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>>
>> > I'm sorry this is not Cake related, but I feel its something which
>> > most of developers are missing. I found info about Cake migrations and
>> > think it would be too difficult to implement it in my team in short
>> > time. What tools or techniques are you using to overcome this problem?
>>
>> > I'm aware of a tool called SqlYog or something, which is capable of
>> > keeping database structured sync'ed from dev. machine to server, but
>> > its paid, and I'm looking for some open source alternative, maybe a
>> > simple PHP script or something. Please let me know what do you guys
>> > use and recommend for a small team?
> >
>

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

Position of label on checkbox inputs

Hi,

Is there a reason $out is appended to the end in form->input when
$type is set to checkbox? This behaviour is different to all the other
types which place label before the input and is causing me issues with
my layout. I can fix this by moving the out variable between $before
and the checkbox but i don't want to do this if $out is at the end by
design and this will break something. I have had no issues so far but
this may break somethign i have not come across yet.

I am using version 1.2.0.7296 RC2

Thanks,

Tom


tom@bender:~/jobzone$ git diff cake/libs/view/helpers/form.php
diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
form.php
index 33639b2..35d06c6 100644
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
unset($divOptions);
break;
case 'checkbox':
- $out = $before . $this-
>checkbox($fieldName, $options) . $between . $out;
+ $out = $before . $out . $this-
>checkbox($fieldName, $options) . $between;
break;
case 'radio':
$out = $before . $out . $this-
>radio($fieldName, $radioOptions, $options) . $between;

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

Re: Whats the best idea to keep DB under version control or under sync with server?

Take a look at this guys: http://code.google.com/p/cakephp-migrations/


On Oct 31, 12:42 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
> I posted a small tutorial on same:
>
> http://www.gigapromoters.com/blog/2008/10/30/how-to-keep-your-databas...
>
> Hoping it will help others.
>
> On Oct 30, 5:36 pm, Joel Perras <joelp...@gmail.com> wrote:
>
> > Take a look at the built-in Cake schema shell.
>
> > $ cake schema help
>
> > -J.
>
> > On Oct 30, 8:21 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>
> > > I'm sorry this is not Cake related, but I feel its something which
> > > most of developers are missing. I found info about Cake migrations and
> > > think it would be too difficult to implement it in my team in short
> > > time. What tools or techniques are you using to overcome this problem?
>
> > > I'm aware of a tool called SqlYog or something, which is capable of
> > > keeping database structured sync'ed from dev. machine to server, but
> > > its paid, and I'm looking for some open source alternative, maybe a
> > > simple PHP script or something. Please let me know what do you guys
> > > use and recommend for a small team?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Jquery or Scriptalicious?

I think PHP helper for writing Javascript is a very bad idea.

On Fri, Oct 31, 2008 at 3:23 PM, martinp <hello@martinpetts.com> wrote:

Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
Helper, I find JQuery so much easier to use that you don't really need
a helper.

On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
wrote:
> jQuery .
>
> On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
>
> > Hello,
>
> > I'm gonna create a web app using CakePHP but I'm confused about
> > chosing between Jquery or Scriptalious? Which one should I choose?
> > Does it really matter? What's the differences between them?
>
> > tks




--
Anupom Syam
http://syamantics.com/

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

Re: Jquery or Scriptalicious?

Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
Helper, I find JQuery so much easier to use that you don't really need
a helper.

On Oct 31, 9:30 am, Gianluca Gentile <gianluca.gent...@gmail.com>
wrote:
> jQuery .
>
> On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
>
> > Hello,
>
> > I'm gonna create a web app using CakePHP but I'm confused about
> > chosing between Jquery or Scriptalious? Which one should I choose?
> > Does it really matter? What's the differences between them?
>
> > tks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Question about Data Sanitation in CAKEPHP

If I would sanitaze my input from javascript code?


On 30 Ott, 18:57, Gwoo <gwoo.cake...@gmail.com> wrote:
> The DBO layer handles proper escaping of your data to prevent SQL
> injection. You do not need to use Sanitize unless you are doing
> something out of the ordinary.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Admin + Members suggested setup??

Admin routing as more useful in a CMS-style site where there are
clearly two distinct areas.... display of site data, and administering
site data, which both could differ greatly in controller & view code,
rather than just acl & permissions.

Hope that clears things up.

Cheers,
Adam

On Oct 29, 6:33 am, Brenton B <brenton.bar...@gmail.com> wrote:
> Quick question as to what would be the best Cake-y setup:
>
> So I've got a list of Users who can either be Admin, Editors, or
> simply Members.
> Members can edit their own profiles, but Admin can also edit anyone's
> profile (at this point Editors are just normal Members with special
> status).
>
> When it comes to admin routing, should that only be used for strictly
> Admins and not Members?
> Ex:
> /profiles/edit -> what Members use and there's a check that the
> profile matches with the member
> /profiles/admin_edit -> only Admin uses this.
>
> And how would that all work with ACL? It seems like there's a wee bit
> of overlap here.
>
> How have people set this up?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Jquery or Scriptalicious?

Try em both. See you which you prefer.

But I vote for jquery. The jquery website is really good with loads of
links to tutorials and working examples of everything and even better
it is quick now too.

On Oct 30, 10:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
> Hello,
>
> I'm gonna create a web app using CakePHP but I'm confused about
> chosing between Jquery or Scriptalious? Which one should I choose?
> Does it really matter? What's the differences between them?
>
> tks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Admin + Members suggested setup??

Admin routing and ACL are two different things, admin routing is just
a "quick way" to have some action not accessible from everybody with a
few efforts.
And from what i know (but it should be cheched) at least in Cake 1.2
there's
also the availability of some "super_admin" methods.

Anyway a nice advantage in using admin routing, in respect of making
your own
checks, is that you can do ONCE in the before_filter action of the
AppController
(the controller from which every other controller inherits) the check,
and
you have to check only one param of the request: 'admin'.

Here an example:

class AppController extends Controller{

.........

function beforeFilter() {
// if admin pages are being requested
if(isset($this->params['admin'])){
if (!$this->Session->check('User')) {
// set flash message and redirect
$this->Session->setFlash('You need to be logged in to
access this area');
$this->redirect('/users/login/?redir='.$this->params['url']
['url'],true);
}
}

//If already logged in change the layout to admin
$this->layout='admin_theme';
}

.............

}


Of course this method can be used only for simple and small
applications,
if you need more complex authentication and authorization, you should
consider
using Auth and ACL components.

Bye,
Andrea

On Oct 30, 7:51 pm, Brenton B <brenton.bar...@gmail.com> wrote:
> Is the Admin routing intended as strictly for Root Admin? Or anyone
> that can log in? just seems a bit vague.
>
> On Oct 29, 11:54 am, Brenton B <brenton.bar...@gmail.com> wrote:
>
> > Essentially ... what makes the Admin Routing so special, and why
> > should I use it? What's the advantage over just having all the checks
> > in my own code? (ex: checks that they're logged in as admin and have
> > the right permissions)
>
> > On Oct 28, 1:33 pm, Brenton B <brenton.bar...@gmail.com> wrote:
>
> > > Quick question as to what would be the best Cake-y setup:
>
> > > So I've got a list of Users who can either be Admin, Editors, or
> > > simply Members.
> > > Members can edit their own profiles, but Admin can also edit anyone's
> > > profile (at this point Editors are just normal Members with special
> > > status).
>
> > > When it comes to admin routing, should that only be used for strictly
> > > Admins and not Members?
> > > Ex:
> > > /profiles/edit -> what Members use and there's a check that the
> > > profile matches with the member
> > > /profiles/admin_edit -> only Admin uses this.
>
> > > And how would that all work with ACL? It seems like there's a wee bit
> > > of overlap here.
>
> > > How have people set this up?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Admin + Members suggested setup??

I've created some sites with multiple admin routes (i.e. members and
admin) although only in 1.1 - there is an article about it in the
bakery: http://bakery.cakephp.org/articles/view/using-cake_admin-for-multiple-user-types
- it works very well.

I seem to remember reading that this is built in in 1.2, but haven't
tried this out yet - I imagine you would just specify an array of
possible routes in /config/core.php, but I could be wrong - although
it would be easy to find out...

Personally I would see it as working in a complementary with
permissions systems (ACL) so for instance you might specify a group
with access to the admin methods, a group with access to members
methods and then the methods that represent your public facing (and
authentication free) site. So in a way it a just about keeping things
nice and tidy. Use Auth to take care of a user login, but it is up to
you to decide where to let somebody go once they have logged in - I
would say that is what ACL is for.

Maybe it is more an issue of philosophy - you need to find a way of
working and structuring things that is good for you - even within the
constraints of Cake there are often many ways of doing things.

On Oct 28, 8:33 pm, Brenton B <brenton.bar...@gmail.com> wrote:
> Quick question as to what would be the best Cake-y setup:
>
> So I've got a list of Users who can either be Admin, Editors, or
> simply Members.
> Members can edit their own profiles, but Admin can also edit anyone's
> profile (at this point Editors are just normal Members with special
> status).
>
> When it comes to admin routing, should that only be used for strictly
> Admins and not Members?
> Ex:
> /profiles/edit -> what Members use and there's a check that the
> profile matches with the member
> /profiles/admin_edit -> only Admin uses this.
>
> And how would that all work with ACL? It seems like there's a wee bit
> of overlap here.
>
> How have people set this up?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Jquery or Scriptalicious?

jQuery .

On Oct 30, 11:49 pm, Matthieu <matthieu.aussag...@gmail.com> wrote:
> Hello,
>
> I'm gonna create a web app using CakePHP but I'm confused about
> chosing between Jquery or Scriptalious? Which one should I choose?
> Does it really matter? What's the differences between them?
>
> tks

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

Re: An OO question

On Oct 31, 5:04 am, Calvin <wmbdmw.d...@gmail.com> wrote:
> Hi all,
>
> I am finding difficult to understand why this isn't working...
>
> <?php
>
> abstract class A {
>     protected static $property = false; # Q1
>     public static function method() { # Q2
>         return self::$property;
>     }
>
> }
>
> class B extends A {
>     protected static $property = true; # Q1
>
> }
>
> var_dump(B::method());
>
> It prints False and I expect it to be True...
>
> Q1. Does B::$property suppose to overwrite B::$property?
> Q2. when B::method() is called, shouldn't it return B::$property (even
> though the method is declared in A)?
> Q3. Anyways to change the code to work as my expectation?
>
> Thanks in advance
>

May I ask why you're asking here? Are you using CakePHP at all?

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

Re: htaccess problems.

Hi there,

Can you please share your modified .htaccess file that you have inside your cake1.2 directory? I guess you have other .htaccess files inside your root or html directory? Can you tell us what's written inside those as well?

So my questions are if the .htaccess is necessary? good practice?

.htaccess is necessary for pretty URLs and is certainly a good thing to have :) You can though setup your cake to not to use .htaccess.

Also please check if apache rewrite module is turned on in your web server.

Thanks.
 
On Fri, Oct 31, 2008 at 9:40 AM, Todd M <toddmetcalf@gmail.com> wrote:

I'm finding problems with what I believe is with .htaccess in the
cake_install_directory.

My current web server only allows the /html directory as a HTML root.
To reduce complexity, I thought it would be good to start with
untaring the CakePHP in that directory.

so my directory appears something like this

/html
     /cake1.2
          /app
          /cake
          /docs
          /vendors
      /foobar

I've noticed in the past if I wanted to look at an html file in foobar
I had to use http://www.example.com/foobar

So I'm at step 4 in the documentation. I've confirmed with the web
server that has AllowOverride is set to All.

It seems that I can't do
http://www.example.com/cake1.2
http://www.example.com/cake1.2/index.php
or even
http://www.example.com/cake1.2/foo.html

The foo.html is just a hello world html file.

What I found is if I remove the .htaccess file I get a nice CakePHP
link telling my salt needs to be updated and that theres no connection
to DB.

So I went farther in the tutorial, I successfully linked DB & changed
salt word. Checked the http://www.example.com/cake1.2 and everything
looks fine, including DB is connected and no salt warning.

I did do a google search both here and the internet. I did find
something about adding a Rewritebase line to all 3 .htaccess, but not
sure if I did that correctly.  When I changed that, it seemed to just
go to a blank webpage. No errors or anything.

So my questions are if the .htaccess is necessary? good practice?





--
Anupom Syam
http://syamantics.com/

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

Multiple login system

Hi,

I am working on a site and want to implement two types of users with
different logins
like: http://www.naukri.com/
1. User Login
2. Business Login

Should I use Auth using ACL?

Also, please suggest if you have better solution for this ?

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

Thursday, October 30, 2008

Re: 404 Errors Stop Working When Using Auth Component

Here is how I fixed the above problem:

cake/libs/controller/components/auth.php - startup():
$isAllowed = (
$this->allowedActions == array('*') ||
in_array($controller->action, $this->allowedActions) ||
!method_exists($controller, $controller->action) // Let the user in
if the method does not exist; preserve 404s
);


On Oct 29, 5:02 pm, Rahil <rahilson...@gmail.com> wrote:
> Hi everyone,
>
> I'm using the Auth component and here is my beforeFilter() in my
> controller:
>
> function beforeFilter() {
>         $this->Auth->allow('*');
>         $this->Auth->deny('add', 'delete', 'edit');
>         $this->Auth->loginAction = '/users/login';
>
> }
>
> Now the problem is if I go to /controller/testing123, instead of
> giving me a 404 error, Auth takes over and redirects me to
> loginAction. I don't want people stumbling across my login form
> accidentally.
>
> How can I get 404 errors to start working again? Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Renaming cake folder

Thanks Jon.

It worked out not as i wanted because
the cake folder is still there i.e it is now /app_engine/cake

But i guess thats ok.

I appreciate your help :)

On Oct 30, 10:33 pm, Jon Molesa <rjmol...@gmail.com> wrote:
> Yeah, just rename it and then edit CAKE_CORE_INCLUDE_PATH index.php in
> webroot to use app_engine instead.
>
> *On Thu, Oct 30, 2008 at 07:10:17AM -0700 zorah <jed.tiotu...@gmail.com> wrote:
>
>
>
> > Date: Thu, 30 Oct 2008 07:10:17 -0700 (PDT)
> > From: zorah <jed.tiotu...@gmail.com>
> > Subject: Renaming cake folder
> > To: CakePHP <cake-php@googlegroups.com>
>
> > Hi Everyone,
>
> > Is there a way to rename the folder /cake to /app_engine or something
> > like that
>
> > Any input is appreciated.
>
> > Regards,
> > Jed
>
> --
> Jon Molesa
> rjmol...@consoltec.net
> if you're bored or curioushttp://rjmolesa.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Jquery or Scriptalicious?

JQuery is a complete Javascript library whereas Scriptaculous is a JS animation library  - which is kinda like addon to the Prototype library  ( they call it a framework though! ). How can we compare them, I think you want to chose between jQuery and Prototype+Scriptaculous?

My vote will definately go for jQuery. It's lightweight, it has got a much better selector, faster dom searching, better use of design patterns, thousands of plugins, fluent interface blah blah.. :)


On Fri, Oct 31, 2008 at 4:49 AM, Matthieu <matthieu.aussaguel@gmail.com> wrote:

Hello,

I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?

tks





--
Anupom Syam
http://syamantics.com/

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

Re: Test Suite and HABTM Models - Not Working

Hi Mike,

I think the RC3 bake script still generates old style code, like the following -

App::import('Model', 'Post');

class TestPost extends Post {
    var $cacheSources = false;
    var $useDbConfig  = 'test_suite';
}

class PostTestCase extends CakeTestCase {
    var $Post = null;
    var $fixtures = array('app.post', 'app.tag');

    function start() {
        parent::start();
        $this->Post = new TestPost();
    }
.....
.....
.....

Unfortunately this old style is redundant and does not work with associations (without some hacks). But GOOD news is that - Tim and Nate have come up with an even better solution and that works with associations flawlessly. Edit your test files and make it like the following - it's gonna work like a charm.
 
App::import('Model', 'Post');

class PostTestCase extends CakeTestCase {
    var $Post = null;
    var $fixtures = array('app.post', 'app.tag');

    function start() {
        parent::start();
        $this->Post =& ClassRegistry::init('Post');
    }
.....
.....
.....

Read Tim's blog on this for more info.
http://debuggable.com/posts/testing-models-in-cakephp---now-let%27s-get-rid-of-the-unnecessary-modeltest-classes-!:4890ed55-be28-4d4a-ba4c-7fd64834cda3

On Fri, Oct 31, 2008 at 3:18 AM, MikeB <bernat3@gmail.com> wrote:

I'm having a problem with the Cake Test Suite throwing errors about
HABTM join tables not being found. I've successfully recreated the
problem on a much smaller scale.

I've created a very basic 3 table database:

posts (id, name)
posts_tags (post_id, tag_id)
tags (id, name)

I've baked each model without incident. When I go to test.php and try
to run the post.test.php test that was generated for me, it gives me
this error:

Error:  Database table posts_tags for model PostsTag was not found.

I'm using a default AND test db connection.
Cake 1.2 rc3
CakePHP Test Suite v 1.2.0.0
SimpleTest v1.0.1

Keep in mind that I have not touched any of these files. They are all
freshly baked out the oven.

Any ideas?




--
Anupom Syam
http://syamantics.com/

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