Re: Are routes this flexible?

2008-08-19 Thread David C. Zentgraf

Sorry for the late comeback...

I didn't want to break all the old links, so I left the parsing  
algorithm as it is. I was able to reduce the lines of code thanks to  
some more efficient features in 1.2 anyway, so that's alright. :o)

There's one thing I wonder about though. The URLs used in the app can  
be either:
/:controller/:action/:id
for things like /events/edit/,

or they're:
/:controller/:random/:params
for things like /events/in//concerts.

The latter ones are all routed through to $EventsController->index(),  
where the URL parsing magique happens.
Right now I'm doing this by specifying these routes:

Router::connect('/events/add', array('controller' => 'events',  
'action' => 'add'));
Router::connect('/events/edit/*', array('controller' => 'events',  
'action' => 'edit'));
Router::connect('/events/show/*', array('controller' => 'events',  
'action' => 'show'));
Router::connect('/events/*', array('controller' => 'events', 'action'  
=> 'index'));

Is there a way to consolidate these rules somehow? Basically,  
everything that is not an actual action in my EventsController should  
be send to the index() method. Will I have to override the error  
handling class to do that?

Chrs,
Dav

On 11 Aug 2008, at 22:09, [EMAIL PROTECTED] wrote:

>
> Hi David,
> I am no authority but from what I know of the router in Cake I'd say
> probably not.
>
> You may be able to get part of the way there with named routes: /
> events/in:newyork/near:MickyDs
> Problem is you seem to be limited to one of each. You can not have
> Router parse two named parameters with the same name and get an array.
> Instead a later parameter overwrites the previous. near:thefirst/
> near:thesecond generates only a param for near => "thesecond"
> It would be cool if it worked the other way and maybe you can tweak
> the code to do it for you. But you would still not have exactly the
> urls you want.
>
> What could possibly do it all for you is regexp routing. I just
> remember reading about it a while back but since I suck at regexp I
> took little notice. If that feature can overcome the limitation above
> then you could probably write a routing rule-set for your app.
>
> It is the last thing tested in router.test.php
>
> /Martin
>
>
> On Aug 11, 11:10 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>
>> I'm in the midst of updating a 1.1 app to Cake 1.2, and am looking
>> into how flexible routes are.
>> The app centers around really custom URLs, like:
>>
>> /events/in//2008/08/13   or   /events/concerts/near//
>> 2009/04
>>
>> There can be four different parameters in the URL:
>> - areas, distinguished by keyword /in/
>> - stations or POIs, distinguished by keyword /near/
>> - categories, distinguished by not being a number
>> - dates, distinguished by being a number
>>
>> These can occur in any order and quantity. While I'm updating anyway,
>> I'd like to replace the parsing algorithm for the URL by routes if at
>> all possible; but routes don't seem to be flexible enough for the
>> task, as they require parameters in a fixed order?
>>
>> Any input appreciated,
>> Dav
> >


--~--~-~--~~~---~--~~
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: strange html code behavior (ajax, firefox)

2008-08-19 Thread byku


ah yes... i forgot to check adjustperm view...

but... ids generated in both views are the same
(controller_action_roleid), strange thing is that only "two" actions
are not visible "add" and "adjustperm"
i added in meantime two controllers with standard crud actions and
both of them have action "add" invisible (!).

ad errors in log... it was an $this->log() inside adjustperm.ctp :P

ok... same ids in acl.ctp and adjustparm.ctp:

controller_action_roleid - dont update
controlleraction_roleid - that works
controller_actionroleid - dont update
controller__action_roleid - dont update

whats with "_" ? :P

now i changed ids everywhere to controlleraction_roleid and... no
problems under Firefox/IE

wierd ;)

--~--~-~--~~~---~--~~
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: Last resort: persistent auth error

2008-08-19 Thread francky06l

Do you have any requestAction called somewhere prior to render the
view (that is not allowed? ) ?

On Aug 20, 3:59 am, Baxter <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I can't figure out my app's strange auth behavior.  I have a simple
> application that allows users to register, log in, view some
> information, and edit their settings.  Using Auth and ACL components,
> everything is working fine, except one thing.  When I try to go to /
> users/edit, the edit form is displayed, but so is the auth error "You
> are not authorized to access that location."  Doubly strange is that
> the auth error doesn't appear right away; only when I refresh the
> page /users/edit, and then it persists with each refresh.  I have
> tried so many things and looked so many places and can't figure it
> out.
>
> Any ideas?  A thousand 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: couldnot save the new data.

2008-08-19 Thread Mahesh

I figured it out.and am sharing
instead of
   //first part
$obj_Vendor = new Vendor();
$obj_Vendor->save($theData);
i used
 //first part
$obj_Vendor = new Vendor();
$obj_Vendor->save($theData['Vendor']);
The code works perfectly like i need.
I got another solution also by using Model::create();
But i am a little bit confused with saveAll is a little bit confusing
i will look at that again.
Thanks for your help.

On Aug 19, 12:08 pm, teknoid <[EMAIL PROTECTED]> wrote:
> First way is an incorrect way of doing things in cake...
>
> If you need to save multiple rows use saveAll(), however the form
> fields will need to be named slightly different...
> You can refer to test cases for details on saveAll() usage, or take a
> look here (maybe part 2 is more applicable for 
> you):http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part...
>
> On Aug 19, 1:07 pm, Mahesh <[EMAIL PROTECTED]> wrote:
>
> > i have a model name Vendor.
> > class Vendor extends AppModel
> > {
> > var $name = 'vendor';
> > var $hasMany = array(
> > 'VendorProduct' => array(
> > 'className' => 'VendorProduct',
> > 'foreignKey'=> 'vendor_id',
> > 'dependent'=> true
> > )
> > );}
>
> > i have created a function upload in the controller
> > function upload()
> > {
> >//first part
> > $obj_Vendor = new Vendor();
> > $obj_Vendor->save($theData);
> >//second part
> > $theData = Array('Vendor' => Array('name' => 'test1'));
> > $this->Vendor->save($theData);
>
> > }
>
> > Actually the problem is the second part is working correctly. But the
> > first is not.
> > The problem i have more than one row to be inserted. when i am doing
> > through the second way it's actually updating instead of inserting.
> > Could anyone help me??? 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: HABTM woes (cake_1.2.0.7296-rc2)

2008-08-19 Thread eleven10

Good observation! I had somehow missed the missing backtick ...
another thing for which I don't understand ... I know it _has_ to be
something subtle, but I just can't get my finger on it ...
Anyway, here are the model classes (I have just removed some of the
option keys from the auto-generated stuff):

user.php:
 array('alphanumeric'),
'points' => array('numeric')
);

var $hasMany = 'Bid';

var $hasAndBelongsToMany = array(
'BidSession' => array('joinTable' =>
'bid_session_registrations')
);

}
?>

bid_session.php
 array('alphanumeric'),
'cap' => array('numeric')//,
//'starts_at' => array('date'),
//'ends_at' => array('date')
);

var $hasMany = 'Bid';

var $hasAndBelongsToMany = array(
'User' => array('joinTable' => 'bid_session_registrations')
);

}
?>

bid.php
 array('numeric')
);

var $belongsTo = array('User', 'BidSession');

}
?>

It doesn't help even if I specify the 'foreignKey' and
'associationForeignKey' in the HABTM relationship.
As a quick-and-dirty debug, I put the line
pr($query);
in Model::find() [CORE\cake\libs\model\model.php] just before the call
to $db->read($this, $query); on line 1795. This is what I get (url: /
users/add):
Array
(
[conditions] =>
[fields] => Array
(
[0] => BidSessionRegistration.user_id
[1] => BidSessionRegistration.
)

[joins] => Array
(
)

[limit] =>
[offset] =>
[order] => Array
(
[0] =>
)

[page] => 1
[group] =>
[callbacks] => 1
[recursive] => -1
[list] => Array
(
[groupPath] =>
[valuePath] => {n}.BidSessionRegistration.
[keyPath] => {n}.BidSessionRegistration.user_id
)

)
In the docs for Model::find() it's written that:
 * Specifying 'fields' for new-notation 'list':
 *  - If no fields are specified, then 'id' is used for key and 'model-
>displayField' is used for value.
 *  - If a single field is specified, 'id' is used for key and
specified field is used for value.
 *  - If three fields are specified, they are used (in order) for key,
value and group.
 *  - Otherwise, first and second fields are used for key and value.
So I modified the auto-generated $this->User->BidSessionRegistration-
>find('list') call in users_controller.php by explicitly specifying
the fields as array('bid_session_id', 'user_id') ... still, no
improvement.
Now I changed the bid_session_registrations table by removing PK
(bid_session_id, user_id) and adding an id field (although I guess
there's no need to do that for join tables that are not separately
modeled...). Now, the debug output reads:
Array
(
[conditions] =>
[fields] => Array
(
[0] => BidSessionRegistration.id
[1] => BidSessionRegistration.id
)
.
.
.
[list] => Array
(
[groupPath] =>
[valuePath] => {n}.BidSessionRegistration.id
[keyPath] => {n}.BidSessionRegistration.id
)

)
But this is not what I want...
Also, I have no clue why the bake script related User to
BidSessionRegistration not BidSession in /user/add...

Sorry for the long post, but I am really confused why things are
happening the way they are. Thanks for all the help!

