Re: Check for neew with ajax

2008-06-21 Thread [EMAIL PROTECTED]

That's a really good idea, but I have never done this. Can you tell me
a bit more about the "{ move:[4, 1], to: [4, 3] } "? How do I use it?

On Jun 22, 3:58 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Why don't you poll for coordinates in JSON and update the board with 
> javascript?
>
> ie: advance the fifth pawn two positions:
>
> { move:[4, 1], to: [4, 3] }
>
>      0     1     2
>   +---+-+
> 0 |___|___|___
> 1 |     |      |
> 2
>
> On Sat, Jun 21, 2008 at 9:09 PM, [EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote:
>
> > I made a chess game using Ajax. It updates the table every 5 seconds.
> > The problem is that the HTML code for the table is huge and causes a
> > lot of bandwidth. Now I am thinking of a new method: polling server
> > for new moves in the game and update only if a move was done. But I
> > can't imagine any easy way for doing this.
> > What I want to do is: poll the server every 5 seconds and update
> > contents of a div tag only if any move has been done. Any help will be
> > appreciated.
> > Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Check for neew with ajax

2008-06-21 Thread Dardo Sordi Bogado

Why don't you poll for coordinates in JSON and update the board with javascript?

ie: advance the fifth pawn two positions:

{ move:[4, 1], to: [4, 3] }

 0 1 2
  +---+-+
0 |___|___|___
1 | |  |
2


On Sat, Jun 21, 2008 at 9:09 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I made a chess game using Ajax. It updates the table every 5 seconds.
> The problem is that the HTML code for the table is huge and causes a
> lot of bandwidth. Now I am thinking of a new method: polling server
> for new moves in the game and update only if a move was done. But I
> can't imagine any easy way for doing this.
> What I want to do is: poll the server every 5 seconds and update
> contents of a div tag only if any move has been done. Any help will be
> appreciated.
> Thanks in advance!
> >
>

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



Check for neew with ajax

2008-06-21 Thread [EMAIL PROTECTED]

I made a chess game using Ajax. It updates the table every 5 seconds.
The problem is that the HTML code for the table is huge and causes a
lot of bandwidth. Now I am thinking of a new method: polling server
for new moves in the game and update only if a move was done. But I
can't imagine any easy way for doing this.
What I want to do is: poll the server every 5 seconds and update
contents of a div tag only if any move has been done. Any help will be
appreciated.
Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: content-based ACL

2008-06-21 Thread mbavio

I was not talking about you, I was talking about the first response
you got, from leo, that is a common response in this topic.

Cheers,
mbavio

On Jun 21, 3:50 pm, gripen <[EMAIL PROTECTED]> wrote:
> > Latelly, I dont understand many users that complain about "ACL
> > Component is too hard, so I wont use it". The funny part is that they
> > end writing some system that is harder to get than Cake ACL
> > Componente, and absolutely cero re-usable. Come on, guys, it´s not
> > that hard, I dont consider myself a clever cake coder (actually, I
> > think I´m one of the dumbest :)) and I get it! It´s just a matter of
> > keep reading, and trying, and making mistakes, and it can be hard, but
> > the reward is not worrying about this topic anymore, because Cake
> > already solve for you!
>
> > Cheers,
> > mbavio
>
> Thanks for the idea. I was thinking about something similar.Actually I
> WANT to use ACL, that's the reason why I ask this question. I just
> wanted to know if someone else had the same problem and how he solved
> it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: have any project source code using CakePHP

2008-06-21 Thread uniacid

Theres tons of resources online and cakeforge is one of them, Is there
any specific solutions you are looking for?



On Jun 21, 9:31 am, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
> Here is a great place to find them :http://tinyurl.com/1c2
> You've got a page here (google groups) with apps built in cake and you
> have cakeforge.org - do some research/search before asking questions.
>
> On Sat, Jun 21, 2008 at 8:11 AM, sumon <[EMAIL PROTECTED]> wrote:
>
> > I m a beginner of cakephp. Now i need a prject which has completed
> > using CakePHP. Specially I m working on e-mail and chat management web
> > application. So if there have any source code (using CakePHP) plz send
> > me the link to download.
>
> > Cheers
>
> --
> Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



how to do custom exception handling

2008-06-21 Thread SajjadRaza

hi
can any one tell me abt the built in mechanism of
exception handling in cake php
thanks.

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



cake connect problem

2008-06-21 Thread surf5502

so i am trying to use the bakery in terminal. i have os x 10.5.2 and i
run MAMP (www.mamp.info) for my development environment. i had the
bakery working before and was able to bake one model fine, and then
when i tried to bake another model it couldnt find a table or
something and gave me all kinds of errors. i decided to start a new
project folder and just restart to see what would happen. i created a
project in the bakery in '/dev/iny' (cake console is in '/dev/cake/
cake/console'). got the thing working when i browse to http://localhost
i get that cake is able to connect the the database, but when i go
back to the bakery and execute 'cake bake model' while in '/dev/iny' i
get an error that it 'Can't connect to local MySQL server through
socket'. then it gives me a couple more warnings, claims 'Error: Your
database doesn't have any tables.' and it stops the script.

this is going on 2 days i hasnt worked and has been driving me crazy.
thanks in advance

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



Re: inserting more layers into cake php

2008-06-21 Thread Ian Zepp

Nate wrote:
> On Jun 20, 10:24 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
>> Unlike Zend (with uses an Action suffix to designate controller
>> actions), Cake doesn't have any such thing and instead uses a blacklist
>> of 'private' controller actions (defined in the dispatcher).
> 
> Here at the Cake project, we tend to prefer "simple and intuitive"
> over "ugly method names" and "extra pain in the ass that I shouldn't
> have to put up with".
> 

Wow, and I thought I was grumpy in the morning.

>> As such, be aware that new methods defined in the controller could
>> 'potentially' be called as an action, even if that is not the expected
>> behavior.
> 
> Yup, if they're public methods, they should be callable.  If they're
> private or protected methods, they should be prefixed with _.  Isn't
> it awesome that you don't have to be a rocket surgeon to use Cake?
> 

As mentioned in my other post, the prefix syntax makes sense, as long as 
you use it consistently.

As an aside and off the top of my head, the session component is an area 
that doesn't use it consistently:

Called from line 493 @ session.php, and defined in numerous places, are 
__gc, __open, __close, __read, __write, and __destroy. These are all 
private members, and prefixed as such, but called from a public static 
scope.

>> My firm actually uses a full-blown domain model / pattern, and uses Cake
>> only for the active record layer, while the Business Logic is largely
>> held in a separate layout above Cake's data access.
> 
> Nope.  See here: http://c7y.phparch.com/c/entry/1/art,mvc_and_cake

While an interesting read, I don't see how that applies to my statement. 
The page is about combining different named actions into a single 
'magic' action that auto-detects the content type and find parameters 
based on the request file extension.

It doesn't seem to deal at all with my comment about the separation 
between the data access layer (where the rows are received and mapped to 
active record objects), the Domain Object layer (where objects are not 
associated to table rows), and the Mapping Gateway between them.

For example, a Model is both an interface to a table, via the find 
methods, and a single row. I should not be able to call find on a row 
object.

Or am I completely misunderstanding the current Cake framework? Please 
correct me if I am.

> > 

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



Re: content-based ACL

2008-06-21 Thread gripen

> Latelly, I dont understand many users that complain about "ACL
> Component is too hard, so I wont use it". The funny part is that they
> end writing some system that is harder to get than Cake ACL
> Componente, and absolutely cero re-usable. Come on, guys, it´s not
> that hard, I dont consider myself a clever cake coder (actually, I
> think I´m one of the dumbest :)) and I get it! It´s just a matter of
> keep reading, and trying, and making mistakes, and it can be hard, but
> the reward is not worrying about this topic anymore, because Cake
> already solve for you!
>
> Cheers,
> mbavio

Thanks for the idea. I was thinking about something similar.Actually I
WANT to use ACL, that's the reason why I ask this question. I just
wanted to know if someone else had the same problem and how he solved
it.

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



Re: inserting more layers into cake php

2008-06-21 Thread Ian Zepp