On Aug 20, 3:47 am, MonkeyGirl <[EMAIL PROTECTED]> wrote:
> > (a) If I go to /users/add, I get the following SQL error: 1064: You
> > have an error in your SQL syntax; ... near 'bid_session_registrations`
> > AS `BidSessionRegistration`   WHERE 1 = 1' at line 1 [CORE\cake\libs
> > \model\datasources\dbo_source.php, line 512]. Query: SELECT
> > `BidSessionRegistration`.`user_id`, BidSessionRegistration`. FROM
> > `bid_session_registrations` AS `BidSessionRegistration` WHERE 1 = 1.
> > Note the missing field name before 'FROM'. This table has PK
> > (bid_session_id, user_id). If I remove that and add an id field as PK,
> > things start working. However, since I am not interested in using this
> > join model directly, I shouldn't have to do this ... as far as I
> > understand from the manual and other cake blogs/tutorials.
>
> What you're doing in general sounds right to me.  If that's a straight
> copy-and-paste, note that you're also missing a backtick just before
> the table name that has a missing column.  It sounds like CakePHP's
> getting somewhat confused about the table structure.  Check for any
> typos or anything slightly askew in the models.  Whenever I've had
> similar errors myself, it's usually something subtle but not
> particularly complex.  If that doesn't help, maybe pasting the models'
> classes here might shed some light on the problem.
>
> Hope that helps,
> Zoe.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cak

Last resort: persistent auth error

2008-08-19 Thread Baxter

Hi all,

I can't figure out my app's strange auth behavior.  I have a simple
application that allows users to register, log in, view some
information, and edit their settings.  Using Auth and ACL components,
everything is working fine, except one thing.  When I try to go to /
users/edit, the edit form is displayed, but so is the auth error "You
are not authorized to access that location."  Doubly strange is that
the auth error doesn't appear right away; only when I refresh the
page /users/edit, and then it persists with each refresh.  I have
tried so many things and looked so many places and can't figure it
out.

Any ideas?  A thousand 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
-~--~~~~--~~--~--~---



textbook find() query just doesn't work

2008-08-19 Thread Christian

In the manual I found an example of what I'm trying to do, except it
doesn't work...

-
Let's say you had a hasMany/belongsTo relationship between Posts and
Authors, which would result in a LEFT JOIN. Let's say you wanted to
find all the posts that contained a certain keyword (“magic”) or were
created in the past two weeks, but you want to restrict your search to
posts written by Bob:

code:
array (
"Author.name" => "Bob",
"or" => array (
"Post.title LIKE" => "%magic%",
"Post.created >" => date('Y-m-d', strtotime("-2 weeks"))
)
)
-
So you pass that as conditions to your find() call.


I have a Game model and a GamePlayer model.
Game hasMany GamePlayer.
GamePlayer belongsTo Game.
I want to find all games with inherent Game.status=1, and with an
associated GamePlayer.user_id=1

$cond = array("conditions"=>array("Game.status"=>1));
$games = $this->Game->find('all',$cond));

--> This will return all the games with status=1, and right underneath
the associated GamePlayers

however, when i say..
$cond =
array("conditions"=>array("Game.status"=>1,"GamePlayer.user_id"=>1));
and repeat the find...

it spits back at me "Unknown column 'Game.status' in 'where clause'"
because it doesn't do a JOIN like the example from the cookbook says.


I know this topic has come up on the google group elsewhere, but they
either don't address this exact issue, or i try what is suggested and
still no luck.
I'd like to think this is a pretty basic and overused query for almost
any application of databases.

thanks,

Christian


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



Element paths in a Plugin?

2008-08-19 Thread Damon

I'd like to include an element from my base application in an
element.  The specific example is a pagination element which I use in
the base app as well as in several plugins.  I don't like that I have
to have 1+(n*plugins) copies of this element.

Am I missing something?

--~--~-~--~~~---~--~~
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: OrderedBehavior - Order your lists in a TreeBehavior like manner, but only for one level.

2008-08-19 Thread Dr. Tarique Sani
On Tue, Aug 19, 2008 at 11:43 PM, villas <[EMAIL PROTECTED]> wrote:

>
> @Tarique
> >> Post a URL here or on the forums with enough keywords and sooner or
> later it gets picked up by google
>
> That may be so.  But doesn't the Bakery exist so that interesting
> stuff worthy of publication can brought together in one place so we
> can reduce our time spent searching?  ;-)


I am not arguing the value of bakery - you missed the point :D


Tarique

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"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: HABTM cascading delete

2008-08-19 Thread Marcello

it does not work (gives no error, but does not remove the dependent
side)

On 19 ago, 22:26, Marcello <[EMAIL PROTECTED]> wrote:
> dependent is exactly what i was looking for
>
> thanks!
>
> On 19 ago, 22:11, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > Take a look athttp://book.cakephp.org/view/66/models#deleting-data-516
> > .  The 'dependent' parameter can also be set in the model association
> > definition.
>
> > Hope that's what you were looking for.
> > -J.
>
> > On Aug 19, 8:52 pm, Marcello <[EMAIL PROTECTED]> wrote:
>
> > > i got 2 tables linked by a HABTM relationship
>
> > > when i delete table record 1 i want to delete the relationship with
> > > table and the table 2 record as well
> > > but when i delete from table 2 i want to keep table 1 record
>
> > > is there any feature in cakephp for cascading in habtm?
--~--~-~--~~~---~--~~
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: 2 column layout for $form->input() ?

2008-08-19 Thread peterm95018

ok. thanks to both you and Lance. I've got your CSS book sitting on my
lap...

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



using fields on HABTM table (new feature on cakephp 1.2)

2008-08-19 Thread Marcello

im trying to use this new feature, but i have no idea how should i
format the data to insert into the database

if i have the field "type" in my AddressClient relationship how can i
generate the form input?

$form->input('AddressClient.type'); does not seem to work
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM cascading delete

2008-08-19 Thread Marcello

dependent is exactly what i was looking for

thanks!

On 19 ago, 22:11, Joel Perras <[EMAIL PROTECTED]> wrote:
> Take a look athttp://book.cakephp.org/view/66/models#deleting-data-516
> .  The 'dependent' parameter can also be set in the model association
> definition.
>
> Hope that's what you were looking for.
> -J.
>
> On Aug 19, 8:52 pm, Marcello <[EMAIL PROTECTED]> wrote:
>
> > i got 2 tables linked by a HABTM relationship
>
> > when i delete table record 1 i want to delete the relationship with
> > table and the table 2 record as well
> > but when i delete from table 2 i want to keep table 1 record
>
> > is there any feature in cakephp for cascading in habtm?
--~--~-~--~~~---~--~~
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: HABTM cascading delete

2008-08-19 Thread Joel Perras

Take a look at http://book.cakephp.org/view/66/models#deleting-data-516
.  The 'dependent' parameter can also be set in the model association
definition.

Hope that's what you were looking for.
-J.

On Aug 19, 8:52 pm, Marcello <[EMAIL PROTECTED]> wrote:
> i got 2 tables linked by a HABTM relationship
>
> when i delete table record 1 i want to delete the relationship with
> table and the table 2 record as well
> but when i delete from table 2 i want to keep table 1 record
>
> is there any feature in cakephp for cascading in habtm?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM cascading delete

2008-08-19 Thread Marcello

i got 2 tables linked by a HABTM relationship

when i delete table record 1 i want to delete the relationship with
table and the table 2 record as well
but when i delete from table 2 i want to keep table 1 record

is there any feature in cakephp for cascading in habtm?
--~--~-~--~~~---~--~~
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: Cake 1.2 Auth - Is someone logged in?

2008-08-19 Thread BillBris

Thank You!

As with everything, this all seems impossible (at least daunting),
until you know how.
Of course, once you know how you slap your forehead and say: "Duh.".

Now on to figuring out the ACL!

Thanks again,
B.

On Aug 17, 3:36 am, francky06l <[EMAIL PROTECTED]> wrote:
> TheAuthloginstores the user information in the Session  (withAuth
> key).
> TheAuth->user() is actually a wrapper function to the sessionAuth.User key.
> TheAuthlogout function delete the informations from the session.
>
> Knowing this, you can use the Session component in controllers and the
> session helper in views to detect theloginstatus.
>
> in controllers:
>
> $this->Session->check('Auth.User.id') will return true if the user is
> logged, you can also use $this->Auth->user('id').
>
> in views
>
> $session->check('Auth.User.id') will tell you if a user is logged, and
> you can user $session->read('Auth.User') to retrieve the user's
> information.
>
> hth
>
> On Aug 17, 2:31 am, "Bill Brisky" <[EMAIL PROTECTED]> wrote:
>
> > I'm starting off with Cake and enjoying it.  As confusing as the entire ACL
> > world seems, I think I'm getting a grip on it.
>
> > One small current problem: How do you determine if someone is currently
> > logged in?
>
> > Here is the situation:  I have a simple home page (pages/home.ctp) that
> > simply that should display a "login" link (users/login) and if no one is
> > currently logged in, a "logout" link (users/logout).  It seems simple enough
> > however, I can't seem to find a way to determine whether or not someone is
> > logged in.
>
> > $loggedIn (Authpublic variable as stated in docs) seems to always be false
> > outside of actualAuthcode.
>
> > $this->Auth->user() : After an initiallogin, this always seems to return a
> > User object properly filled out, with the exception that person had actually
> > logged out.
>
> > So between an always false condition, and an always true condition, what
> > does one do?  I have a feeling I'm missing something fundamental and will be
> > smacking my head on my desk after reading the solution.
>
> > More detail:
>
> > App_controller.php
>
> > Acl &Authcomponents in $components
>
> >Authvariables set in beforeFilter
>
> > Pages/Home.ctp
>
> > Typical Cake home page
>
> > Due to the lack of a controller (and thus a lack of access to data), I made
> > a copy of the cake core pages_controller.php and moved it into my
> > app/controllers directory.
>
> > Controllers/pages_controller.php
>
> > This is where I hope to set a variable (inside of display()) withlogin
> > status and pass it to home.ctp.
>
> > Changes to this file are minimal: AddedAuth& Session to $components.
>
> > Users_controller.php
>
> > TypicalAuthlogin(no code) and logout (taken from examples).
>
> > Versions:
>
> > -  Windows XP
>
> > -  Xampp  v1.6.7
>
> > -  PHP v.5.2.6
>
> > -  Cake v1.2.0.7296rc2
>
> > Any and all help will be greatly appreciated.
>
> > B.
--~--~-~--~~~---~--~~
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: Is this a crazy phbBB3 & CakePHP idea?

2008-08-19 Thread rtconner

Yes you can do that, no problem. Just gotta use the $useTable var in
the models.
--~--~-~--~~~---~--~~
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: Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread www.landed.at

For me it's still not working.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Is this a crazy phbBB3 & CakePHP idea?

2008-08-19 Thread designvoid

Hey all!

Just been playing around with phpBB3 and Cake and had this crazy idea!
I have a large forum and want to build a website around it, and want
to use cake to build the site. Now I want to include content from the
forums ie posts and topics on certain pages, so I had this thought!

I could create models for the specific phpBB3 tables that I need data
from, set the correct relationships, then 'use' them in the
controllers that I want to pull phpBB3 content into.

Does that make sense and are there any glaring issues I'm missing in
what seems like a very easy solution...?

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



Re: saveAll() not inserting related id

2008-08-19 Thread designvoid

Is anyone able to shed any light on this??

I've put it aside for a while, but I need to figure this out now. So
anyone able to help?

TIA,
d.

On Aug 5, 12:43 pm, designvoid <[EMAIL PROTECTED]> wrote:
> Oh and I should mention i'm using v1.2
> And...
>
> ...editing and adding new variations via the edit method WORKS! I'm
> confused! It seems to work when the product id is there as a hidden
> field for edit, but it doesnt insert last id when adding a new
> product... hmmm!
>
> On Aug 5, 12:38 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi there!
>
> > I'm currently trying to use thesaveAll() function with the following
> > set up:
>
> > Products haveMany Variations
> > Variations belongTo Products
>
> > However when I execute the add function in the Products controller:
>
> > if (!empty($this->data)) {
> >         $this->Product->create();
> >         if ($this->Product->saveAll($this->data)) {
> >                 $this->Session->setFlash(__('The Product has been saved', 
> > true));
> >                 $this->redirect(array('action'=>'index'));
> >         } else {
> >                 $this->Session->setFlash(__('The Product could not be 
> > saved. Please,
> > try again.', true));
> >         }
>
> > }
>
> > The rows are inserted but the the related Variations are missing the
> > Product id!
>
> > The SQL dump shows this:
>
> > START TRANSACTION
> > INSERT INTO `products` (`name`,`price`) VALUES ('save all test',10.00)
> > SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('qq',
> > 15,3.00,'')                     SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('ww',
> > 15,3.00,'')
> > SELECT LAST_INSERT_ID() AS insertID
> > COMMIT
>
> > Can anyone shed any light on this?
> > TIA!
> > d.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM woes (cake_1.2.0.7296-rc2)

2008-08-19 Thread MonkeyGirl

> (a) If I go to /users/add, I get the following SQL error: 1064: You
> have an error in your SQL syntax; ... near 'bid_session_registrations`
> AS `BidSessionRegistration`   WHERE 1 = 1' at line 1 [CORE\cake\libs
> \model\datasources\dbo_source.php, line 512]. Query: SELECT
> `BidSessionRegistration`.`user_id`, BidSessionRegistration`. FROM
> `bid_session_registrations` AS `BidSessionRegistration` WHERE 1 = 1.
> Note the missing field name before 'FROM'. This table has PK
> (bid_session_id, user_id). If I remove that and add an id field as PK,
> things start working. However, since I am not interested in using this
> join model directly, I shouldn't have to do this ... as far as I
> understand from the manual and other cake blogs/tutorials.

What you're doing in general sounds right to me.  If that's a straight
copy-and-paste, note that you're also missing a backtick just before
the table name that has a missing column.  It sounds like CakePHP's
getting somewhat confused about the table structure.  Check for any
typos or anything slightly askew in the models.  Whenever I've had
similar errors myself, it's usually something subtle but not
particularly complex.  If that doesn't help, maybe pasting the models'
classes here might shed some light on the problem.

Hope that helps,
Zoe.
--~--~-~--~~~---~--~~
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: many-to-many and one-to-many associations

2008-08-19 Thread MonkeyGirl

Hi.

I don't necessarily know what I'm talking about, but no one else has
spoken up, so here goes...

The way I would get the aggregate would not be to change the
finderQuery in the hasAndBelongsToMany definition.  It didn't even
occur to me that you could do that.  Then again, maybe I'm just being
naive.  Either of these ways should work:

The wasteful way: just do a findAll on the tag and recurse it as
necessary.  It will list all the posts that use it, and all the
comments that each post has.  Use PHP's count() function rather than
SQL aggregates to count how many comments are in each post.  As I say,
this is very much needlessly wasteful, although you can curb the waste
somewhat by unbinding the unneeded models temporarily before the
findAll.

The custom way: make a new method in one of the models that takes a
tag ID and calls $this->query with the SQL you've pasted above, and a
WHERE clause that makes use of the tag ID.  This is probably the best
way of doing it (it's certainly the best way I know of myself), but
I'll bet someone else can suggest a better way.

But as I say, I'm by no means an expert, so take my advice with a
pinch of salt.

Hope that helps,
Zoe.
--~--~-~--~~~---~--~~
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: how to handle multiple gaming categories?

2008-08-19 Thread Adrian

I'm doing something similar. If you look towards the bottom of that
link there is a section about prefixes. So your routes look like

Router::connect('/wow/:controller/:action');

What I'm doing is in the controllers I have an action that takes care
of all the generic logic that can't be accessed by the users:

function _sell() {
   //some code here that uses $this->game
}

Then other publicly accessible functions for each category that set
the category flag and then call the generic function:

function wow_sell(){
$this->game = 'wow';
$this->_generic();
}

This way you have all code that is generic the same for each call in
one location and the specific actions just set the proper flag. Hope
this helps.

On Aug 19, 4:16 pm, rocket <[EMAIL PROTECTED]> wrote:
> i thought i relpied to tis is there a delay? test
>
> On Aug 19, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Should be easily handled with 
> > routes...http://book.cakephp.org/view/46/routes-configuration
>
> > There are some good tutorials "out there" as well.
>
> > On Aug 19, 12:28 pm, rocket <[EMAIL PROTECTED]> wrote:
>
> > > hello
> > > i'm building a trading post for my two favorite games, WoW and Ultima
> > > Online, but i'm not sure how to handle categories.
>
> > > It will be a common buy/selll/trade pos.
>
> > > Ideally URLs would look like this:
>
> > >www.tradingpost.com/wow/www.tradingpost.com/uo/
>
> > > I know I can create separate folders to do this in the controller, wow
> > > and uo respectivley, but then if i do something like this
>
> > >www.tradingpost.com/wow/sellwww.tradingpost.com/uo/sell
>
> > > How do I just share the "sell" controller between them, and rely on
> > > the wow/uo section of the URL to declare the "category ID" for my SQL
> > > database?
>
> > > does anyone have any tips? 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
-~--~~~~--~~--~--~---



Re: File upload

2008-08-19 Thread Donkeybob

This tutorial helped me a lot! -> 
http://www.keithmedlin.com/2008/01/cakephp-12-file-upload/

It moves the files on the server and also creates a db record . . .

I modified the section in the model that gets the path and moves the
file to reflect the directory structure i wanted . . -> WWW_ROOT.'/
files/'."$fileName"

Hope this is a good start position.

rich

On Aug 19, 4:18 pm, bartez <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> I've scouted both here and the bakery etc and have had no success in
> finding the answer to my problem.
>
> I would like to upload an image and save it in a file system (not a
> database).
>
> I would like the structure to be as follows
>
> img
>     / items
>         / groups
>             /id
>                 /each individual image here
>
> I've done this before in normal php but I'm sure there must be a cake
> way!!
>
> Thanks for your help in advance.
>
> Alex
--~--~-~--~~~---~--~~
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: OrderedBehavior - Order your lists in a TreeBehavior like manner, but only for one level.

2008-08-19 Thread villas

@Nate
Yes,  that's a different point -- it may not be worthy of publication
yet.
Gwoo and yourself have now at least pointed out constructive
criticisms that Alkemann can take on board.


On Aug 19, 7:40 pm, Nate <[EMAIL PROTECTED]> wrote:
> It exists for many reasons, one of which is providing a centralized
> location for CakePHP resources.  Another is to showcase best practices
> for application development, and using raw SQL in a class that should
> be portable is not a best practice.
>
> On Aug 19, 2:13 pm,villas<[EMAIL PROTECTED]> wrote:
>
> > @Tarique
>
> > >> Post a URL here or on the forums with enough keywords and sooner or 
> > >> later it gets picked up by google
>
> > That may be so.  But doesn't the Bakery exist so that interesting
> > stuff worthy of publication can brought together in one place so we
> > can reduce our time spent searching?  ;-)
--~--~-~--~~~---~--~~
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: 2 column layout for $form->input() ?

2008-08-19 Thread Jonathan Snook

Lance is correct, this is a CSS issue and not specific to CakePHP.

If you look at the HTML being spit out by a $form->input is:


If you're doing type=radio, then it's just multiple label/input inside
those DIVs.

To make everything "horizontal", just make sure all the elements are
display:inline. Now, the only problem is if you have too many options
to fit on a line. Then you might get a line break where you don't want
it. Unfortunately, I don't know of a solution for this other than to
create your own form helper that overloads the original form helper.
I've had to do this on a recent project and has worked well.

On Tue, Aug 19, 2008 at 4:18 PM, peterm95018 <[EMAIL PROTECTED]> wrote:
>
> Lance,
>
> Perhaps you misunderstand the question. Let me restate.
>
> Is it possible to use $form->input with $options to present form
> elements horizontally? Such that:
> label:input  label:input  label:input <-- displayed in a "row" to be
> space efficient
>
> If yes, can someone post an example? If no, can someone confirm that
> this isn't possible "out of the box"?
>
> peterm
> >
>

--~--~-~--~~~---~--~~
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: Ajax link creation

2008-08-19 Thread francky06l

Maybe you could use the "with" option.

On Aug 19, 3:10 pm, f1codz <[EMAIL PROTECTED]> wrote:
> dear all,
>
> i have a problem with $ajax->link() function.
>
> My doubt is - how do we pass post parameters to the action using 
> $ajax->link().
>
> Though the ajaxOptions array contains the options 'parameters' ..
> setting it to some value while calling $ajax->link()  is providing no
> functionality:
>
> $ajax->link('save', 'javascript://' , array(
> 'url' => '/controller/action',
> 'update => 'my_division',
> 'method' => 'post',
> 'parameters =>
> 'name=f1codz&value=help'
> ));
>
> i checked the script generated in the source code .. it holds no
> reference to the parameters keyword.
> i hope its not a problem with cakePHP or is it???
>
> please help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



File upload

2008-08-19 Thread bartez

Hey all,

I've scouted both here and the bakery etc and have had no success in
finding the answer to my problem.

I would like to upload an image and save it in a file system (not a
database).

I would like the structure to be as follows

img
/ items
/ groups
/id
/each individual image here

I've done this before in normal php but I'm sure there must be a cake
way!!

Thanks for your help in advance.


Alex
--~--~-~--~~~---~--~~
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: 2 column layout for $form->input() ?

2008-08-19 Thread peterm95018

Lance,

Perhaps you misunderstand the question. Let me restate.

Is it possible to use $form->input with $options to present form
elements horizontally? Such that:
label:input  label:input  label:input <-- displayed in a "row" to be
space efficient

If yes, can someone post an example? If no, can someone confirm that
this isn't possible "out of the box"?

peterm
--~--~-~--~~~---~--~~
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: how to handle multiple gaming categories?

2008-08-19 Thread rocket

i thought i relpied to tis is there a delay? test

On Aug 19, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
> Should be easily handled with 
> routes...http://book.cakephp.org/view/46/routes-configuration
>
> There are some good tutorials "out there" as well.
>
> On Aug 19, 12:28 pm, rocket <[EMAIL PROTECTED]> wrote:
>
> > hello
> > i'm building a trading post for my two favorite games, WoW and Ultima
> > Online, but i'm not sure how to handle categories.
>
> > It will be a common buy/selll/trade pos.
>
> > Ideally URLs would look like this:
>
> >www.tradingpost.com/wow/www.tradingpost.com/uo/
>
> > I know I can create separate folders to do this in the controller, wow
> > and uo respectivley, but then if i do something like this
>
> >www.tradingpost.com/wow/sellwww.tradingpost.com/uo/sell
>
> > How do I just share the "sell" controller between them, and rely on
> > the wow/uo section of the URL to declare the "category ID" for my SQL
> > database?
>
> > does anyone have any tips? 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
-~--~~~~--~~--~--~---



Re: Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread giulio

Hi Clément,

I'm writing to confirm that thanks to your suggestion all works fine.

Thank you very much

Giulio



On 19 Ago, 21:57, "www.landed.at" <[EMAIL PROTECTED]> wrote:
> I have followed all except the last line of that link which is
>
> # If you are installing CakePHP into a user directory (http://
> example.com/~username), you'll need to modify the .htaccess file in
> the base directory of your CakePHP installation. Just add the line
> "RewriteBase /~myusername/"
>
> in uniform server the structure is
>
> C:\Uniform Server\udrive\www\fb00\ [here i have app, cake,vendors etc
> and the htaccess file ]
>
> so eith that structure localhost points to the www root folder where I
> have multiple sites.
> So i added as per the instruction above and get the htaccess file in
> the application root to be
>
> 
>    RewriteEngine on
>    RewriteRule    ^$ app/webroot/    [L]
>    RewriteRule    (.*) app/webroot/$1 [L]
>    RewriteBase /~fb00/
> 
>
> so is that right, I dont know what else is wrong, I have mod rewrite
> working for other things ok.
> here is my server log error
>
> [error] [client 127.0.0.1] Options FollowSymLinks or
> SymLinksIfOwnerMatch is off which implies that RewriteRule directive
> is forbidden: W:/www/fb00/, referer:http://localhost/
>
> thanks for any help this is my second night of frustration with
> nothing working.
--~--~-~--~~~---~--~~
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: how to handle multiple gaming categories?

2008-08-19 Thread rocket

Using routing though, i would have to specify every route:

A route for
wow/sell
uo/sell
wow/buy
uo/buy

Is there an easier way to do this instead of routes?

I just want to take the first parameter of the URL, ie. "wow" or "uo".
It will set my category_id variable to 1 or 2 respectivley. So then
when I access

wow/sell

it would be like passing in to the sell_controller with a category_id
value of 1.



On Aug 19, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
> Should be easily handled with 
> routes...http://book.cakephp.org/view/46/routes-configuration
>
> There are some good tutorials "out there" as well.
>
> On Aug 19, 12:28 pm, rocket <[EMAIL PROTECTED]> wrote:
>
> > hello
> > i'm building a trading post for my two favorite games, WoW and Ultima
> > Online, but i'm not sure how to handle categories.
>
> > It will be a common buy/selll/trade pos.
>
> > Ideally URLs would look like this:
>
> >www.tradingpost.com/wow/www.tradingpost.com/uo/
>
> > I know I can create separate folders to do this in the controller, wow
> > and uo respectivley, but then if i do something like this
>
> >www.tradingpost.com/wow/sellwww.tradingpost.com/uo/sell
>
> > How do I just share the "sell" controller between them, and rely on
> > the wow/uo section of the URL to declare the "category ID" for my SQL
> > database?
>
> > does anyone have any tips? 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
-~--~~~~--~~--~--~---



HABTM woes (cake_1.2.0.7296-rc2)

2008-08-19 Thread eleven10

Hi,

I am trying to improve my university's course bidding system using
CakePHP (and learning it in the process). As a prototype, I have the
following data model:

* users [id, login, name, points]
* bid_sessions [id, title, cap, starts_at, ends_at]
* bid_session_registrations [bid_session_id, user_id]
* bids [id, user_id, bid_session_id, bid_points, created, modified]

User hasMany Bid; BidSession hasMany Bid; Bid belongsTo User,
BidSession; User <--HABTM--> BidSession (joinTable =>
bid_session_registrations).

I have used the bake script to generate the models, controllers and
scaffold views. Now the troubles:

(a) If I go to /users/add, I get the following SQL error: 1064: You
have an error in your SQL syntax; ... near 'bid_session_registrations`
AS `BidSessionRegistration`   WHERE 1 = 1' at line 1 [CORE\cake\libs
\model\datasources\dbo_source.php, line 512]. Query: SELECT
`BidSessionRegistration`.`user_id`, BidSessionRegistration`. FROM
`bid_session_registrations` AS `BidSessionRegistration` WHERE 1 = 1.
Note the missing field name before 'FROM'. This table has PK
(bid_session_id, user_id). If I remove that and add an id field as PK,
things start working. However, since I am not interested in using this
join model directly, I shouldn't have to do this ... as far as I
understand from the manual and other cake blogs/tutorials.

(b) The generated scaffold view for /bid_sessions/add correctly shows
me a list (multi-select) of users to choose from for that session.
However, in /users/add, the code shows a select drop down for Bid
Session Registrations (and options for listing/creating Bid Session
Registrations). Shouldn't cake be generating a list of Bid Sessions to
choose from (as in the other case)?

I just can't understand the reasons behind these or what I am doing
incorrectly ...

Also, though not directly related to HABTM, but does anyone know of
any simple method to make the Auth component work with POP3
authentication? I can do my own checks, but being able to use the Auth
component would be nice ...

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: Field Naming Convention

2008-08-19 Thread kienpham2000

I think I found my own answer, we can use something like this:

input('MyModel.1.myField);?>
input('MyModel.2.myField);?>

I think with this convention, we can use the saveAll() but my table is
MyISAM which does not support transaction :(.

- Kien


On Aug 18, 3:48 pm, kienpham2000 <[EMAIL PROTECTED]> wrote:
> Hi all cake bakers,
>
> I'm using the 1.2RC and I followed the field naming convention here to
> get array of data for a field 
> name:http://book.cakephp.org/view/547/field-naming-convention
>
> Here is my code to create input fields:
> input('MyModel.myField.1');?>
> input('MyModel.myField.2');?>
>
> But when it displays, my label is 1 and 2 but not My Field. I have to
> manually set the label like this:
> input('MyModel.myField.1', array('label' => 'My Field 1'));?
>
> input('MyModel.myField.2', array('label' => 'My Field 2);?>
>
> Did I created the field wrong or do I just have to manually type in
> the label? Also, in plain php, we can just use the two bracket at the
> end [] and the posted data will automatically create the array for us,
> can we do something like that with cake using the form helper?
>
> Thanks all!
> - Kien
--~--~-~--~~~---~--~~
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: Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread www.landed.at

I have followed all except the last line of that link which is

# If you are installing CakePHP into a user directory (http://
example.com/~username), you'll need to modify the .htaccess file in
the base directory of your CakePHP installation. Just add the line
"RewriteBase /~myusername/"

in uniform server the structure is

C:\Uniform Server\udrive\www\fb00\ [here i have app, cake,vendors etc
and the htaccess file ]

so eith that structure localhost points to the www root folder where I
have multiple sites.
So i added as per the instruction above and get the htaccess file in
the application root to be


   RewriteEngine on
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]
   RewriteBase /~fb00/


so is that right, I dont know what else is wrong, I have mod rewrite
working for other things ok.
here is my server log error

[error] [client 127.0.0.1] Options FollowSymLinks or
SymLinksIfOwnerMatch is off which implies that RewriteRule directive
is forbidden: W:/www/fb00/, referer: http://localhost/

thanks for any help this is my second night of frustration with
nothing working.
--~--~-~--~~~---~--~~
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: DateTime Validation

2008-08-19 Thread kienpham2000

Hi,

I was just looking for this too. I came up with this solution using
the beforeValidate().

1.) At the view, split the datetime into two fields, date and time :

input('date', array('type' => 'date'));?>
input('time', array('type' => 'time'));?>

2.) Then inside your Model, create the beforeValidate() function:

function beforeValidate(){
// In my case, time is optional so I have extra code to set it to
00:00:00 if not provided.
$date = implode('-', $this->data['Model']['date']);
$time = implode(':', $this->data['Model']['time']);

// Combine the date and time to make the mysql timestamp format:
$this->data['Model']['datetime'] = $date . ' ' . $time;
}

3. And just validate the date and time normally:

var $validate = array(
 'date' => array('rule' => array('date', 'mdy'), 'required' => false,
'message' => 'Please select a valid date.'),
 'time' => array('rule' => 'time', 'required' => false, 'message' =>
'Please select a valid time.')
)

So basically we don't need a new datetime validation, we just need to
validate each field separately.

- Kien

On Aug 6, 5:20 pm, PaulMan <[EMAIL PROTECTED]> wrote:
> Hello, Thanks Chris,
> Since i found the Date and Time validation methods, i was "hopping" to
> find also a DateTime validation...
> I'll go to a Custom Validation Method, if any one already extended the
> Validation class with this please post.
> Thanks.
>
>
>
> > My, my, so many polite people on the mailing list these days.
>
> > While there is a date validation method, I don't see any date + time
> > validation method in this section:
>
> >http://book.cakephp.org/view/125/data-validation
>
> > So, my guess would be that you will have to write your own custom
> > validation method if you want to validate a dateTime string.  I'm
> > thinking you're talking about something like this:
>
> > 2008-08-06 12:45PM
>
> > The example doesn't matter really, as it's just a little bit of work
> > with regular expressions to make your own validation method.
> > I'm sure a little bit of work with google will find the regular
> > expression you need.
>
> > Try this tool to create the regex:
>
> >http://www.txt2re.com/
>
> > --
> > Chris Hartjes
> > Motto for 2008: "Moving from herding elephants to handling snakes..."
> > @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"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: couldnot save the new data.

2008-08-19 Thread teknoid

First way is an incorrect way of doing things in cake...

If you need to save multiple rows use saveAll(), however the form
fields will need to be named slightly different...
You can refer to test cases for details on saveAll() usage, or take a
look here (maybe part 2 is more applicable for you):
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/



On Aug 19, 1:07 pm, Mahesh <[EMAIL PROTECTED]> wrote:
> i have a model name Vendor.
> class Vendor extends AppModel
> {
>     var $name = 'vendor';
>         var $hasMany = array(
>         'VendorProduct' => array(
>             'className'     => 'VendorProduct',
>             'foreignKey'    => 'vendor_id',
>             'dependent'=> true
>         )
>     );}
>
> i have created a function upload in the controller
> function upload()
> {
>    //first part
>                 $obj_Vendor = new Vendor();
>                 $obj_Vendor->save($theData);
>    //second part
>                 $theData = Array('Vendor' => Array('name' => 'test1'));
>                 $this->Vendor->save($theData);
>
> }
>
> Actually the problem is the second part is working correctly. But the
> first is not.
> The problem i have more than one row to be inserted. when i am doing
> through the second way it's actually updating instead of inserting.
> Could anyone help me??? 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: how to handle multiple gaming categories?

2008-08-19 Thread teknoid

Should be easily handled with routes...
http://book.cakephp.org/view/46/routes-configuration

There are some good tutorials "out there" as well.

On Aug 19, 12:28 pm, rocket <[EMAIL PROTECTED]> wrote:
> hello
> i'm building a trading post for my two favorite games, WoW and Ultima
> Online, but i'm not sure how to handle categories.
>
> It will be a common buy/selll/trade pos.
>
> Ideally URLs would look like this:
>
> www.tradingpost.com/wow/www.tradingpost.com/uo/
>
> I know I can create separate folders to do this in the controller, wow
> and uo respectivley, but then if i do something like this
>
> www.tradingpost.com/wow/sellwww.tradingpost.com/uo/sell
>
> How do I just share the "sell" controller between them, and rely on
> the wow/uo section of the URL to declare the "category ID" for my SQL
> database?
>
> does anyone have any tips? 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
-~--~~~~--~~--~--~---



Re: OrderedBehavior - Order your lists in a TreeBehavior like manner, but only for one level.

2008-08-19 Thread Nate

It exists for many reasons, one of which is providing a centralized
location for CakePHP resources.  Another is to showcase best practices
for application development, and using raw SQL in a class that should
be portable is not a best practice.

On Aug 19, 2:13 pm, villas <[EMAIL PROTECTED]> wrote:
> @Tarique
>
> >> Post a URL here or on the forums with enough keywords and sooner or later 
> >> it gets picked up by google
>
> That may be so.  But doesn't the Bakery exist so that interesting
> stuff worthy of publication can brought together in one place so we
> can reduce our time spent searching?  ;-)
--~--~-~--~~~---~--~~
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: OrderedBehavior - Order your lists in a TreeBehavior like manner, but only for one level.

2008-08-19 Thread villas

@Tarique
>> Post a URL here or on the forums with enough keywords and sooner or later it 
>> gets picked up by google

That may be so.  But doesn't the Bakery exist so that interesting
stuff worthy of publication can brought together in one place so we
can reduce our time spent searching?  ;-)

--~--~-~--~~~---~--~~
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 handle multiple gaming categories?

2008-08-19 Thread rocket

hello
i'm building a trading post for my two favorite games, WoW and Ultima
Online, but i'm not sure how to handle categories.

It will be a common buy/selll/trade pos.

Ideally URLs would look like this:

www.tradingpost.com/wow/
www.tradingpost.com/uo/

I know I can create separate folders to do this in the controller, wow
and uo respectivley, but then if i do something like this

www.tradingpost.com/wow/sell
www.tradingpost.com/uo/sell

How do I just share the "sell" controller between them, and rely on
the wow/uo section of the URL to declare the "category ID" for my SQL
database?

does anyone have any tips? 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
-~--~~~~--~~--~--~---



couldnot save the new data.

2008-08-19 Thread Mahesh

i have a model name Vendor.
class Vendor extends AppModel
{
var $name = 'vendor';
var $hasMany = array(
'VendorProduct' => array(
'className' => 'VendorProduct',
'foreignKey'=> 'vendor_id',
'dependent'=> true
)
);
}
i have created a function upload in the controller
function upload()
{
   //first part
$obj_Vendor = new Vendor();
$obj_Vendor->save($theData);
   //second part
$theData = Array('Vendor' => Array('name' => 'test1'));
$this->Vendor->save($theData);

}

Actually the problem is the second part is working correctly. But the
first is not.
The problem i have more than one row to be inserted. when i am doing
through the second way it's actually updating instead of inserting.
Could anyone help me??? 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: Best practice: DB table data needed in a view helper?

2008-08-19 Thread Mark (Germany)

thx
i might actually consider that for getting the information
cached file - and if not possible manually through a query

the helper still needs to be a helper though
but this way there is backup :)

if i would just use the element without caching
this could be quit a lot of more "server load" to handle
as this helper (and therefore the table content) is needed on many
pages.


On 19 Aug., 00:49, francky06l <[EMAIL PROTECTED]> wrote:
> @Mark,
>
> Kalt suggestion is goof for an element. You could also user an helper
> and caching. The helper would check the cached file, if not there or
> expired your helper can do a requestAction and cache the results for
> future calls.
> I use this quite a lot for fetching data for select for example (like
> for a category list, not changing every 10 seconds, and avoiding
> queries), and manually delete the cache when I update the tables..
>
> hth
>
> On Aug 19, 12:38 am, Kalt <[EMAIL PROTECTED]> wrote:
>
> > Take a look at the "requestAction" method.
>
> > And instead of a helper, I think you'd better use an element.
>
> > On 19 août, 00:06, "Mark (Germany)" <[EMAIL PROTECTED]>
> > wrote:
>
> > > I have a helper which needs the "codecats" table data (20-40 rows)
> > > everywhere where it is used.
> > > i sure could ask for it in the controller:
> > > ->list('all')..
> > > and pass it the view
> > > there i can again pass it to the helper
>
> > > but is there
> > > a) a way to automatically pass it from the controller to the helper
> > > b) directly get the information into the helper (without having to
> > > manually query the DB)
>
> > > i have thought about using some caching or file-exporting (xml)
> > > the helper could read out this file again.
> > > but - what kind of backup would there be if the file gets lost somehow
> > > (as it is in temp folder the max lifetime may be over some time)?
> > > or is this a good practive anyway?
>
> > > thats what is bothering me right now
> > > as i do not know how to stick to the MVC pattern
>
> > > especially because this helper is not bound to specific controllers
> > > and may be used quite a lot.
> > > so it would be really a huge load of code if i have to do it as
> > > described above: controller -> view -> helper
>
> > > thx
> > > mark
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



find list vs find all - Manipulating the format of a javascript object

2008-08-19 Thread Josoroma

With the following piece of code:


function getJsonStates() {

//Configure::write("debug",0);

$params = array(
'conditions'=> null,
'fields'=> 
array(

'State.id',

'State.name'

),
'recursive' => 0
);

$states = $this->State->find('all', $params);

$this->set(compact('states'));


}


Im generating a javascript object like this:

[{"State":{"id":"1","name":"Lizenburgue"}},{"State":
{"id":"2","name":"Oak"}},{"State":{"id":"3","name":"San Pedro"}}]

Using list instead of all: $this->State->find('list', $params);

Im generating a javascript object like this:

[{"1":"Lizenburgue","2":"Oak","3":"San Pedro"}]

***But i need to generate the result as:

[{"1":"Lizenburgue"},{"2":"Oak"},{"3":"San Pedro"}]

There exist some way of doing that using find with extract or combine?


Any help is welcome, 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: Attm behaviour without finfo functions

2008-08-19 Thread Jared

David,
The documents confused me when it asked me to go to the other text
file and do the install except for a certain part. I also was confused
on what actually media root refers to and where to put the directories
that it talks about. Maybe just combine the instructions into one
document. I've had to move on from trying to get this to work but will
come back to it in a bit.

On Aug 7, 11:34 am, David Persson <[EMAIL PROTECTED]> wrote:
> Hi Alessandro,
>
> I'm not going to update the Bakery article before the 0.50er series is
> at least beta and I'm sure it works in most cases. Did you find the
> READMEs in the plugins/attachements/docs and plugins/media/docs
> directories? I'm sorry that I can't provide you with an instant
> solution. I hope you can wait a 3-5 weeks (this seems very long in
> webdevelopment isn't it?).
>
> David
>
> p.s.: if you can tell me where the docs confuse you i fix that.
>
> On 7 Aug., 12:04, Alessandro Daducci <[EMAIL PROTECTED]>
> wrote:
>
> > Thanks David,
> > but now I have problem in figuring out how to use this version of your
> > code. I'm new in using plugins and I'm not even able to build your
> > example.. :-(
> > Did you write any sort of tutorial for using it like the wonderful one
> > article you wrote on the Bakery (http://bakery.cakephp.org/articles/
> > view/attachments)?
>
> > Alessandro
>
> > On 6 Ago, 01:00, David Persson <[EMAIL PROTECTED]> wrote:
>
> > > Hi Alessandro,
>
> > > I was aware of the problem that a very few hosters won't have the
> > > finfo extension nor the mime_content_type function. The Mimetype class
> > > which is in the package too is responsible for handling all mimetype
> > > requests. It should fall back to extension based lookup if content
> > > based is not available or does not yield anything.
>
> > > There are e.g.  temporary files ("/tmp/3234kjfsdf") where both methods
> > > would fail in your case.
>
> > > If you are using the latest unstable == 0.50alphaattmpackage and you
> > > experience those mimetype detection problems during uploads then
> > > simply exclude the mimetype rule by commenting or removing it from
> > > plugins/attachments/models/attachment.php.
>
> > > On 5 Aug., 21:27, Alessandro Daducci <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > I'm trying tu use the 'attmbehaviour' by David Persson, but I can't
> > > > figure out how to use this behaviour if I only need to work on file-
> > > > extensions and not on mime-type.
>
> > > > This is because on my localhost there are no problems at all, but I
> > > > have to install a cakephp site on a hosting service not supporting
> > > > 'finfo' nor 'mime_content_type' functions.
>
> > > > How can I solve this problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: strange html code behavior (ajax, firefox)

2008-08-19 Thread francky06l

A bit too long code, you should use the bin ..
However, when ajax is involved and you modify an id ( ="),
be aware that it might on this form for good reason. Usually it's
because the ajax request will use this DOM id to update the view.

I guess the answer of the ajax call, is not finding the Dom id
anymore ... You should look to the file adjustperm.ctp, it must
contain the code to update the initial DOM id, and probably contains
the same syntax for the id.

hth

On Aug 19, 9:02 am, byku <[EMAIL PROTECTED]> wrote:
> Hi.
>
> first post (...english isnt my first language ;) )
>
> lately i started to build users management part for my new "project"
> using acl/roles using example 
> fromhttp://www.cakephpforum.net/index.php?showtopic=27&st=0
>
> there is some acl managment action that output controller actions /
> roles in grid to easier menagament of above (i uses ajax) i have
> modified it a bit (view) - but i have some strange isues with this
> under Firefox...
>
> Firefox:http://img80.imageshack.us/img80/2607/ffcakehr1.jpg
> at this screenshot actions "add" (both controllers) and "adjustperm"
> are not visible - they are in html code but i cant see them - even
> when i remove css file, i tested this a bit and i found that
>
> 
>
> id generated in this way generates this error, if i modify this to
> look like
>
><- one "_"
> less
>
> i can see every actions but ajax wont update this cells
>
> Firefox/IE generates this in my error.log (every time i hit ajax
> link):
>
> 2008-08-19 08:07:49 Error: 
> // _elem = $('Roles_cleanupAcl_1'); Element.replace(_elem,
> unescape("%3Ctd id=\"Roles_cleanupAcl_1\" class=\"actdanied\">denied
> %3Ca href=\"\/test07\/index.php\/roles\/adjustperm\/1\/Roles\/
> cleanupAcl\/allow\" id=\"link9470\" onclick=\" event.returnValue =
> false; return false;\">allow?%3C\/a>%3Cscript type=\"text\/javascript
> \">\r\n\/\/%3C![CDATA[\r\nEvent.observe('link9470', 'click',
> function(event) { new Ajax.Updater('updacl','\/test07\/index.php\/
> roles
> \/adjustperm\/1\/Roles\/cleanupAcl\/allow', {asynchronous:true,
> evalScripts:true, requestHeaders:['X-Update', 'updacl']}) }, false);\r
> \n\/\/]]>\r\n%3C\/script>%3C\/td>"));
> //]]>
> 
>
> he is the complete view/action code:
>
> ACTION:
>
> function acl() {
>
> $avoidControllers   = array('Pages');
> $data   = $this->Role->findAll();
> $controllerList = $this->ControllerList->get();
>
> // we loop on all action for all roles
> $inidbg =  Configure::read( 'debug');
>
> Configure::write( 'debug', '0' );
>
> foreach($controllerList as $controller => $actions) {
>
> if(in_array($controller, $avoidControllers)) {
>
> unset($controllerList[$controller]);
> continue;
>
> }
> foreach($actions as $key => $action) {
>
> $controllerList[$controller][$action] = array();
> unset($controllerList[$controller][$key]);
> foreach($data as $p)
> $controllerList[$controller][$action][$p['Role']
> ['id']] = $this->Acl->check($p, $controller . '/'. $action, '*');
>
> }
>
> }
>
> Configure::write( 'debug', $inidbg);
> $this->set('actlist', $controllerList);
> $this->set('data', $data);
>
> }
>
> VIEW:
>
> 
>
> 
> 
> Controller Action
> 
> 
> 
> 
>
>  $actions): ?>
>
> 
>  $controller; ?>
>
> 
>
> 
> link('Allow all', '/roles/adjustperm/'.
> $val['Role']['id'].'/'.$controller.'/all/allow', array('update' =>
> 'updacl')); ?>
> link( 'Deny all', '/roles/adjustperm/'.
> $val['Role']['id'].'/'.$controller.'/all/deny', array('update' =>
> 'updacl')); ?>
> 
>
> 
>
> 
>
>  $perm): ?>
> 
> 
>
>  $val): ?>
> 
> link('deny?', '/roles/
> adjustperm/'.$key.'/'.$controller.'/'.$action.'/deny', array('update'
> => 'updacl')) :
>   'denied '.$ajax->link('allow?', '/roles/adjustperm/'.$key.'/'.
> $controller.'/'.$action.'/allow', array('update' => 'updacl')); ?>
> 
> 
>
> 
> 
>
> 
>
> 
>
> 
> 
>
> ps. it may double post - i send this post earlier but it didnt show 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 2 column layout for $form->input() ?

2008-08-19 Thread Lance Willett

@peterm95018 and @Malcolm, how-to for CSS and HTML probably isn't an
appropriate topic for the Cake group–unless of course you are having
trouble getting the HTML output you want from the HTML helper, for
example.

A bit of Google searching will find you some great examples of form
layout. From 4 years ago, PPK's examples still hold true:
http://www.quirksmode.org/css/forms.html. If you want to have the
basic code generated for you, use a tool like Wufoo (http://
wufoo.com/) to create a nice looking form, then export the CSS and
HTML code using their tools. HTML Dog has a nice set of tutorials
also: http://www.htmldog.com/guides/htmlbeginner/forms/, see the
bottom of each tutorial for code samples.

On Aug 18, 5:53 pm, peterm95018 <[EMAIL PROTECTED]> wrote:
> Would it be possible for someone to post a short example? I've been
> struggling with formatting a form layout all day.
>
> thank you,
>
> peterm
--~--~-~--~~~---~--~~
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: scaffolding / $form->input() problem

2008-08-19 Thread thom

brilliant.. thanks so much!

On Aug 19, 3:54 pm, grigri <[EMAIL PROTECTED]> wrote:
> Try this:
>
> echo $form->input('user_id', array('empty' => 'No User'));
>
> On Aug 19, 2:18 pm, thom <[EMAIL PROTECTED]> wrote:
>
> > ok, i have a users and an authors table:
>
> > User hasOne Author
> > Author belongsTo User
>
> > this is so i can link an author to a user-account (for page login)..
> > it is however optional.. i have to be able to create authors that
> > arent related to any user which is where the problem comes in.. after
> > doing al the scaffolding with: cake bake all
>
> > i am presented with all the right forms.. adding/editing an author
> > allows me to select the related user.. HOWEVER: it doesn't allow me to
> > select no user.. im talking about something like --
> > none --.. please note that i made sure the user_id field in
> > authors allows NULL values.. furthermore there are no validation rules
> > set for user_id in the Author Model so that should default to required
> > = false!?
>
> > im out of guess here.. i know there are probably ways to hack the view
> > but i want scaffolding to do the work for me.. are there any modifiers/
> > options i forgot?
>
> > or at least something like
>
> > $form->input('user_id', array('required' => false));
>
> > in the view? i checked the 1.2. docs without any luck.. any advice/
> > places to look 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: scaffolding / $form->input() problem

2008-08-19 Thread teknoid

You need to manually modify the code, scaffolding cannot guess
everything for you.

It's pretty easy to add a default/empty option to your input(), see
the API for syntax.

On Aug 19, 9:18 am, thom <[EMAIL PROTECTED]> wrote:
> ok, i have a users and an authors table:
>
> User hasOne Author
> Author belongsTo User
>
> this is so i can link an author to a user-account (for page login)..
> it is however optional.. i have to be able to create authors that
> arent related to any user which is where the problem comes in.. after
> doing al the scaffolding with: cake bake all
>
> i am presented with all the right forms.. adding/editing an author
> allows me to select the related user.. HOWEVER: it doesn't allow me to
> select no user.. im talking about something like --
> none --.. please note that i made sure the user_id field in
> authors allows NULL values.. furthermore there are no validation rules
> set for user_id in the Author Model so that should default to required
> = false!?
>
> im out of guess here.. i know there are probably ways to hack the view
> but i want scaffolding to do the work for me.. are there any modifiers/
> options i forgot?
>
> or at least something like
>
> $form->input('user_id', array('required' => false));
>
> in the view? i checked the 1.2. docs without any luck.. any advice/
> places to look 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: scaffolding / $form->input() problem

2008-08-19 Thread grigri

Try this:

echo $form->input('user_id', array('empty' => 'No User'));

On Aug 19, 2:18 pm, thom <[EMAIL PROTECTED]> wrote:
> ok, i have a users and an authors table:
>
> User hasOne Author
> Author belongsTo User
>
> this is so i can link an author to a user-account (for page login)..
> it is however optional.. i have to be able to create authors that
> arent related to any user which is where the problem comes in.. after
> doing al the scaffolding with: cake bake all
>
> i am presented with all the right forms.. adding/editing an author
> allows me to select the related user.. HOWEVER: it doesn't allow me to
> select no user.. im talking about something like --
> none --.. please note that i made sure the user_id field in
> authors allows NULL values.. furthermore there are no validation rules
> set for user_id in the Author Model so that should default to required
> = false!?
>
> im out of guess here.. i know there are probably ways to hack the view
> but i want scaffolding to do the work for me.. are there any modifiers/
> options i forgot?
>
> or at least something like
>
> $form->input('user_id', array('required' => false));
>
> in the view? i checked the 1.2. docs without any luck.. any advice/
> places to look 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



scaffolding / $form->input() problem

2008-08-19 Thread thom

ok, i have a users and an authors table:

User hasOne Author
Author belongsTo User

this is so i can link an author to a user-account (for page login)..
it is however optional.. i have to be able to create authors that
arent related to any user which is where the problem comes in.. after
doing al the scaffolding with: cake bake all

i am presented with all the right forms.. adding/editing an author
allows me to select the related user.. HOWEVER: it doesn't allow me to
select no user.. im talking about something like --
none --.. please note that i made sure the user_id field in
authors allows NULL values.. furthermore there are no validation rules
set for user_id in the Author Model so that should default to required
= false!?

im out of guess here.. i know there are probably ways to hack the view
but i want scaffolding to do the work for me.. are there any modifiers/
options i forgot?

or at least something like

$form->input('user_id', array('required' => false));

in the view? i checked the 1.2. docs without any luck.. any advice/
places to look 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to get the category cover from a product table?

2008-08-19 Thread Henrique Machado

This works perfectly!

Thank you

2008/8/19 grigri <[EMAIL PROTECTED]>:
>
> Set up an extra relationship, like so:
>
> class Category extends AppModel {
>  // ...
>  var $belongsTo = array(
>'CoverProduct' => array(
>  'className' => 'Product',
>  'foreignKey' => 'imgpath',
>  'fields' => array('imgpath')
>)
>  );
>  // ...
> }
>
> Yes, it does "sound" weird that a category belongs to its cover, as in
> real-world usage we'd say the opposite. But this is the way cake works
> things.
>
> Now when you do your pagination and set $categories in the view:
>
> foreach ($categories as $cat) {
>  echo $cat['Category']['nome']; // Category title
>  echo $html->image($cat['CoverProduct']['imgpath']); // Category
> image
> }
>
> hth
> grigri
>
> On Aug 19, 5:08 am, "Henrique Machado" <[EMAIL PROTECTED]> wrote:
>> Hello!
>> This is my first messa ge here.
>> Sorry my bad english, i'm from brazil
>>
>> Scenario:
>>
>> Category hasMany Products
>> Products belongsTo Category
>>
>> category table:
>>
>>   `id` int(10) unsigned NOT NULL auto_increment,
>>   `nome` varchar(255) collate utf8_unicode_ci default NULL,
>>   `created` datetime default NULL,
>>   `slug` varchar(255) collate utf8_unicode_ci default NULL,
>>   `imgcover` int(11) NOT NULL,
>>   PRIMARY KEY  (`id`)
>>
>> products:
>>
>>   `id` int(10) unsigned NOT NULL auto_increment,
>>   `imgpath varchar(255) collate utf8_unicode_ci default NULL,
>>   `legend` varchar(255) collate utf8_unicode_ci default NULL,
>>   `created` datetime default NULL,
>>   `slug` varchar(255) collate utf8_unicode_ci default NULL,
>>   `category_id` int(10) unsigned default NULL,
>>   PRIMARY KEY  (`id`),
>>   KEY `fotos_obra` (`obra_id`)
>> ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
>> AUTO_INCREMENT=27 ;
>>
>> My problem: I need to show the imgcover (is the product id) in my
>> category index:
>> function index() {
>> $this->Category->recursive = 1;
>> $this->set('categories', $this->paginate());
>> }
>>
>> The "php" way is do an foreach categories and loop each cagotegory to
>> do something like: SELECT imgpath FROM PRODUCTS WHERE id =
>> category.imgcover
>>
>> But, in the cake way?
>>
>> 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
-~--~~~~--~~--~--~---



Re: Containable Behavior misunderstanding

2008-08-19 Thread teknoid

Containable will return you all posts and will return you only those
comments that have 'test', this is by design (at least for now).

You may want to force a JOIN to strictly filter out the data.

On Aug 19, 10:02 am, "Siegfried Hirsch" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> using cake 1.2 rc2 I also want to use the Containable behavior.
>
> I have a relation like Post and Comment and I do the following:
>
>         $this->paginate['conditions'] = array('Post.ramble_id' => $rambleId);
>         $this->paginate['contain'] = array('Comment.body LIKE "%test%"');
>                 $this->set('posts', $this->paginate());
>
> 3 Posts where only the post 1 and post 3 have a comments where in the body the
> word "test" is contained. My problem is now, that I also get the post
> 2, which does
> not have a comment and of course there is no body which contains "test".
>
> So my question is: is this intentional or how could I make cake to
> bring back only
> those posts, that have a comment, which meets the condition ?
>
> Siegfried
--~--~-~--~~~---~--~~
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 Behavior misunderstanding

2008-08-19 Thread Siegfried Hirsch

Hi,

using cake 1.2 rc2 I also want to use the Containable behavior.

I have a relation like Post and Comment and I do the following:

$this->paginate['conditions'] = array('Post.ramble_id' => $rambleId);
$this->paginate['contain'] = array('Comment.body LIKE "%test%"');
$this->set('posts', $this->paginate());