Nate wrote:
> On Jun 21, 9:54 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
>> I do agree, on principle, that non-actions should be written as
>> protected or private methods. I'm was just pointing out the convention
>> differences (from Zend) and potential pitfalls of the cake dispatcher model.
>>
> 
> Uh, no?  Wrong?
> 
> You must be on a "special" PHP distro, because every version in the
> 5.x series that I've ever used throws a fatal error if you try to call
> a private method from outside the class it's declared in.
> 
> The only pitfalls in Cake's dispatcher are not paying attention, but
> that's gonna be a pitfall in pretty much any area of life.

Yes, I realized that after I hit send. I was thinking of non-static 
being called statically (not non-public being called publically).

> > 

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



Re: content-based ACL

2008-06-21 Thread mbavio

On Jun 20, 11:32 am, gripen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've spent a lot of time studying the ACL+auth, but I don't know how
> to implement a such thing: There will be several posts in section and
> I want to restrict access to those posts only for few chosen users.
> How sholud I set up ACL/auth to work this way?

You can set your own custom autentification method using ACL and Auth
in "controller" mode...

What I am thinking, set a tree of ACOs with Section as Father of
Posts, and then allow some Users to that Section... And use the
function isAuthorized to achieve the "is allowed?".

Latelly, I dont understand many users that complain about "ACL
Component is too hard, so I wont use it". The funny part is that they
end writing some system that is harder to get than Cake ACL
Componente, and absolutely cero re-usable. Come on, guys, it´s not
that hard, I dont consider myself a clever cake coder (actually, I
think I´m one of the dumbest :)) and I get it! It´s just a matter of
keep reading, and trying, and making mistakes, and it can be hard, but
the reward is not worrying about this topic anymore, because Cake
already solve for you!

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



Re: partial recursion?

2008-06-21 Thread Turnquist, Jonah

ok, sounds good to me! Thanx

Jonah