3 Posts where only the post 1 and post 3 have a comments where in the body the
word "test" is contained. My problem is now, that I also get the post
2, which does
not have a comment and of course there is no body which contains "test".

So my question is: is this intentional or how could I make cake to
bring back only
those posts, that have a comment, which meets the condition ?

Siegfried

--~--~-~--~~~---~--~~
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: Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread clemos

Hi

It looks like Xamp doesn't enable "mod_rewrite" by default, and I
guess that's why your Cake install doesn't work (phpinfo() will
confirm you wether or not it is loaded or not: see "Loaded Modules").
To enable (load) mod_rewrite, you need to open your httpd.conf, search
"mod_rewrite", and uncomment the corresponding line  ("LoadModule
rewrite_module modules/mod_rewrite.so" probably; if not present, just
add it to the modules section).

By the way, the manual is quite detailed on these issues :
http://manual.cakephp.org/view/32/installation#apache-and-mod_rewrite-37

Then if it's not your problem, please try to provide more debug
informations about the issue: what did you do ? what exactly do you
see ? (unavailable mod_rewrite usually results in an unstyled home
page with css and img not loaded, and 404 in all other pages)

Hope it helps
+++
Clément

On Tue, Aug 19, 2008 at 10:58 AM, www.landed.at <[EMAIL PROTECTED]> wrote:
>
> I have the smae problem, not with xamp though. For beginers the
> documentation or posts relating to this are not clear enough. I posted
> a similar query yesterday but didnt get my post in the daily
> digest ??? So I'm sorry not to be able to help but just want to add
> weight to this issue, for people that are ok with php but less ok with
> server stuff.
>
> On Aug 19, 7:34 am, giulio <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I'm new of cake php.
>>
>> I'm trying to install cakephp in windows vista, i downloaded and
>> installed xampp and all seems to be fine.
>>
>> I've followed the instructions for cake php and it goes well.
>>
>> I've only some problems:
>>
>> 1- I can't see the graphic of the default cake php page, i read that
>> it depends of configuratione of httpd.conf so i set the options
>> FollowSyLinks to AllowOverride All and the correct path, but i've not
>> solved the problem
>>
>> 2- I tried with a simple cake php application made by other (a
>> todolist application ) but when i write the 
>> controllerhttp://localhost/todo/items
>> i can see only the result Object not found... maybe are there problems
>> with htaccess? I able mod rewrite.
>>
>> If someone has a file httpd.conf please send me this file to me, so i
>> can solve all the configurations problems.
>>
>> Thanks Giulio
>
> >
>

--~--~-~--~~~---~--~~
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: Problem with Cake and Vista

2008-08-19 Thread Donkeybob

I got my xampp and cakephp to work perfectly with vista. I didn't have
to change anything in my .conf file except to un-comment the
mod_rewrite module. granted I also have several virtual sites set up
for all my projects. . . .but it works right out of the box. like the
other richard said, make sure you restart apache after every edit.

Rich


On Aug 19, 5:19 am, giulio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Yes I reboot the system.
>
> Someone as a httpd.conf file for xmapp and vista that works and can
> post it?
>
> I think that it'll be useful.
>
> Thanks for the help
>
> Giulio
>
> On 19 Ago, 10:15, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > Did you reboot apache after you made changes to httpd.conf?
>
> > And, btw, Cake with Apache & PHP on Vista is entirely possible - I'm
> > doing it right now :-)
>
> > On Aug 19, 7:49 am, giulio <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I'm new of cake php.
>
> > > I'm trying to install cakephp in windows vista, i downloaded and
> > > installed xampp and all seems to be fine.
>
> > > I've followed the instructions for cake php and it goes well.
>
> > > I've only some problems:
>
> > > 1- I can't see the graphic of the default cake php page, i read that
> > > it depends of configuratione of httpd.conf so i set the options
> > > FollowSyLinks to AllowOverride All and the correct path, but i've not
> > > solved the problem
>
> > > 2- I tried with a simple cake php application made by other (a
> > > todolist application ) but when i write the 
> > > controllerhttp://localhost/todo/items
> > > i can see only the result Object not found... maybe are there problems
> > > with htaccess? I able mod rewrite.
>
> > > If someone has a file httpd.conf please send me this file to me, so i
> > > can solve all the configurations problems.
>
> > > Thanks Giulio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Ajax link creation