On Jun 21, 6:40 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
> As a general rule, cake needs to know the DB table layouts in order to
> perform queries. As you've seen, unbinding the model associations
> prevents Cake from joining the tables at query time.
>
> RE the describe, however, I wouldn't worry about it for two reasons:
>
> (a) DESCRIBE is essentially a no-cost operation to the DB server. The
> table schema is already stored in memory, so it is returning results
> instantly with o overhead.
> (b) DESCRIBE is cached in a production environment. Only in a dev
> environment are the results not cached, and hence re-fetched each time,
> so that if you make changes to the table schema they are immediately used.
>
> Turnquist, Jonah wrote:
> > Should not have posted so fast.  I seem to have found a solution:
>
> > $this->Script->unbindModel(
> >    array('belongsTo' => array('Category'))
> > );
>
> > That temporally removes the relationship.  Works perfectally to remove
> > the extra join.  But it still performs quarry #2, "DESCRIBE
> > `categories`".  humph.  Why does it do that?
>
> > Thanks,
> > Jonah
>
> > On Jun 20, 9:54 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
> >> BTW i am using CakePHP 1.2
>
> >> On Jun 20, 9:33 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> >>> Ok, so I have a Scripts table, holding php script entries (tutorials),
> >>> a Categories table, and a Users table.  Each script has a category and
> >>> a user.  I have all the hasMany belongsTo etc set up properly.
> >>> On my /scripts page, under the index action it lists all of the
> >>> scripts, displaying the script title, and it's user that created it,
> >>> but not it's category.  So it should not even fetch category data.  So
> >>> this is what it needs to fetch:
> >>> [0] => Array
> >>>     (
> >>>         [Script] => Array
> >>>             (
> >>>                 [id] => 1
> >>>                 [title] => DB connect
> >>>                 [created] => 2001-06-18 16:05:40
> >>>                 [description] => This class that will connect to the
> >>> database test
> >>>             )
> >>>          [User] => Array
> >>>             (
> >>>                 [name] => man
> >>>                 [id] => 1
> >>>             )
> >>>     )
> >>> The find() code that is working and doing the above:
> >>> $this->set('scripts', $this->Script->find('all', array(
> >>>         //'recursive' => -1, //this is commented out
> >>>         'fields' => array('Script.id', 'Script.title', 'Script.created',
> >>> 'Script.description', 'User.name', 'User.id'),
> >>>         )
> >>> ));
> >>> Setting the 'fields' option kept it from returning any categories
> >>> data.
> >>> This successfully returns the correct data.  BUT, when I looked at the
> >>> quarries, I saw a problem:
> >>> 1)   DESCRIBE `scripts`
> >>> 2)   DESCRIBE `categories`  //not needed!
> >>> 3)   DESCRIBE `users`
> >>> 4)   SELECT `Script`.`id`, `Script`.`title`, `Script`.`created`,
> >>> `Script`.`description`, `User`.`name`, `User`.`id` FROM `scripts` AS
> >>> `Script` LEFT JOIN `categories` AS `Category` ON
> >>> (`Script`.`category_id` = `Category`.`id`) LEFT JOIN `users` AS `User`
> >>> ON (`Script`.`user_id` = `User`.`id`) WHERE 1 = 1  //excessive!
> >>> You see, it is doing a left join on categories in quarry #4, and
> >>> quarry #2 is not even needed.  I understand joins can be slow.  Thus I
> >>> am asking how can I get rid of it
> >>> I tried setting the option 'recursive' => -1 (you can see it commented
> >>> out), but that obviously stops it from collecting the user data too.
> >>> So I guess what I need is a partial recursion?  So it performs
> >>> recursion to the Users table but not the Categories table?  How can
> >>> this be done? any ideas?
> >>> Thanks,
> >>> Jonah (is very new to cake BTW, try not to use big words lol
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routes issue.

2008-06-21 Thread Manu0310

Thanks for the response, it helps a lot .

I will rethink the routes issue

Great input!

On Jun 21, 9:35 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
> What you want is a route that defines a single-part URL as defaulting to
> the users controller:
>
> Router::connect('/:action', array( 'controller' => 'users' ));
>
> And it needs to be at the top of the routes file, because the Router
> scans from the top down.
>
> HOWEVER, you can't do this:
>
> Router::connect('/:action/*', array( 'controller' => 'users' ));
>
> Because then the router doesn't know the difference between these two
> routes:
>
> (1) /someAction/someId
> (2) /otherController/someAction
>
> In case (1), the router defaults to the users controller, but case (2)
> actually defines the controller to use. In this scenario, whichever
> route is matched first in the routes.php file will be the one that
> sticks. So don't ever get the order screwed up, or your routing will break.
>
> I don't personally suggest doing it the way you are trying. Define a URL
> standard that is appropriate for your site and stick with it, but it
> should be flexible enough to allow future growth without having to
> constantly redefine routes.
>
> As you say, you don't want to define routes for every action.
>
> Manu0310 wrote:
> > Hey I tried it and it works, thanks a lot.
>
> > The only small thing is that for every action I define in the users
> > controller I need to add to the routes.
>
> > Router::connect('/login', array('controller' => 'users', 'action' =>
> > 'login'));
>
> > Router::connect('/home', array('controller' => 'users', 'action' =>
> > 'home'));
>
> > etc ...
>
> > Is there any way to say any actions coming from the controller will
> > always have the above behavior, so that I can avoid having to add to
> > the routes for every action ?
>
> > Thanks a lot!
>
> > On Jun 21, 12:42 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> >> On Sat, Jun 21, 2008 at 10:03 AM, Manu0310 <[EMAIL PROTECTED]> wrote:
>
> >>> Router::connect('/users/:action/*', array('controller' => 'users'));
> >>> Router::connect('/*', array('controller' => 'users', 'action' =>
> >>> 'login'));
> >> Router::connect('/login', array('controller' => 'users', 'action' =>
> >> 'login'));
>
> >> T
>
> >> --
> >> =
> >> 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 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Missing database table

2008-06-21 Thread Siebren Bakker
@Joel
I'd never fully read the API documentation on Model::find and Model::findAll
before, thanks for the advice, find('all') works a lot better for what I
needed done!

In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

On Fri, Jun 20, 2008 at 12:58, Joel Perras <[EMAIL PROTECTED]> wrote:

>
> On Jun 20, 11:52 am, "Siebren Bakker" <[EMAIL PROTECTED]>
> wrote:
>
> > I'm not selecting more information than I need. findAll > find in most
> > situations, especially because of the recursive option.
>
> Really?  That's odd, because findAll() is nothing more than a
> (deprecated) wrapper for find('all').  Actually, there are things that
> you can do with Model::find('all', ..) that are impossible with
> Model::findAll(), such as providing options to the new Containable
> behavior.
>
> Read the API if you have some free time.  It's often quite
> enlightening.
>
> -Joel.
> >
>

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



Re: inserting more layers into cake php

2008-06-21 Thread Nate

On Jun 21, 9:54 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
>
> I do agree, on principle, that non-actions should be written as
> protected or private methods. I'm was just pointing out the convention
> differences (from Zend) and potential pitfalls of the cake dispatcher model.
>

Uh, no?  Wrong?

You must be on a "special" PHP distro, because every version in the
5.x series that I've ever used throws a fatal error if you try to call
a private method from outside the class it's declared in.

The only pitfalls in Cake's dispatcher are not paying attention, but
that's gonna be a pitfall in pretty much any area of life.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: inserting more layers into cake php

2008-06-21 Thread Nate

On Jun 20, 10:24 am, Ian Zepp <[EMAIL PROTECTED]> wrote:
> Unlike Zend (with uses an Action suffix to designate controller
> actions), Cake doesn't have any such thing and instead uses a blacklist
> of 'private' controller actions (defined in the dispatcher).

Here at the Cake project, we tend to prefer "simple and intuitive"
over "ugly method names" and "extra pain in the ass that I shouldn't
have to put up with".

> As such, be aware that new methods defined in the controller could
> 'potentially' be called as an action, even if that is not the expected
> behavior.

Yup, if they're public methods, they should be callable.  If they're
private or protected methods, they should be prefixed with _.  Isn't
it awesome that you don't have to be a rocket surgeon to use Cake?

> My firm actually uses a full-blown domain model / pattern, and uses Cake
> only for the active record layer, while the Business Logic is largely
> held in a separate layout above Cake's data access.

Nope.  See here: http://c7y.phparch.com/c/entry/1/art,mvc_and_cake
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Url problem

2008-06-21 Thread simonb

Whatever it is will most likely involve routes. You can do almost any
form of redirect with that.

Like Ian says, a little bit more information would help.

On Jun 21, 2:41 pm, Ian Zepp <[EMAIL PROTECTED]> wrote:
> You are going to have to provide more context than that, sorry.
>
> AbhinavZone wrote:
> > hi.
>
> > I am working on website in cakephp. everything is going fine.
> > but I got stuck with an issue.
>
> > 1. Client requirement is to rewrite all pages as
> >http://websitename.com/xx/yy.html
>
> > 2. Add back link to website such as
> >http://websitename.com/username
>
> > please help me out .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: inserting more layers into cake php

2008-06-21 Thread Ian Zepp

Marcin Domanski aka kabturek wrote:
> hey
> 
> On Jun 20, 4:24 pm, Ian Zepp <[EMAIL PROTECTED]> wrote:
>> Unlike Zend (with uses an Action suffix to designate controller
>> actions), Cake doesn't have any such thing and instead uses a blacklist
>> of 'private' controller actions (defined in the dispatcher).
> We don't ? We've got something that is called convention here ;)
> try calling a "__myAction" from the url.
> 