2008-08-19 Thread f1codz

dear all,

i have a problem with $ajax->link() function.

My doubt is - how do we pass post parameters to the action using $ajax-
>link().
Though the ajaxOptions array contains the options 'parameters' ..
setting it to some value while calling $ajax->link()  is providing no
functionality:

$ajax->link('save', 'javascript://' , array(
'url' => '/controller/action',
'update => 'my_division',
'method' => 'post',
'parameters =>
'name=f1codz&value=help'
));


i checked the script generated in the source code .. it holds no
reference to the parameters keyword.
i hope its not a problem with cakePHP or is it???

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



Re: Custom ERROR 404 layout

2008-08-19 Thread tomek lisiewicz

Hi,
I've created error.php file in /app folder, which contains code as
follows:

controller->layout = "error";
parent::error404($params);
}
}

?>

function error404 is overriden to display my custom layout
"error.thtml" in /layouts folder, and then, function does what it's
suppose to do, by calling "parent version" of it

regards

On 11 Sie, 13:15, kik <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm trying to create custom 404 page and I know that I should create
> the /app/views/errors/error404.thtml  file and insert the content
> there but I also want to use different layout for the error page. This
> means that I dont want to use my default layout but to have separate
> layout for the page that accommodates the 404 thml view file. Does
> anyone know how I can achieve that?
>
> Thank you in advance for your help!

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



Re: Problem with Cake and Vista

2008-08-19 Thread giulio

Hi,

Yes I reboot the system.

Someone as a httpd.conf file for xmapp and vista that works and can
post it?

I think that it'll be useful.

Thanks for the help

Giulio


On 19 Ago, 10:15, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Did you reboot apache after you made changes to httpd.conf?
>
> And, btw, Cake with Apache & PHP on Vista is entirely possible - I'm
> doing it right now :-)
>
> On Aug 19, 7:49 am, giulio <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm new of cake php.
>
> > I'm trying to install cakephp in windows vista, i downloaded and
> > installed xampp and all seems to be fine.
>
> > I've followed the instructions for cake php and it goes well.
>
> > I've only some problems:
>
> > 1- I can't see the graphic of the default cake php page, i read that
> > it depends of configuratione of httpd.conf so i set the options
> > FollowSyLinks to AllowOverride All and the correct path, but i've not
> > solved the problem
>
> > 2- I tried with a simple cake php application made by other (a
> > todolist application ) but when i write the 
> > controllerhttp://localhost/todo/items
> > i can see only the result Object not found... maybe are there problems
> > with htaccess? I able mod rewrite.
>
> > If someone has a file httpd.conf please send me this file to me, so i
> > can solve all the configurations problems.
>
> > Thanks Giulio

--~--~-~--~~~---~--~~
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: Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread www.landed.at

I have the smae problem, not with xamp though. For beginers the
documentation or posts relating to this are not clear enough. I posted
a similar query yesterday but didnt get my post in the daily
digest ??? So I'm sorry not to be able to help but just want to add
weight to this issue, for people that are ok with php but less ok with
server stuff.

On Aug 19, 7:34 am, giulio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new of cake php.
>
> I'm trying to install cakephp in windows vista, i downloaded and
> installed xampp and all seems to be fine.
>
> I've followed the instructions for cake php and it goes well.
>
> I've only some problems:
>
> 1- I can't see the graphic of the default cake php page, i read that
> it depends of configuratione of httpd.conf so i set the options
> FollowSyLinks to AllowOverride All and the correct path, but i've not
> solved the problem
>
> 2- I tried with a simple cake php application made by other (a
> todolist application ) but when i write the 
> controllerhttp://localhost/todo/items
> i can see only the result Object not found... maybe are there problems
> with htaccess? I able mod rewrite.
>
> If someone has a file httpd.conf please send me this file to me, so i
> can solve all the configurations problems.
>
> Thanks Giulio

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



Available plugins as Model data?

2008-08-19 Thread [EMAIL PROTECTED]

Hi,
I was thinking about splitting my current application into a smaller
core and a number of plugins. I would like to be able to represent the
plugins as data of a Model but I think there are better ways of doing
this than what I have managed so far.

Almost all functionality accessible to logged in users will be
plugins.
I wanted to avoid using SQL for the data since there will usually be
between, say, 3 and 8 plugins for each installation and all basic
information about the plugins will be "static" once the installation
is done. Having a table with 4-5 fields and 3-8 records has felt
clumsy so far. But I still want to be able to link to a plugin using
associations.

For example I would like to have a "main menu" displaying links to
each plugin available to a certain user. I also want real restrictions
based on user->plugin association. Things like that.

Is there a way to setup a Plugin Model without a table and instead
take the data from a configuration file of some similar source?

Sort of like a Fixture even though Fixtures actually load their data
info the database and then work like normal Models. If using a fixture
for the data does not give me a great overhead (extra SQL) it would be
a possibility. When I build a new plugin it would be more natural to
enter some data for it in a php-file instead of creating SQL data and
remembering to update the db in each installation at the same time I
upload the new files.

Any tips and experiences in the field of alternative Models greatly
appreciated.

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



Re: views for shell scripts

2008-08-19 Thread JuergenRiemer

Super,
thanks Daniel for pointing me the Core *g*
works like a charm now!

> App::import('Core', array('View', 'Controller'));
> $view = new View(new Controller());
> $viewContent = $view->render('/elements/view_name');

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



Error pages and beforeFilter

2008-08-19 Thread MonkeyGirl

Hi.

I've made an error page at /app/views/errors/error404.ctp which, as
you might expect, has /app/views/layouts/default.ctp wrapped around
it. The problem I've got is that the default layout relies on
variables being set in /app/app_controller.php's beforeFilter(), which
doesn't seem to be called for error pages.

Is there a way to get the error pages that live in /app/views/errors
to call /app/app_controller.php's beforeFilter() method?

Thanks for your help,
Zoe.
--~--~-~--~~~---~--~~
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: How to get the category cover from a product table?

2008-08-19 Thread grigri

Set up an extra relationship, like so:

class Category extends AppModel {
  // ...
  var $belongsTo = array(
'CoverProduct' => array(
  'className' => 'Product',
  'foreignKey' => 'imgpath',
  'fields' => array('imgpath')
)
  );
  // ...
}

Yes, it does "sound" weird that a category belongs to its cover, as in
real-world usage we'd say the opposite. But this is the way cake works
things.

Now when you do your pagination and set $categories in the view:

foreach ($categories as $cat) {
  echo $cat['Category']['nome']; // Category title
  echo $html->image($cat['CoverProduct']['imgpath']); // Category
image
}

hth
grigri