Perhaps I could have written more clearly. In the Dispatcher the test is 
called a $privateAction, and is checked on the presence of a '_' in the 
action.

See line 169 in libs/dispatcher.php (cake v1.2)

My blacklist comment comes from an older version of Cake, apparently. 
That particular portion is in 1.1 but doesn't seem to be in 1.2:

See line 171 in libs/dispatcher.php (cake v1.1)

>> As such, be aware that new methods defined in the controller could
>> 'potentially' be called as an action, even if that is not the expected
>> behavior.
> as long as you _don't_ follow the rules ;)

True, but that still doesn't change my statement. Only methods prefixed 
with a '_' are denied access. A function without a '_' is still a valid 
action to be called, even if it is not intended to be an action, and 
EVEN if it scoped as a protected or private member, since PHP5 still 
doesn't prevent you from calling private methods as public. It just 
warns you if E_STRICT is on.

I do agree, on principle, that non-actions should be written as 
protected or private methods. I'm was just pointing out the convention 
differences (from Zend) and potential pitfalls of the cake dispatcher 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: partial recursion?

2008-06-21 Thread Ian Zepp

As a general rule, cake needs to know the DB table layouts in order to 
perform queries. As you've seen, unbinding the model associations 
prevents Cake from joining the tables at query time.

RE the describe, however, I wouldn't worry about it for two reasons:

(a) DESCRIBE is essentially a no-cost operation to the DB server. The 
table schema is already stored in memory, so it is returning results 
instantly with o overhead.
(b) DESCRIBE is cached in a production environment. Only in a dev 
environment are the results not cached, and hence re-fetched each time, 
so that if you make changes to the table schema they are immediately used.

Turnquist, Jonah wrote:
> Should not have posted so fast.  I seem to have found a solution:
> 
> $this->Script->unbindModel(
>   array('belongsTo' => array('Category'))
> );
> 
> That temporally removes the relationship.  Works perfectally to remove
> the extra join.  But it still performs quarry #2, "DESCRIBE
> `categories`".  humph.  Why does it do that?
> 
> Thanks,
> Jonah
> 
> On Jun 20, 9:54 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>> BTW i am using CakePHP 1.2
>>
>> On Jun 20, 9:33 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>>
>>> Ok, so I have a Scripts table, holding php script entries (tutorials),
>>> a Categories table, and a Users table.  Each script has a category and
>>> a user.  I have all the hasMany belongsTo etc set up properly.
>>> On my /scripts page, under the index action it lists all of the
>>> scripts, displaying the script title, and it's user that created it,
>>> but not it's category.  So it should not even fetch category data.  So
>>> this is what it needs to fetch:
>>> [0] => Array
>>> (
>>> [Script] => Array
>>> (
>>> [id] => 1
>>> [title] => DB connect
>>> [created] => 2001-06-18 16:05:40
>>> [description] => This class that will connect to the
>>> database test
>>> )
>>>  [User] => Array
>>> (
>>> [name] => man
>>> [id] => 1
>>> )
>>> )
>>> The find() code that is working and doing the above:
>>> $this->set('scripts', $this->Script->find('all', array(
>>> //'recursive' => -1, //this is commented out
>>> 'fields' => array('Script.id', 'Script.title', 'Script.created',
>>> 'Script.description', 'User.name', 'User.id'),
>>> )
>>> ));
>>> Setting the 'fields' option kept it from returning any categories
>>> data.
>>> This successfully returns the correct data.  BUT, when I looked at the
>>> quarries, I saw a problem:
>>> 1)   DESCRIBE `scripts`
>>> 2)   DESCRIBE `categories`  //not needed!
>>> 3)   DESCRIBE `users`
>>> 4)   SELECT `Script`.`id`, `Script`.`title`, `Script`.`created`,
>>> `Script`.`description`, `User`.`name`, `User`.`id` FROM `scripts` AS
>>> `Script` LEFT JOIN `categories` AS `Category` ON
>>> (`Script`.`category_id` = `Category`.`id`) LEFT JOIN `users` AS `User`
>>> ON (`Script`.`user_id` = `User`.`id`) WHERE 1 = 1  //excessive!
>>> You see, it is doing a left join on categories in quarry #4, and
>>> quarry #2 is not even needed.  I understand joins can be slow.  Thus I
>>> am asking how can I get rid of it
>>> I tried setting the option 'recursive' => -1 (you can see it commented
>>> out), but that obviously stops it from collecting the user data too.
>>> So I guess what I need is a partial recursion?  So it performs
>>> recursion to the Users table but not the Categories table?  How can
>>> this be done? any ideas?
>>> Thanks,
>>> Jonah (is very new to cake BTW, try not to use big words lol
> > 

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



Re: Url problem

2008-06-21 Thread Ian Zepp

You are going to have to provide more context than that, sorry.

AbhinavZone wrote:
> hi.
> 
> I am working on website in cakephp. everything is going fine.
> but I got stuck with an issue.
> 
> 
> 1. Client requirement is to rewrite all pages as
> http://websitename.com/xx/yy.html
> 
> 2. Add back link to website such as
> http://websitename.com/username
> 
> 
> please help me out .
> 
> 
> > 

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



Re: Routes issue.

2008-06-21 Thread Ian Zepp

What you want is a route that defines a single-part URL as defaulting to 
the users controller:

Router::connect('/:action', array( 'controller' => 'users' ));

And it needs to be at the top of the routes file, because the Router 
scans from the top down.

HOWEVER, you can't do this:

Router::connect('/:action/*', array( 'controller' => 'users' ));

Because then the router doesn't know the difference between these two 
routes:

(1) /someAction/someId
(2) /otherController/someAction

In case (1), the router defaults to the users controller, but case (2) 
actually defines the controller to use. In this scenario, whichever 
route is matched first in the routes.php file will be the one that 
sticks. So don't ever get the order screwed up, or your routing will break.

I don't personally suggest doing it the way you are trying. Define a URL 
standard that is appropriate for your site and stick with it, but it 
should be flexible enough to allow future growth without having to 
constantly redefine routes.

As you say, you don't want to define routes for every action.

Manu0310 wrote:
> Hey I tried it and it works, thanks a lot.
> 
> The only small thing is that for every action I define in the users
> controller I need to add to the routes.
> 
> Router::connect('/login', array('controller' => 'users', 'action' =>
> 'login'));
> 
> Router::connect('/home', array('controller' => 'users', 'action' =>
> 'home'));
> 
> etc ...
> 
> Is there any way to say any actions coming from the controller will
> always have the above behavior, so that I can avoid having to add to
> the routes for every action ?
> 
> Thanks a lot!
> 
> On Jun 21, 12:42 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
>> On Sat, Jun 21, 2008 at 10:03 AM, Manu0310 <[EMAIL PROTECTED]> wrote:
>>
>>> Router::connect('/users/:action/*', array('controller' => 'users'));
>>> Router::connect('/*', array('controller' => 'users', 'action' =>
>>> 'login'));
>> Router::connect('/login', array('controller' => 'users', 'action' =>
>> 'login'));
>>
>> T
>>
>> --
>> =
>> 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 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: inserting more layers into cake php

2008-06-21 Thread Marcin Domanski aka kabturek

hey

On Jun 20, 4:24 pm, Ian Zepp <[EMAIL PROTECTED]> wrote:
> Unlike Zend (with uses an Action suffix to designate controller
> actions), Cake doesn't have any such thing and instead uses a blacklist
> of 'private' controller actions (defined in the dispatcher).
We don't ? We've got something that is called convention here ;)
try calling a "__myAction" from the url.