On Aug 19, 5:08 am, "Henrique Machado" <[EMAIL PROTECTED]> wrote:
> Hello!
> This is my first messa ge here.
> Sorry my bad english, i'm from brazil
>
> Scenario:
>
> Category hasMany Products
> Products belongsTo Category
>
> category table:
>
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `nome` varchar(255) collate utf8_unicode_ci default NULL,
>   `created` datetime default NULL,
>   `slug` varchar(255) collate utf8_unicode_ci default NULL,
>   `imgcover` int(11) NOT NULL,
>   PRIMARY KEY  (`id`)
>
> products:
>
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `imgpath varchar(255) collate utf8_unicode_ci default NULL,
>   `legend` varchar(255) collate utf8_unicode_ci default NULL,
>   `created` datetime default NULL,
>   `slug` varchar(255) collate utf8_unicode_ci default NULL,
>   `category_id` int(10) unsigned default NULL,
>   PRIMARY KEY  (`id`),
>   KEY `fotos_obra` (`obra_id`)
> ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
> AUTO_INCREMENT=27 ;
>
> My problem: I need to show the imgcover (is the product id) in my
> category index:
>         function index() {
>                 $this->Category->recursive = 1;
>                 $this->set('categories', $this->paginate());
>         }
>
> The "php" way is do an foreach categories and loop each cagotegory to
> do something like: SELECT imgpath FROM PRODUCTS WHERE id =
> category.imgcover
>
> But, in the cake way?
>
> 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
-~--~~~~--~~--~--~---



Re: views for shell scripts

2008-08-19 Thread Daniel Hofstetter

Hi Juergen,

> I created a shell script to produce statistics. Works fine. Now I want
> to create a nicely formated HTML page with the results and this leads
> me to my problem: how can I create this HTML file from within my shell
> script.
> I thought of using the render function and writing it to the harddisk
> like so:
> $htmlReport = $this->render( VIEWS.'/elements/shells/report.ctp' );
> and then use php fwrite to write it to the harddisk.
> Yet I get the message that ReportShell::render() is not defined.
> What do I have to import? Or is there a better way to make use of
> views in shell scripts?

You could try something like:

App::import('Core', array('View', 'Controller'));
$view = new View(new Controller());
$viewContent = $view->render('/elements/view_name');

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.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: Problem with Cake and Vista

2008-08-19 Thread RichardAtHome

Did you reboot apache after you made changes to httpd.conf?

And, btw, Cake with Apache & PHP on Vista is entirely possible - I'm
doing it right now :-)

On Aug 19, 7:49 am, giulio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new of cake php.
>
> I'm trying to install cakephp in windows vista, i downloaded and
> installed xampp and all seems to be fine.
>
> I've followed the instructions for cake php and it goes well.
>
> I've only some problems:
>
> 1- I can't see the graphic of the default cake php page, i read that
> it depends of configuratione of httpd.conf so i set the options
> FollowSyLinks to AllowOverride All and the correct path, but i've not
> solved the problem
>
> 2- I tried with a simple cake php application made by other (a
> todolist application ) but when i write the 
> controllerhttp://localhost/todo/items
> i can see only the result Object not found... maybe are there problems
> with htaccess? I able mod rewrite.
>
> If someone has a file httpd.conf please send me this file to me, so i
> can solve all the configurations problems.
>
> Thanks Giulio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



views for shell scripts

2008-08-19 Thread JuergenRiemer

Hi,

I created a shell script to produce statistics. Works fine. Now I want
to create a nicely formated HTML page with the results and this leads
me to my problem: how can I create this HTML file from within my shell
script.
I thought of using the render function and writing it to the harddisk
like so:
$htmlReport = $this->render( VIEWS.'/elements/shells/report.ctp' );
and then use php fwrite to write it to the harddisk.
Yet I get the message that ReportShell::render() is not defined.
What do I have to import? Or is there a better way to make use of
views in shell scripts?
thx
Juergen

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



strange html code behavior (ajax, firefox)

2008-08-19 Thread byku

Hi.

first post (...english isnt my first language ;) )

lately i started to build users management part for my new "project"
using acl/roles using example from 
http://www.cakephpforum.net/index.php?showtopic=27&st=0

there is some acl managment action that output controller actions /
roles in grid to easier menagament of above (i uses ajax) i have
modified it a bit (view) - but i have some strange isues with this
under Firefox...

Firefox: http://img80.imageshack.us/img80/2607/ffcakehr1.jpg
at this screenshot actions "add" (both controllers) and "adjustperm"
are not visible - they are in html code but i cant see them - even
when i remove css file, i tested this a bit and i found that



id generated in this way generates this error, if i modify this to
look like

   <- one "_"
less

i can see every actions but ajax wont update this cells

Firefox/IE generates this in my error.log (every time i hit ajax
link):

2008-08-19 08:07:49 Error: 
//denied
%3Ca href=\"\/test07\/index.php\/roles\/adjustperm\/1\/Roles\/
cleanupAcl\/allow\" id=\"link9470\" onclick=\" event.returnValue =
false; return false;\">allow?%3C\/a>%3Cscript type=\"text\/javascript
\">\r\n\/\/%3C![CDATA[\r\nEvent.observe('link9470', 'click',
function(event) { new Ajax.Updater('updacl','\/test07\/index.php\/
roles
\/adjustperm\/1\/Roles\/cleanupAcl\/allow', {asynchronous:true,
evalScripts:true, requestHeaders:['X-Update', 'updacl']}) }, false);\r
\n\/\/]]>\r\n%3C\/script>%3C\/td>"));
//]]>



he is the complete view/action code:

ACTION:

function acl() {

$avoidControllers   = array('Pages');
$data   = $this->Role->findAll();
$controllerList = $this->ControllerList->get();

// we loop on all action for all roles
$inidbg =  Configure::read( 'debug');

Configure::write( 'debug', '0' );

foreach($controllerList as $controller => $actions) {

if(in_array($controller, $avoidControllers)) {

unset($controllerList[$controller]);
continue;

}
foreach($actions as $key => $action) {

$controllerList[$controller][$action] = array();
unset($controllerList[$controller][$key]);
foreach($data as $p)
$controllerList[$controller][$action][$p['Role']
['id']] = $this->Acl->check($p, $controller . '/'. $action, '*');

}

}

Configure::write( 'debug', $inidbg);
$this->set('actlist', $controllerList);
$this->set('data', $data);

}


VIEW:





Controller Action





 $actions): ?>







link('Allow all', '/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/allow', array('update' =>
'updacl')); ?>
link( 'Deny all', '/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/deny', array('update' =>
'updacl')); ?>






 $perm): ?>



 $val): ?>

link('deny?', '/roles/
adjustperm/'.$key.'/'.$controller.'/'.$action.'/deny', array('update'
=> 'updacl')) :
  'denied '.$ajax->link('allow?', '/roles/adjustperm/'.$key.'/'.
$controller.'/'.$action.'/allow', array('update' => 'updacl')); ?>






















ps. it may double post - i send this post earlier but it didnt show 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with Cake and Vista

2008-08-19 Thread giulio

Hi,

I'm new of cake php.

I'm trying to install cakephp in windows vista, i downloaded and
installed xampp and all seems to be fine.

I've followed the instructions for cake php and it goes well.

I've only some problems:

1- I can't see the graphic of the default cake php page, i read that
it depends of configuratione of httpd.conf so i set the options
FollowSyLinks to AllowOverride All and the correct path, but i've not
solved the problem

2- I tried with a simple cake php application made by other (a
todolist application ) but when i write the controller 
http://localhost/todo/items
i can see only the result Object not found... maybe are there problems
with htaccess? I able mod rewrite.

If someone has a file httpd.conf please send me this file to me, so i
can solve all the configurations problems.

Thanks Giulio

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



Newbie of Cake Php : Problems with Vista Installation and First Application

2008-08-19 Thread giulio

Hi,

I'm new of cake php.

I'm trying to install cakephp in windows vista, i downloaded and
installed xampp and all seems to be fine.

I've followed the instructions for cake php and it goes well.

I've only some problems:

1- I can't see the graphic of the default cake php page, i read that
it depends of configuratione of httpd.conf so i set the options
FollowSyLinks to AllowOverride All and the correct path, but i've not
solved the problem

2- I tried with a simple cake php application made by other (a
todolist application ) but when i write the controller 
http://localhost/todo/items
i can see only the result Object not found... maybe are there problems
with htaccess? I able mod rewrite.

If someone has a file httpd.conf please send me this file to me, so i
can solve all the configurations problems.

Thanks Giulio

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



strange html code behavior (ajax)

2008-08-19 Thread byku

Hi.

first post (...english isnt my first language ;) )

lately i started to build users management part for my new "project"
using acl/roles using example from 
http://www.cakephpforum.net/index.php?showtopic=27&st=0

there is some acl managment action that output controller actions /
roles in grid to easier menagament of above (i uses ajax) i have
modified it a bit (view) - but i have some strange isues with this
under Firefox and IE...

Firefox: http://img80.imageshack.us/img80/2607/ffcakehr1.jpg
at this screenshot actions "add" (both controllers) and "adjustperm"
are not visible - they are in html code but i cant see them - even
when i remove css file, i tested this a bit and i found that



id generated in this way generates this error, if i modify this to
look like



i can see every actions but ajax wont update this cells

IE:  - i see
_every_ action but exchange... ajax doesnt update :(

Firefox/IE generates this in my error.log (every time i hit ajax
link):

2008-08-19 08:07:49 Error: 
//denied
%3Ca href=\"\/test07\/index.php\/roles\/adjustperm\/1\/Roles\/
cleanupAcl\/allow\" id=\"link9470\" onclick=\" event.returnValue =
false; return false;\">allow?%3C\/a>%3Cscript type=\"text\/javascript
\">\r\n\/\/%3C![CDATA[\r\nEvent.observe('link9470', 'click',
function(event) { new Ajax.Updater('updacl','\/test07\/index.php\/roles
\/adjustperm\/1\/Roles\/cleanupAcl\/allow', {asynchronous:true,
evalScripts:true, requestHeaders:['X-Update', 'updacl']}) }, false);\r
\n\/\/]]>\r\n%3C\/script>%3C\/td>"));
//]]>












he is the complete view/action code:

ACTION:

function acl() {

$avoidControllers   = array('Pages');
$data   = $this->Role->findAll();
$controllerList = $this->ControllerList->get();

// we loop on all action for all roles
$inidbg =  Configure::read( 'debug');

Configure::write( 'debug', '0' );

foreach($controllerList as $controller => $actions) {

if(in_array($controller, $avoidControllers)) {

unset($controllerList[$controller]);
continue;

}
foreach($actions as $key => $action) {

$controllerList[$controller][$action] = array();
unset($controllerList[$controller][$key]);
foreach($data as $p)
$controllerList[$controller][$action][$p['Role']
['id']] = $this->Acl->check($p, $controller . '/'. $action, '*');

}

}

Configure::write( 'debug', $inidbg);
$this->set('actlist', $controllerList);
$this->set('data', $data);

}


VIEW:





Controller Action





 $actions): ?>







link('Allow all', 
'/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/allow', array('update' =>
'updacl')); ?>
link( 'Deny all', '/roles/adjustperm/'.
$val['Role']['id'].'/'.$controller.'/all/deny', array('update' =>
'updacl')); ?>






 $perm): ?>



 $val): ?>

link('deny?', '/roles/
adjustperm/'.$key.'/'.$controller.'/'.$action.'/deny', array('update'
=> 'updacl')) :
  'denied '.$ajax->link('allow?', 
'/roles/adjustperm/'.$key.'/'.
$controller.'/'.$action.'/allow', array('update' => 'updacl')); ?>















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