> As such, be aware that new methods defined in the controller could
> 'potentially' be called as an action, even if that is not the expected
> behavior.
as long as you _don't_ follow the rules ;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: have any project source code using CakePHP

2008-06-21 Thread Marcin Domanski

Here is a great place to find them : http://tinyurl.com/1c2
You've got a page here (google groups) with apps built in cake and you
have cakeforge.org - do some research/search before asking questions.

On Sat, Jun 21, 2008 at 8:11 AM, sumon <[EMAIL PROTECTED]> wrote:
>
> I m a beginner of cakephp. Now i need a prject which has completed
> using CakePHP. Specially I m working on e-mail and chat management web
> application. So if there have any source code (using CakePHP) plz send
> me the link to download.
>
> Cheers
>
> >
>



-- 
Marcin Domanski
http://kabturek.info

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



Re: No model use in components?

2008-06-21 Thread Marcin Domanski

Hey,
Component is the C (not exactly but its an extension to the C layer;)
in MVC and you should avoid mixing the 3 layers.
in some _very_ rare cases it's allowed (that's why the possiblity exists)
Maybe you want to use behaviors ?

Apart from that this topic was brought up many times.
HTH,

On Sat, Jun 21, 2008 at 2:45 PM, dominik <[EMAIL PROTECTED]> wrote:
>
> Hello,
> according to the manual, it is generally not recommended to access
> models from components:
>
> "To access/use a model in a component is not generally recommended;"
>
> Why is that?
>
> I am looking for a way to cleanly create a framework for my new apps.
> That framework should contain functions e.g. for billing and
> accounting.
>
> So, is it a smart way to capsule these functions into Cake
> components?
>
> I dont want to run in a trap as future versions of cake may lose model
> access for design reasons.
>
> Thank you!
>
> >
>



-- 
Marcin Domanski
http://kabturek.info

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



problem while baking the views

2008-06-21 Thread SajjadRaza

slaams
first tell me that whether i can use the under scores in the name of
the  tables in databse
while using the cake
line_items
when ever i use this name convention i face the following warning
issues in the baking the views

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1001

Warning: array_merge(): Argument #1 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: array_merge(): Argument #2 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1029

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1077

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1099

please help me in this regrds

thanks

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



problem while baking the views

2008-06-21 Thread SajjadRaza

hi
whenever i try to bake the views of a datatable name with underscore
line_items
i am recieving the following errors while baking the views

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1001

Warning: array_merge(): Argument #1 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: array_merge(): Argument #2 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1029

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1077

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1099

thanks

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



problems while baking the cake

2008-06-21 Thread SajjadRaza

hi
my first question is that whather i can keep the name of table  with
uderscore
eg line_items
while working with cake
when ever i do this i receive following error while baking the view

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1001

Warning: array_merge(): Argument #1 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: array_merge(): Argument #2 is not an array in D:\wamp\www\line
\cake\scr
ipts\bake.php on line 1027

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1029

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1077

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 666

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\libs\c
ontroller\controller.php on line 801

Warning: Invalid argument supplied for foreach() in D:\wamp\www\line
\cake\script
s\bake.php on line 1099

thanks

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



No model use in components?

2008-06-21 Thread dominik

Hello,
according to the manual, it is generally not recommended to access
models from components:

"To access/use a model in a component is not generally recommended;"

Why is that?

I am looking for a way to cleanly create a framework for my new apps.
That framework should contain functions e.g. for billing and
accounting.

So, is it a smart way to capsule these functions into Cake
components?

I dont want to run in a trap as future versions of cake may lose model
access for design reasons.

Thank you!

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



have any project source code using CakePHP

2008-06-21 Thread sumon

I m a beginner of cakephp. Now i need a prject which has completed
using CakePHP. Specially I m working on e-mail and chat management web
application. So if there have any source code (using CakePHP) plz send
me the link to download.

Cheers

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



Caching, the proper way to do it

2008-06-21 Thread Crazy

Hi,

Now that I've finished my site in php, I'd like to take a closer look
at caching.
I've installed APC, and this seems to work, but am I doing this the
right way?

Links to articles etc would help greatly, the chapter of caching
hasn't been written in the documentation and can't seem to find
anything usefull using google.

In the config file I have uncommented this:
 Cache::config('default', array(
'engine' => 'Apc', //[required]
'duration'=> 3600, //[optional]
'probability'=> 100, //[optional]
'prefix' => Inflector::slug(APP_DIR) . '_', //
[optional]  prefix every cache file with this string
));

I also see stuff in the config like "Memcache" and  Cake Model/File
caching, is there any benefit in enabling more then 1?(haven't tried),
or is this not possible and everything is already cached by APC?

I've also run into the problem of running multiple app's with APC
caching enabled, I'm getting(in error_log):
 [apc-error] Cannot redeclare class cakesession

They do use the same database and tables, but otherwise are completely
seperate.

Any suggestions on improving it are welcome, this is the first time
I'm using caching(only had shared hosting before:p)

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



Containable Behaviour

2008-06-21 Thread [EMAIL PROTECTED]

Hi
Is it possible in the containable behaviour extract only the number of
the records of the association models that match the conditions
instead all the records?
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Url problem

2008-06-21 Thread AbhinavZone

hi.

I am working on website in cakephp. everything is going fine.
but I got stuck with an issue.


1. Client requirement is to rewrite all pages as
http://websitename.com/xx/yy.html

2. Add back link to website such as
http://websitename.com/username


please help me out .


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