Re: Headers Problem

2008-05-19 Thread Filip Camerman

Hi,

That error occurs if you try to set a http header after you've already
outputted some html. The code at  [CORE/cake/libs/controller/
controller.php, line 546] is called when you do a redirect, so I'm
guessing that you have done a $this-redirect somewhere after you've
outputted something. Is that possible?


--~--~-~--~~~---~--~~
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 search entries help

2008-05-19 Thread David Christopher Zentgraf

Well, nothing's being deleted in those queries, only SELECTed.
Of the top of my head I'd say there are two possibilities:

1) Some really weird problem with your database engine that causes it  
to forget selected data. *
2) There's some logic in your application that deletes entries which  
is accidentally triggered.
*unlikely

What you usually do to select related model data is just this:
- You define your two models very simply, as in 
http://book.cakephp.org/view/66/models#introduction-67
- You set up associations between your two models as in 
http://book.cakephp.org/view/66/models#associations-78
- In your controller you do something like $this-User-find(), which  
returns an array like:

Array
(
 [User] = Array
 (
 ...
 )
 [Conversation] = Array
 (
 ...
 )
)

If you want to search for a specific entry in Conversation you'd do  
something like this:
$this-User-Conversation-find(array('topic' = 'How to bake  
cookies'));

If your code is anymore complicated than that you're probably not  
doing it right.
If you paste some more of your code (relevant controller actions,  
model definitions etc.) into the bin (http://bin.cakephp.org/) we  
might be able to tell where the problem is.

On 19 May 2008, at 16:35, oana wrote:


 These are the queries related concerning users, conversations, and the
 join table.

 If it isn't too much trouble, maybe you can point me to a complete
 piece of code  for the users cotroller, to select a certain user's
 conversations. Because i have tried several, and i think this is my
 problem.

 Thanks for helping,
 Oana

 SELECT `Conversation`.`id`, `Conversation`.`availability`,
 `Conversation`.`created`, `Conversation`.`modified`,
 `Conversation`.`description`, `Conversation`.`title`,
 `Conversation`.`postscount`, `Conversation`.`ideascount`,
 `ConversationsUser`.`conversation_id`, `ConversationsUser`.`user_id`
 FROM `conversations` AS `Conversation` JOIN `conversations_users` AS
 `ConversationsUser` ON (`ConversationsUser`.`user_id` IN (1) AND
 `ConversationsUser`.`conversation_id` = `Conversation`.`id`)

 SELECT COUNT(*) AS `count` FROM `conversations_users` AS
 `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
 (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
 JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
 `User`.`id`) WHERE `User`.`id` = 1

 SELECT `ConversationsUser`.`conversation_id`,
 `ConversationsUser`.`user_id`, `Conversation`.`id`,
 `Conversation`.`availability`, `Conversation`.`created`,
 `Conversation`.`modified`, `Conversation`.`description`,
 `Conversation`.`title`, `Conversation`.`postscount`,
 `Conversation`.`ideascount`, `User`.`id`, `User`.`username`,
 `User`.`email`, `User`.`password`, `User`.`group`,
 `User`.`first_name`, `User`.`last_name` FROM `conversations_users` AS
 `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
 (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
 JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
 `User`.`id`) WHERE `User`.`id` = 1 LIMIT 20

 On May 18, 11:53 am, David Christopher Zentgraf [EMAIL PROTECTED]
 wrote:
 Can you post the SQL queries generated by Cake?
 Sounds really weird.

 On 18 May 2008, at 16:04, oana wrote:



 Hi Keith,

 Your summary is very accurate, that is exactly what's happening.

 This is how i select the conversations for an user, in the user
 controller:

 $this-set('conversations',$this-paginate('ConversationsUser',
 array('User.id' = $userId)));

 Thank you for replying.

 On May 18, 6:48 am, Keith [EMAIL PROTECTED] wrote:
 Hi Oana,

 Can you post some code?

 What do you mean by extract?

 It sounds like you've got your HABTM working properly, but when you
 try to create a view that shows conversations for a specific user  
 the
 join table rows associated with that user are deleted.  Is this an
 accurate summary of your problem?

 On May 17, 4:34 am, oana [EMAIL PROTECTED] wrote:

 I know it has been posted a lor about this topic...but i can't
 figure
 it out. Maybe someone with some experience in cake may help me,
 because i am a newbie.

 I have 2 classes, Users and Conversations, between them it's habtm
 relationship, and i have the join table ConversationsUser.

 In the Users controller i have a function which extracts all the
 conversations of an user give by it's id. Whenever i try to do  
 this,
 the fields in the join table are deleted.

 Can anyone please help me? I didn't post this right away, i  
 tried a
 lot to make it work, but i think it's something big i am missing.

 Thanks,
 Oana
 


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

Re: Custom SQL queries, binding and organizing results

2008-05-19 Thread Filip Camerman

I don't think and wouldn't expect Cake to have any functionality to do
that; when you're rolling your own queries you've got to live with the
flat result. If you sort your query right (e.g. by user) then it
should be easy to rearrange the result in a hierarchical structure
though.

--~--~-~--~~~---~--~~
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: UNION CakePHP/MySQL

2008-05-19 Thread grigri

 One thing, though. The $order ('duedate ASC') shouldn't be necessary,
 as you're selecting on just a single date.

Well spotted! That's very true - it's a bit like saying pick all the
blue MMs and arrange them by colour. I wasn't paying attention to
that bit...
--~--~-~--~~~---~--~~
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: Submitting an ajax form using a drop down list

2008-05-19 Thread Dovdimus Prime

Hi Francky

I have tried your code but I am getting a javascript error
(protoculous, line 2 apparently, which is paragraphs long).

My select's onchange event is set to the following variable:

$updateJavascript = $ajax-remoteFunction(array('url' = '/prompts/
test', 'update' = 'divJobs', 'with' = 'Form.serialize()'));

Where 'prompts' is the controller, 'test' is the action, and 'divJobs'
is the div to update.

Firebug, (Firefox's developer toolbar), is giving me the following
error information, but it means nothing to me:

$(c) has no properties
emptyFunction(undefined)protoculous.js (line 2)
emptyFunction(undefined, undefined)protoculous.js (line 2)
onchange(change )

Any ideas at all? Because I'm totally stumped...

Thanks

David
--~--~-~--~~~---~--~~
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: Submitting an ajax form using a drop down list

2008-05-19 Thread Dovdimus Prime

Apparently you need to specify an argument for Form.serialize:

$updateJavascript = $ajax-remoteFunction(array('url' = '/prompts/
test', 'update' = 'divJobs', 'with' = 'Form.serialize(this.form)'));
--~--~-~--~~~---~--~~
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: Reusing controller code for multiple instances of the same application

2008-05-19 Thread Bruce

Thanks Joathan,
I had tried that, and have tried it again today. I even went to the
extent of commenting out all other routes - it still behaves the same
way. Is it possibly a caching issue - I am suspicuius because the
controler path works even without a routing!




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



Re: Is migrations support planned for Cake?

2008-05-19 Thread joelmoss

Well guys, I really found your comments very interesting, and both of
you raised valid points.t I don't think I will comment on the Schema
vs Migrations debate too much, other than to say that Cake's Schema
shell is different to Migrations, but they are still there to achieve
the same purpose; which is to manage your database. And when managing
something, the tool being used needs to be as flexible and as powerful
as possible. At the moment, Schema is very limited as to what it can
do.

Keith really nailed all the points on the head, better than I ever
could. In fact Keith, would you mind if I used your comments as part
of a blog post on http://developingwithstyle.com?

 FWIW - Will use this when it has no pear dependency and does not use yaml

Well, you will be happy to know that the next version of Migrations
will support PHP arrays in migrations files, as well as YAML. So you
will have the choice. Also, MDB2 is being dumped in favour of a
DataDict (http://phplens.com/lens/adodb/docs-datadict.htm) which does
not rely on PEAR, and is much smaller.


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



Auth Allow Problem

2008-05-19 Thread Crazy

I just started looking into the auth component, I don't need ACL's or
anything, all I need is simple authentication and a small form where
someone can make an account.

Everything works fine, I can log in etc, that is untill I use the
$this-Auth-allow('*'); or $this-Auth-allow(login,
register); to have access to /users/register

Once I use this I can't seem to log in anymore.
The code I am using can be found here:
http://bin.cakephp.org/view/472528663

I am probably missing something very stupid

All help is appreciated

Crazy

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



Re: Routing for plugins: good idea, no implementation

2008-05-19 Thread [EMAIL PROTECTED]


I believe you could try a requestAction() as an example of a situation
where two controllers are loaded at the same time.


On May 17, 1:17 am, Sake [EMAIL PROTECTED] wrote:
 How do the controller names create conflict? If, as an example, I
 have /app/controllers/orders_controller.php and /app/plugins/pizza/
 controllers/orders_controller.php, I can only access one with site.com/
 APP/orders/ and the other with site.com/APP/pizza/orders/. Both of
 them are loaded properly by cakePHP without problems, so why the fear
 of conflicting class names if they exist in different contexts?

 On May 12, 12:05 pm, Jonathan Snook [EMAIL PROTECTED]
 wrote:

    I'll go with your suggestion for now and also do a little poking
    around in the router to see if I can make sense of it.

  Oh, were you hoping for something automatic such that everyplugin
  request would automatically look for a controller with thepluginname
  attached? (in obvious hopes to avoid class name clashes.) That's an
  interesting thought and maybe one that should be presented to the core
  devs to consider (if it isn't already in the core, which I don't think
  it is).
--~--~-~--~~~---~--~~
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 not working with safari

2008-05-19 Thread [EMAIL PROTECTED]

my ajax is not working with safari, if there is 5 to 10 data element
in array than it works fine and if i fetch more data from
database(more than 10 rows)
than the safari browser shows nothing
wat should i do
thanx 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: Is migrations support planned for Cake?

2008-05-19 Thread Dr. Tarique Sani
On Mon, May 19, 2008 at 2:08 PM, joelmoss [EMAIL PROTECTED] wrote:

  FWIW - Will use this when it has no pear dependency and does not use yaml

 Well, you will be happy to know that the next version of Migrations
 will support PHP arrays in migrations files, as well as YAML. So you
 will have the choice. Also, MDB2 is being dumped in favour of a
 DataDict (http://phplens.com/lens/adodb/docs-datadict.htm) which does
 not rely on PEAR, and is much smaller.



Hurrah for you!

But is using DataDict needed? That more or less ensures that we will never
see your migrations in CakePHP core

Having something more native cake will be better - take a look at the Schema
code lots of stuff which you can use.


HTH

Tarique

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
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: Validation on fields not in model (1.2)

2008-05-19 Thread [EMAIL PROTECTED]

Here's the way that worked for me:

In your register() function replace the setFlash with

$this-User-invalidate('captcha','Incorrect captcha code entered');

Then in your view add

?php echo $form-error('User.captcha');

Remember to do a $this-render(); if you catch an error...

Hope that helps.

PS - this is my first post to this group, so please be gentle if there
is a better way of doing this!

On May 18, 2:43 am, Mike52 [EMAIL PROTECTED] wrote:
 I have a problem setting the error text on a form field that is not
 associated with the model.

 This is my situation:
 I have a registration form that allows a user to submit his email
 address. This form contains an input field for a captcha. The captcha
 text is not part of the model. And nor should it be, in my option, as
 it is controller logic.

 The controller validates the value of the captcha field. Currently, my
 controller action looks like this:

   function register() {
     if (!empty($this-data)) {
       if ($this-data['User']['captcha'] != $_SESSION['captcha']) {
         $this-Session-setFlash('Incorrect captcha code entered');
         $this-data['User']['captcha'] = '';
         return;
       }

 This works, but it does not display an appropriate error text near the
 captcha field.
 How can I set the error message/status on this field?

 Thanks,
 Mike

--~--~-~--~~~---~--~~
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: russian characters in MySQL table

2008-05-19 Thread Dmitry

Sorry, Piotr, it is not. UTF8 (without -) does not solve the
problem.

3lancer.eu:
 Hi,
 Should be rather 'encoding' = 'utf8'.
 Does this solve the problem?

 All the best,
 Piotr

--~--~-~--~~~---~--~~
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: model behaves mysteriously

2008-05-19 Thread Benni Graf

Hi there!

Indeed, deleting the cached models resolved the problem. Great,
thanks!

But still I don't know, why the models got cached. I didn't activate
caching anytime (btw., is this the caching-option I can activate in
the core-config?). Or is this kind of caching activated by default?

Thanks, Benni.

--~--~-~--~~~---~--~~
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: Rendering an element from controller how to give params?

2008-05-19 Thread UGn

hi,

That's indeed a possibility, i just figured out myself too.
I now have a AJAX call to a controller, which displays a view
without a layout in which the element is rendered.
I thought this had to be easier to do, because the view is almost
empty and i have to manually turn the layout off.

is there really no shorter way?



On 18 mei, 17:30, aranworld [EMAIL PROTECTED] wrote:
 I'm not sure why you would need to render an element from within a
 controller?  As far as I know this is not the intended purpose of
 elements.

 If this is a controller method called via AJAX then I believe you
 should be rendering a view.

 In the view file, you then include the element you want to render.

 On May 18, 3:52 am, UGn [EMAIL PROTECTED] wrote:

  Hi there,

  I'm really stuck on a (i guess it's a simple) thing and i would really
  appreciate
  someone helping me with it..

  The problem is:

  I have an element which renders the first productimage belonging to a
  product and the navigation to the next images (with AJAX links).
  To update this element i need some params (photo_data, new photo_id,
  and product_id (for navigation)).

  But from my controller i cannot use renderElement so i use:

   $this-render(null,'ajax',DS.'elements'.DS.'productimage_view');

  so how can i get my params with this render?

  thnx in advance,

  UGn

--~--~-~--~~~---~--~~
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: russian characters in MySQL table

2008-05-19 Thread 3lancer.eu

Hi,

 I think, yes. I hame more than 1 database on my local MySQL server and
 some of them are utf-8 too. There are no such thingth with them, all
 of them displayed Ok everywhere - in PHPMyAdmin and client app. For
 example, I have some deal with Joomla! - it's PHP+MySQL -based CMS.
 For it everything work fine. That's why I decided that the matter is
 Cake.

Just remember, that by mysql UTF-8 is called utf8 (without hyphen).

Piotr

--~--~-~--~~~---~--~~
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: russian characters in MySQL table

2008-05-19 Thread Dmitry

Sorry,  Piotr, it is not. Both utf8 and utf-8 have no effect

On 18 май, 03:26, 3lancer.eu [EMAIL PROTECTED] wrote:
 Hi,

 Should be rather 'encoding' = 'utf8'.
 Does this solve the problem?

 All the best,
 Piotr

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



SQL Error: 2014

2008-05-19 Thread Ma'moon
Hello guys,
i have a problem where i am trying to execute the following queries in my
controller consequently!:
$mostWatched = $this-Video-query('CALL SP_getMostViewedVideos(1,3)');
$mostRated = $this-Video-query('CALL SP_getMostRatedVideos(1,3)');
$resentAdded  = $this-Video-query('CALL SP_getMostRecentVideos(1,3)');
and it results to *SQL Error: 2014: Commands out of sync; you can't run
this command now in cake/libs/model/datasources/dbo_source.php on line 440*

i would really appreciate it if any one can tell me why this is happening
and how to solve it!

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



Re: Custom SQL queries, binding and organizing results

2008-05-19 Thread David Christopher Zentgraf

I see, thanks!

I played around with finderQueries a bit more and got them to work to  
some extend, but not perfectly.
Depending on which model I'm querying from, Cake throws away part of  
the results I'd like to keep, as it doesn't seem to think the result  
is related enough to the querying model.

Is there a recommended/best way to implement custom queries?
I'd hate to do it in the controller, so I was thinking about defining  
a bunch of custom Model functions and using raw SQL which I'll have to  
sort through. How does that work with table prefixes, for example?  
Will Cake still prefix my tables or how would I take care of that  
myself?

Chrs,
Dav

On 19 May 2008, at 17:13, Filip Camerman wrote:


 I don't think and wouldn't expect Cake to have any functionality to do
 that; when you're rolling your own queries you've got to live with the
 flat result. If you sort your query right (e.g. by user) then it
 should be easy to rearrange the result in a hierarchical structure
 though.

 


--~--~-~--~~~---~--~~
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 migrations support planned for Cake?

2008-05-19 Thread the_woodsman

 Cake currently has a migrations-like schema shell, but it only allows
 you to create tables. You cannot make changes to existing tables, and
 cannot roll back your changes.

Joel, from looking at the blog post mentioned here (http://cakebaker.
42dh.com/2008/04/13/migrations-the-cakephp-way/), you can make changes
to existing tables
./cake schema run update ... .

If I get the jist right, the only thing lacking for these Schema
things to support RoR style migrations is:
- rollback (which seems partly implemented in the test suite, i.e
tables get dropped)
- logic to determine if updates or creates need to be performed (can't
be too difficult, as it appears tables are already diffed by the
update logic)

Surely these are so close it'd be better to extend these to meet the
needs of Migrations, rather than have something completely seperate?






On May 19, 10:14 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On Mon, May 19, 2008 at 2:08 PM, joelmoss [EMAIL PROTECTED] wrote:
   FWIW - Will use this when it has no pear dependency and does not use yaml

  Well, you will be happy to know that the next version of Migrations
  will support PHP arrays in migrations files, as well as YAML. So you
  will have the choice. Also, MDB2 is being dumped in favour of a
  DataDict (http://phplens.com/lens/adodb/docs-datadict.htm) which does
  not rely on PEAR, and is much smaller.

 Hurrah for you!

 But is using DataDict needed? That more or less ensures that we will never
 see your migrations in CakePHP core

 Having something more native cake will be better - take a look at the Schema
 code lots of stuff which you can use.

 HTH

 Tarique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.com
 =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
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 SQL queries, binding and organizing results

2008-05-19 Thread the_woodsman

Sorry, I don't understand - the output you posted

Array
(
 [0] = Array
 (
 [Transaction] = Array (...)
 [Intermediator] = Array (...)
 [Account] = Array (...)
 [User] = Array (...)
 )

 [1] = Array ...
)

Has been modified from a normal mysql query result... in what way is
this a flat array?
What output are you trying to achieve?




On May 19, 11:39 am, David Christopher Zentgraf [EMAIL PROTECTED]
wrote:
 I see, thanks!

 I played around with finderQueries a bit more and got them to work to
 some extend, but not perfectly.
 Depending on which model I'm querying from, Cake throws away part of
 the results I'd like to keep, as it doesn't seem to think the result
 is related enough to the querying model.

 Is there a recommended/best way to implement custom queries?
 I'd hate to do it in the controller, so I was thinking about defining
 a bunch of custom Model functions and using raw SQL which I'll have to
 sort through. How does that work with table prefixes, for example?
 Will Cake still prefix my tables or how would I take care of that
 myself?

 Chrs,
 Dav

 On 19 May 2008, at 17:13, Filip Camerman wrote:



  I don't think and wouldn't expect Cake to have any functionality to do
  that; when you're rolling your own queries you've got to live with the
  flat result. If you sort your query right (e.g. by user) then it
  should be easy to rearrange the result in a hierarchical structure
  though.
--~--~-~--~~~---~--~~
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: model behaves mysteriously

2008-05-19 Thread the_woodsman

Model meta data (schema) is cached automatically, so that Cake doesn't
have to run a describe query on every table all the time.

I believe this is periodically refreshed even in production mode
(don't quote me on that), but when you need to update something in
production mode, you're best to manually delete the cache files-
although I believe you can clear the cache via PHP method calls too.



On May 18, 7:55 pm, Benni Graf [EMAIL PROTECTED] wrote:
 Hi there!

 Indeed, deleting the cached models resolved the problem. Great,
 thanks!

 But still I don't know, why the models got cached. I didn't activate
 caching anytime (btw., is this the caching-option I can activate in
 the core-config?). Or is this kind of caching activated by default?

 Thanks, Benni.
--~--~-~--~~~---~--~~
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 SQL queries, binding and organizing results

2008-05-19 Thread David Christopher Zentgraf

Sorry for being a bit short there. :-)

I think I get this kind of array when using finderQueries.
Cake seems to organize the data to a certain extend, but not quite  
right.
What I need would be:

Array
(
[0] = Array
(
[Transaction] = Array
(
[id] .
[Intermediator] = Array
(
[0] = Array
(
[id] 


[Account] = Array
)
)
)
)
)

And so on.
The models are all chained, not all belonging to one model.
So that's flatter than I need.


On 19 May 2008, at 20:15, the_woodsman wrote:


 Sorry, I don't understand - the output you posted

 Array
 (
 [0] = Array
 (
 [Transaction] = Array (...)
 [Intermediator] = Array (...)
 [Account] = Array (...)
 [User] = Array (...)
 )

 [1] = Array ...
 )

 Has been modified from a normal mysql query result... in what way is
 this a flat array?
 What output are you trying to achieve?




 On May 19, 11:39 am, David Christopher Zentgraf [EMAIL PROTECTED]
 wrote:
 I see, thanks!

 I played around with finderQueries a bit more and got them to work to
 some extend, but not perfectly.
 Depending on which model I'm querying from, Cake throws away part of
 the results I'd like to keep, as it doesn't seem to think the result
 is related enough to the querying model.

 Is there a recommended/best way to implement custom queries?
 I'd hate to do it in the controller, so I was thinking about defining
 a bunch of custom Model functions and using raw SQL which I'll have  
 to
 sort through. How does that work with table prefixes, for example?
 Will Cake still prefix my tables or how would I take care of that
 myself?

 Chrs,
 Dav

 On 19 May 2008, at 17:13, Filip Camerman wrote:



 I don't think and wouldn't expect Cake to have any functionality  
 to do
 that; when you're rolling your own queries you've got to live with  
 the
 flat result. If you sort your query right (e.g. by user) then it
 should be easy to rearrange the result in a hierarchical structure
 though.
 


--~--~-~--~~~---~--~~
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 migrations support planned for Cake?

2008-05-19 Thread Dardo Sordi Bogado

 Dardo can you elaborate on why schemas are better than migrations in
 iterative development?

I will try.

 Just to address some issues here:

 1.  Migrations as Patches - Migrations CAN be patches.  Migrations
 are not patches though.  For example, in Joel's system you can most
 certainly create a migration supporting a model that is complete.  In
 many cases models won't need tweaks, but in some cases, particularly
 in multi-developer environments, having the ability to create patches
 is critical.

Yes, and Cake Schemas are extremely useful in that multi developer
iterative environment you mention.

 2.  Migrations are incomplete - Migrations CAN be incomplete, but when
 migrations are run in sequence they are as complete as a Schema.

Migrations can be derivated from two schemas (previous-next), and that
is exactly what cake schema shell does. It compares the schema.php to
the database schema and let you any.

 Git allows you to keep a local copy of the SCM in which you can create
 your own revisions and then sync it later.  Many developers, in fact I
 would suggest most, do not use Git yet.  I would argue that the
 majority of folks are on some flavor of SVN or CVS.  In these cases
 there is no local revision only the revision you have to commit.

Yes, but not quite relevant. I was comparing the philosophy of storing
a sequence of deltas to storing the full state every time (which I
think is best).

 Let me propose the counter-argument to why migrations are superior to
 Schema.  I think this is a debate that could be endless, but in terms
 of commonly accepted practice in interative agile development there
 are many more proponents of the migration model than the Schema model.

Is that an ad hominem argument?


 1.  Migrations are iterative.

 When you're developing it is useful to back out model changes if they
 do not work.  With Schema, you're working directly with the SQL which
 is not necessarily database agnostic.  Once you back out that change
 you have no way to return to any other state unless you check out a
 file from your SCM.

In my proposed workflow, you change the database with the tool that
you like the most, and then update the schema file using the cake
shell.

 In this way your iterative development model is supported step-by-step
 with your migrations.  You can track and move your application to any
 state you need without needing to check out full blown schemas.

I don't see the problem in having to checking out full blown
schemas, but again why you want a version of the database different
from what your application expects? Well there are some cases, while
testing a setup for example but that is an edge case.

 2.  Migrations are multi-developer friendly.

 Migrations are iterative, so one developer's work will not overwrite
 another developer's work.  In the Schema model you've got multiple
 developers committing their latest schema and relying on the SCM to
 stitch the changes into the proper order.  Migrations also quickly
 allow developers to review specific database changes without needing
 to review a single large file and finding the changes.

Nope, migrations aren't multi developer friendly. What happens if two
developers doing work in parallel do conflicting changes to the
database?

In the schema model, that situation is detected by the scm (during the
merge) and human is forced to solve the conflict.

In the migration model, where their are in different files, the
conflict goes unnoticed.

 3.  Migrations allow easier rollout

 Let's say you need to roll out a single feature.  In a migration you
 just rollout that migration on your production environment with your
 code deploy and you're set.  In a Schema environemnt you need to
 backup your database, rollout the new schema, restore the data and
 you're good to go.  While database backups should be a part of any
 production environment rollout, having to backup / restore for even
 minor database changes can be tiresome particularly when you're just
 trying to fix a single bug in a production application.

You are talking about a SQL dump and I'm talking about cake schemas.

 4.  Migrations have a reputable body or work behind them:

 http://www.oracle.com/technology/pub/articles/kern-rails-migrations.html
 http://www.oreillynet.com/pub/a/ruby/2007/05/17/cookin-with-ruby-on-rails---may.html
 http://www.ibm.com/developerworks/web/library/j-cb08156.html

Another ad hominem argument? Well behind cake schemas is cake core team.

 While I think there are many ways to handle database schemas, the
 migration model is currently the best of breed model on the market.
 If multi-developer iterative design is the new model for application
 development then there is no reason to avoid migrations.

Have you tried to use and understand cake schema?

  Joel's work
 has been ongoing and his latest efforts are most definitely worth a
 look.  His migration model should make it into Cake 2.0 if not sooner
 because of the value it adds 

Re: Is migrations support planned for Cake?

2008-05-19 Thread Dardo Sordi Bogado

 The cake Schemas are far better than migrations, because they are a
 different concept.

 If I agree that the concept is different then you have wasted time in
 comparing apples to oranges

As they are different approaches to solve the same problem I can compare them.

 Migrations *don't have to be* written in YAML - this is one of the prime
 things which I don't like with Joel's implementation.

I know, but, can you tell me in what language they are easy to write
and look pretty? Post an example please.

Regards,
- Dardo Sordi.

 Other than that I agree with what Keith has written.

 Cheers
 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: Reusing controller code for multiple instances of the same application

2008-05-19 Thread Jonathan Snook

If it works without the routing, I wonder if you're even editing the
right files! (I do that sometimes where I edit the files for a local
project but I'm still viewing the live version.)

On Mon, May 19, 2008 at 4:37 AM, Bruce [EMAIL PROTECTED] wrote:

 Thanks Joathan,
 I had tried that, and have tried it again today. I even went to the
 extent of commenting out all other routes - it still behaves the same
 way. Is it possibly a caching issue - I am suspicuius because the
 controler path works even without a routing!

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



Re: HABTM search entries help

2008-05-19 Thread oana

I wrote almost everything again, because it was getting too messy, and
now it works. (though the changes i've made don't concern any logic
that may delete entries)

Thank you very much for helping.

On May 19, 11:09 am, David Christopher Zentgraf [EMAIL PROTECTED]
wrote:
 Well, nothing's being deleted in those queries, only SELECTed.
 Of the top of my head I'd say there are two possibilities:

 1) Some really weird problem with your database engine that causes it
 to forget selected data. *
 2) There's some logic in your application that deletes entries which
 is accidentally triggered.
 *unlikely

 What you usually do to select related model data is just this:
 - You define your two models very simply, as 
 inhttp://book.cakephp.org/view/66/models#introduction-67
 - You set up associations between your two models as 
 inhttp://book.cakephp.org/view/66/models#associations-78
 - In your controller you do something like $this-User-find(), which
 returns an array like:

 Array
 (
  [User] = Array
  (
  ...
  )
  [Conversation] = Array
  (
  ...
  )
 )

 If you want to search for a specific entry in Conversation you'd do
 something like this:
 $this-User-Conversation-find(array('topic' = 'How to bake
 cookies'));

 If your code is anymore complicated than that you're probably not
 doing it right.
 If you paste some more of your code (relevant controller actions,
 model definitions etc.) into the bin (http://bin.cakephp.org/) we
 might be able to tell where the problem is.

 On 19 May 2008, at 16:35, oana wrote:



  These are the queries related concerning users, conversations, and the
  join table.

  If it isn't too much trouble, maybe you can point me to a complete
  piece of code  for the users cotroller, to select a certain user's
  conversations. Because i have tried several, and i think this is my
  problem.

  Thanks for helping,
  Oana

  SELECT `Conversation`.`id`, `Conversation`.`availability`,
  `Conversation`.`created`, `Conversation`.`modified`,
  `Conversation`.`description`, `Conversation`.`title`,
  `Conversation`.`postscount`, `Conversation`.`ideascount`,
  `ConversationsUser`.`conversation_id`, `ConversationsUser`.`user_id`
  FROM `conversations` AS `Conversation` JOIN `conversations_users` AS
  `ConversationsUser` ON (`ConversationsUser`.`user_id` IN (1) AND
  `ConversationsUser`.`conversation_id` = `Conversation`.`id`)

  SELECT COUNT(*) AS `count` FROM `conversations_users` AS
  `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
  (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
  JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
  `User`.`id`) WHERE `User`.`id` = 1

  SELECT `ConversationsUser`.`conversation_id`,
  `ConversationsUser`.`user_id`, `Conversation`.`id`,
  `Conversation`.`availability`, `Conversation`.`created`,
  `Conversation`.`modified`, `Conversation`.`description`,
  `Conversation`.`title`, `Conversation`.`postscount`,
  `Conversation`.`ideascount`, `User`.`id`, `User`.`username`,
  `User`.`email`, `User`.`password`, `User`.`group`,
  `User`.`first_name`, `User`.`last_name` FROM `conversations_users` AS
  `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
  (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
  JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
  `User`.`id`) WHERE `User`.`id` = 1 LIMIT 20

  On May 18, 11:53 am, David Christopher Zentgraf [EMAIL PROTECTED]
  wrote:
  Can you post the SQL queries generated by Cake?
  Sounds really weird.

  On 18 May 2008, at 16:04, oana wrote:

  Hi Keith,

  Your summary is very accurate, that is exactly what's happening.

  This is how i select the conversations for an user, in the user
  controller:

  $this-set('conversations',$this-paginate('ConversationsUser',
  array('User.id' = $userId)));

  Thank you for replying.

  On May 18, 6:48 am, Keith [EMAIL PROTECTED] wrote:
  Hi Oana,

  Can you post some code?

  What do you mean by extract?

  It sounds like you've got your HABTM working properly, but when you
  try to create a view that shows conversations for a specific user
  the
  join table rows associated with that user are deleted.  Is this an
  accurate summary of your problem?

  On May 17, 4:34 am, oana [EMAIL PROTECTED] wrote:

  I know it has been posted a lor about this topic...but i can't
  figure
  it out. Maybe someone with some experience in cake may help me,
  because i am a newbie.

  I have 2 classes, Users and Conversations, between them it's habtm
  relationship, and i have the join table ConversationsUser.

  In the Users controller i have a function which extracts all the
  conversations of an user give by it's id. Whenever i try to do
  this,
  the fields in the join table are deleted.

  Can anyone please help me? I didn't post this right away, i
  tried a
  lot to make it work, but i think it's something big i am missing.

  Thanks,
  Oana

undefined variable problem $form

2008-05-19 Thread vishal




Hi All,

  I am new user on this community.I am not an expert in
cake.so please help me in this issue.



undefined variable $form



 This is my add.ctp file :

h1Add User/h1


?php
 echo $form-create('User');?
echo  $form-input('name');
echo $form-input('address', array('rows' = '3'));
echo $form-input('phone');
echo $form-input('mobile');
echo $form-input('email');
echo $form-input('city');
echo $form-input('state');
echo $form-input('image',array('type' = 'file'));
echo $form-end('Save User');
?



This is the controller file:


?php
class UsersController extends AppController {

var $name = 'Users';
var $layout='user';
//var $layout='edit';

/* var $validate = array(

  'name' = VALID_NOT_EMPTY,
  'address' = VALID_NOT_EMPTY,
   'phone' = VALID_NUMBER,
   'mobile' = VALID_NUMBER,
  'email' = VALID_EMAIL,
  'city' = VALID_NOT_EMPTY,
   'state' = VALID_NOT_EMPTY,
   'image' = VALID_NOT_EMPTY,
  'born' = VALID_NUMBER
   );

*/
var $validate = array(
'name' = array(
'rule' = array('minLength', 1),
'message' = 'please enter the name'
),
'address' = array(
'rule' = array('minLength', 1)
)
);

var $paginate = array(
'limit' = 4,
'order' = array(
'User.name' = 'asc'
)
);


function index() {
//$this-set('users', $this-User-find('all'));
//$data = $this-paginate('User');
  //$this-set(compact('data'));

$this-set('users', $this-User-findAll());

}

function view($id) {
$this-User-id = $id;
$this-set('user', $this-User-read());

}

function delete($id) {
$this-User-del($id);
$this-flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

function add() {
if (!empty($this-data)) {
if ($this-User-save($this-data)) {
$this-flash('Your detail has been saved.','/users/
index');
}

}
}

function edit($id = null) {
$this-User-id = $id;
if (empty($this-data)) {
$this-data = $this-User-read();
} else {
if ($this-User-save($this-data['User'])) {
$this-flash('Your detail has been updated.','http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
}

}
?



when i execute /users/addThis gives me an error :

undefined variable $from. I don't know why this error occurs.same case
occurs in editing .



Is there any other way to create a form





Thanks, in advance 



Vishal

--~--~-~--~~~---~--~~
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: PostgreSQL Update Query and the trouble with aliases

2008-05-19 Thread Jordão

Hi,
   The problem is on SET statement... I've tested with postgresql 8.2
and 8.3.
Both worked with alias, but that only for WHERE statement, as follows:
UPDATE schema1.table1 AS P
SET id='1', field2=now()
WHERE P.id in ('1')

The problem is postgresql doesn't accept SET P.id sintax.


On 7 abr, 14:38, cguyer [EMAIL PROTECTED] wrote:
 and yet this error is still around even with the latest branch? has it
 been broken again?

 On Feb 15, 12:23 pm, nate [EMAIL PROTECTED] wrote:

  Please do everyone else a favor and search around a little bit next
  time.  This bug has already been reported a zillion times, and was
  fixed weeks ago.

  On Jan 21, 8:58 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

   I'm having trouble makingUPDATEqueries in PostgreSQL. I know that
   there is a known issue aboutPostgresnot supporting aliases inUPDATE
   queries. Anyway, my problem is that when I try to create new Aro like
   this:

                   $parent = $this-Acl-Aro-findByAlias('SuperUser');
                   $parentId = $parent['Aro']['id'];

                   $this-Acl-Aro-create();
                   $this-Acl-Aro-save(array(
                           'foreign_key' = null,
                           'parent_id' = $parentId,
                           'alias' = 'User:30'));

   I get the followingerror:

   Warning (2): pg_query() [function.pg-query]: Query failed:ERROR:
   column Aro of relation aros does not exist
   LINE 1:UPDATEaros AS Aro  SET Aro.lft = Aro.lft + 2
   W...
                                       ^ [CORE\cake\libs\model\datasources
   \dbo\dbo_postgres.php, line 123]
   $sql    =       UPDATEaros AS Aro  SET Aro.lft = Aro.lft + 2
   WHERE Aro.lft =  '2'

   I've already posted a bug to trac.cakephp.org... the reason for this
   message is that I would like to ask everybody for help on creating
   some quick solution or patch for this problem.

   P.S. This problem with aliases isn't just a one time thing, it is and
   will be happening until cakephp developers move the method
   renderStatement from dbo_source.php to each dbo file. It should work
   as it is, but it doesn't, they should all follow SQL standards but
   they don't. So, my suggestion is to make renderStatement in every dbo.

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



setting path in app/webroot/index.php

2008-05-19 Thread vishal

Hi All,
  I am New user on this community..can any body help me
please !

I have problem in setting the path in app/webrot/index.php


My cake is installed in:

X:\small_projects\vishal

if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

if (!defined('ROOT')) {

define('ROOT', '/home/small_projects/vishal/cake_1.1.19.6305');
}
if (!defined('APP_DIR')) {
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION');
define('APP_DIR', 'app');
}

if (!defined('CAKE_CORE_INCLUDE_PATH')) {

define('CAKE_CORE_INCLUDE_PATH', '/home/small_projects/vishal/
cake_1.1.19.6305/');
   }




where X:/ drives in my local server 192.168.0.60

so please set my path accordingly..if possible.  please check  edit
where i am wrong..
I am very confuse regarding that.


Thanks in advance..!!!
vishal

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



Unwanted Session variables in on page links

2008-05-19 Thread DieselDirk

Hi

We've got a specific host we need to use and for some reason our
friendly URLs get abominated with an ugly session type variable
www.mysite.com/menu-link-page/?CAKEPHP=a7942ddb199e66f3eb4bcbd4980f19f3.
I'm not the developer, but I'm trying to assist in finding the
solution for this problem as we've got it on two sites that are
sitting on this server. Changing hosts is not an option for us at this
stage, but the hosting company is willing to help if it's a server
problem. Any ideas? We're using the latest stable release (I think).

Regards
Diesel

--~--~-~--~~~---~--~~
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: Headers Problem

2008-05-19 Thread Samuel DeVore

I would look in any helpers/component files that you have made and
look for an extra leading or trailing  line feed (return) I have been
bitten by that trailing white space more then once.  Also check your
controllers and models.

That usually fixes it for me.

Sam D

On Mon, May 19, 2008 at 1:00 AM, Filip Camerman [EMAIL PROTECTED] wrote:

 Hi,

 That error occurs if you try to set a http header after you've already
 outputted some html. The code at  [CORE/cake/libs/controller/
 controller.php, line 546] is called when you do a redirect, so I'm
 guessing that you have done a $this-redirect somewhere after you've
 outputted something. Is that possible?


 




-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
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: undefined variable problem $form

2008-05-19 Thread Daniel Hofstetter

Hi Vishal,

you have to add the FormHelper to the $helpers array of your
controller resp. AppController with

var $helpers = array('Form');

See also the section about helpers in the manual: 
http://book.cakephp.org/view/98/helpers

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: undefined variable problem $form

2008-05-19 Thread David Christopher Zentgraf

Hi,

1) $validate goes into the Model, not the controller!
http://book.cakephp.org/view/66/models

2) $form is the Helper, and you'll need to specify in the Controller  
which helpers you want to be able to use in the View.
http://book.cakephp.org/view/98/helpers

Chrs,
Dav

On 19 May 2008, at 21:33, vishal wrote:





 Hi All,

  I am new user on this community.I am not an expert in
 cake.so please help me in this issue.



 undefined variable $form



 This is my add.ctp file :

 h1Add User/h1


 ?php
 echo $form-create('User');?
 echo  $form-input('name');
 echo $form-input('address', array('rows' = '3'));
 echo $form-input('phone');
 echo $form-input('mobile');
 echo $form-input('email');
 echo $form-input('city');
 echo $form-input('state');
 echo $form-input('image',array('type' = 'file'));
 echo $form-end('Save User');
 ?



 This is the controller file:


 ?php
 class UsersController extends AppController {

var $name = 'Users';
var $layout='user';
//var $layout='edit';

/* var $validate = array(

  'name' = VALID_NOT_EMPTY,
  'address' = VALID_NOT_EMPTY,
   'phone' = VALID_NUMBER,
   'mobile' = VALID_NUMBER,
  'email' = VALID_EMAIL,
  'city' = VALID_NOT_EMPTY,
   'state' = VALID_NOT_EMPTY,
   'image' = VALID_NOT_EMPTY,
  'born' = VALID_NUMBER
   );

*/
var $validate = array(
'name' = array(
'rule' = array('minLength', 1),
'message' = 'please enter the name'
),
'address' = array(
'rule' = array('minLength', 1)
)
);

var $paginate = array(
'limit' = 4,
'order' = array(
'User.name' = 'asc'
)
);


function index() {
//$this-set('users', $this-User-find('all'));
//$data = $this-paginate('User');
  //$this-set(compact('data'));

 $this-set('users', $this-User-findAll());

}

function view($id) {
$this-User-id = $id;
$this-set('user', $this-User-read());

}

function delete($id) {
$this-User-del($id);
 $this-flash('The user with id: '.$id.' has been deleted.', 'http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
 }

function add() {
if (!empty($this-data)) {
if ($this-User-save($this-data)) {
$this-flash('Your detail has been saved.','/users/
 index');
}

}
}

function edit($id = null) {
$this-User-id = $id;
if (empty($this-data)) {
$this-data = $this-User-read();
} else {
if ($this-User-save($this-data['User'])) {
$this-flash('Your detail has been updated.','http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
 }

 }
 ?



 when i execute /users/addThis gives me an error :

 undefined variable $from. I don't know why this error occurs.same case
 occurs in editing .



 Is there any other way to create a form





 Thanks, in advance 



 Vishal

 


--~--~-~--~~~---~--~~
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: undefined variable problem $form

2008-05-19 Thread Reza Muhammad

Hi,

I'm also new with CakePHP, but here are some things i noticed:

1. Your validation should be in the model, not controller (app/models/ 
user.php).

2. Your $form cannot be used in the views, because you havwnt used  
'Form' helper in yor controller.
 Use: var $helpers = array('Html', 'Form');

Btw, i preaumed youre using cake 1.2 because 'Form' helper is only  
available in cake 1.2. To use form in cake 1.1, you would normally use:
  $html-input();

Hope that helps.
-Reza Muhammad

On May 19, 2008, at 7:33 PM, vishal [EMAIL PROTECTED] wrote:





 Hi All,

  I am new user on this community.I am not an expert in
 cake.so please help me in this issue.



 undefined variable $form



 This is my add.ctp file :

 h1Add User/h1


 ?php
 echo $form-create('User');?
 echo  $form-input('name');
 echo $form-input('address', array('rows' = '3'));
 echo $form-input('phone');
 echo $form-input('mobile');
 echo $form-input('email');
 echo $form-input('city');
 echo $form-input('state');
 echo $form-input('image',array('type' = 'file'));
 echo $form-end('Save User');
 ?



 This is the controller file:


 ?php
 class UsersController extends AppController {

var $name = 'Users';
var $layout='user';
//var $layout='edit';

/* var $validate = array(

  'name' = VALID_NOT_EMPTY,
  'address' = VALID_NOT_EMPTY,
   'phone' = VALID_NUMBER,
   'mobile' = VALID_NUMBER,
  'email' = VALID_EMAIL,
  'city' = VALID_NOT_EMPTY,
   'state' = VALID_NOT_EMPTY,
   'image' = VALID_NOT_EMPTY,
  'born' = VALID_NUMBER
   );

*/
var $validate = array(
'name' = array(
'rule' = array('minLength', 1),
'message' = 'please enter the name'
),
'address' = array(
'rule' = array('minLength', 1)
)
);

var $paginate = array(
'limit' = 4,
'order' = array(
'User.name' = 'asc'
)
);


function index() {
//$this-set('users', $this-User-find('all'));
//$data = $this-paginate('User');
  //$this-set(compact('data'));

 $this-set('users', $this-User-findAll());

}

function view($id) {
$this-User-id = $id;
$this-set('user', $this-User-read());

}

function delete($id) {
$this-User-del($id);
 $this-flash('The user with id: '.$id.' has been deleted.', 'http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
 }

function add() {
if (!empty($this-data)) {
if ($this-User-save($this-data)) {
$this-flash('Your detail has been saved.','/users/
 index');
}

}
}

function edit($id = null) {
$this-User-id = $id;
if (empty($this-data)) {
$this-data = $this-User-read();
} else {
if ($this-User-save($this-data['User'])) {
$this-flash('Your detail has been updated.','http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
 }

 }
 ?



 when i execute /users/addThis gives me an error :

 undefined variable $from. I don't know why this error occurs.same case
 occurs in editing .



 Is there any other way to create a form





 Thanks, in advance 



 Vishal

 

--~--~-~--~~~---~--~~
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 message in view

2008-05-19 Thread hi zahir

Hello,

i am new in cake. i wan trying the blog example in online manual.

according to manual i created a view called:
/app/views/posts/add.ctp

and added following code:
/app/views/posts/add.ctp

h1Add Post/h1
?php
echo $this-form-create('Post');
print $form-input('title');
print $form-input('body',array('rows'='3'));
print $form-end('Save Post');
?

but when i click 'Add Post' from index view, it shows following
message.

as per document $form object should be available in view. but it seems
to me, it is not. may be i missed something.


/app/views/posts/add.ctp
Add Post

Notice: Undefined property: View::$form in C:\wamp\www\cake\app\views
\posts\add.ctp on line 5

Fatal error: Call to a member function create() on a non-object in C:
\wamp\www\cake\app\views\posts\add.ctp on line 5



could anyone give me any advice please?



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: undefined variable problem $form

2008-05-19 Thread da_student

Try adding  var $helpers = array('Form'); in your controller


On May 19, 2:33 pm, vishal [EMAIL PROTECTED] wrote:
 Hi All,

   I am new user on this community.I am not an expert in
 cake.so please help me in this issue.

 undefined variable $form

  This is my add.ctp file :

 h1Add User/h1

 ?php
  echo $form-create('User');?
 echo  $form-input('name');
 echo $form-input('address', array('rows' = '3'));
 echo $form-input('phone');
 echo $form-input('mobile');
 echo $form-input('email');
 echo $form-input('city');
 echo $form-input('state');
 echo $form-input('image',array('type' = 'file'));
 echo $form-end('Save User');
 ?

 This is the controller file:

 ?php
 class UsersController extends AppController {

 var $name = 'Users';
 var $layout='user';
 //var $layout='edit';

 /* var $validate = array(

   'name' = VALID_NOT_EMPTY,
   'address' = VALID_NOT_EMPTY,
'phone' = VALID_NUMBER,
'mobile' = VALID_NUMBER,
   'email' = VALID_EMAIL,
   'city' = VALID_NOT_EMPTY,
'state' = VALID_NOT_EMPTY,
'image' = VALID_NOT_EMPTY,
   'born' = VALID_NUMBER
);

 */
 var $validate = array(
 'name' = array(
 'rule' = array('minLength', 1),
 'message' = 'please enter the name'
 ),
 'address' = array(
 'rule' = array('minLength', 1)
 )
 );

 var $paginate = array(
 'limit' = 4,
 'order' = array(
 'User.name' = 'asc'
 )
 );

 function index() {
 //$this-set('users', $this-User-find('all'));
 //$data = $this-paginate('User');
   //$this-set(compact('data'));

 $this-set('users', $this-User-findAll());

 }

 function view($id) {
 $this-User-id = $id;
 $this-set('user', $this-User-read());

 }

 function delete($id) {
 $this-User-del($id);
 $this-flash('The user with id: '.$id.' has been deleted.', 'http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');

 }

 function add() {
 if (!empty($this-data)) {
 if ($this-User-save($this-data)) {
 $this-flash('Your detail has been saved.','/users/
 index');
 }

 }
 }

 function edit($id = null) {
 $this-User-id = $id;
 if (empty($this-data)) {
 $this-data = $this-User-read();
 } else {
 if ($this-User-save($this-data['User'])) {
 $this-flash('Your detail has been updated.','http://
 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
 }
 }

 }
 }

 ?

 when i execute /users/addThis gives me an error :

 undefined variable $from. I don't know why this error occurs.same case
 occurs in editing .

 Is there any other way to create a form

 Thanks, in advance 

 Vishal

--~--~-~--~~~---~--~~
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: Setting up Apache Alias to run separate from CakePHP

2008-05-19 Thread BrendonKoz

If you simply want a sub-directory within the same site as your
CakePHP site, use the webroot folder.  Create a new folder (site2)
within your webroot folder (supplied with your cake app folder) and
create your documents there.

On May 17, 1:19 pm, Matt [EMAIL PROTECTED] wrote:
 I was hoping someone out there might be able to point me in the right
 direction.

 I setup a CakePHP environment on Windows XP with Apache 2.2 and
 MySQL.  Everything works fine for the root directory that I setup
 which appears as such in the httpd.conf file

 DocumentRoot      C:/site/development

 Directory /
     Options FollowSymLinks
     AllowOverride All
     Order deny,allow
     Deny from all
 /Directory

 Directory C:/site/development
     Options Indexes FollowSymlinks
     AllowOverride All
     Order allow,deny
     Allow from all
 /Directory

 Now I wanted to add an alias to another directory in order to run .php
 files/scripts separately from whatever Cake has going on with its
 mod_rewrite and everything.  I have a feeling that mod_rewrite is the
 root of this problem but I am not familiar enough with configuring it
 in the .htacccess file to know what to fix.

 The new alias which points to an entirely diffferent directory and has
 the path on the server of /site2/ does not let me execute php
 scripts.  I can view the files fine on the webserver but I can't get
 it to process them as PHP scripts if that make sense.

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



Re: setting path in app/webroot/index.php

2008-05-19 Thread David Christopher Zentgraf

Don't fumble around with index.php UNLESS you deliberately moved the / 
cake and /app directories from their original locations.

What you probably want to do is edit the 3 .htaccess files in / , /app  
and /app/webroot to look something like this:

IfModule mod_rewrite.c
 RewriteEngine on

 RewriteBase /~user/project/trunk/

 RewriteRule^$app/webroot/[L]
 RewriteRule(.*) app/webroot/$1[L]
  /IfModule

Add the RewriteBase line, with the same path in all three .htaccess  
files.
(The path will look somewhat different for you on Windows.)

I can't seem to find the relevant entry in the manual anymore right now.
Is it still there?


On 19 May 2008, at 21:42, vishal wrote:


 Hi All,
  I am New user on this community..can any body help me
 please !

 I have problem in setting the path in app/webrot/index.php


 My cake is installed in:

 X:\small_projects\vishal

 if (!defined('DS')) {
   define('DS', DIRECTORY_SEPARATOR);
   }

   if (!defined('ROOT')) {

   define('ROOT', '/home/small_projects/vishal/cake_1.1.19.6305');
   }
   if (!defined('APP_DIR')) {
   //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION');
   define('APP_DIR', 'app');
   }

   if (!defined('CAKE_CORE_INCLUDE_PATH')) {

   define('CAKE_CORE_INCLUDE_PATH', '/home/small_projects/vishal/
 cake_1.1.19.6305/');
   }




 where X:/ drives in my local server 192.168.0.60

 so please set my path accordingly..if possible.  please check  edit
 where i am wrong..
 I am very confuse regarding that.


 Thanks in advance..!!!
 vishal

 


--~--~-~--~~~---~--~~
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: DocumentRoot Different In Different Browsers

2008-05-19 Thread BrendonKoz

I've had an issue similar to this while testing under Safari.  The
only way I could properly clear the cache (I don't know why) was to
reboot my Mac Mini.  Clearing the cache in Safari didn't completely
clear the cache.  If you hadn't yet tried that, it can't hurt.



On May 18, 2:12 am, spamguy [EMAIL PROTECTED] wrote:
 I'm working on configuring CakePHP 1.1 to run on Apache 1.1 + OS X
 10.4. This may or may not be a CakePHP-specific question, but the line
 separating Apache and Cake is very blurry.

 My problem: 'http://localhost'on various browsers produces different
 results! Viewing In Firefox, I get the correct file, /Users/spamguy/
 Sites/cake/app/webroot/index.php. In Camino and Safari, I just get /
 Users/spamguy/Sites (rather, the 'Index of /' file listing).

 In httpd.conf, I changed DocumentRoot to point to CakePHP's web
 directory:

 DocumentRoot /Users/spamguy/Sites/cake/app/webroot

 Same for the privs block:

 Directory /Users/spamguy/Sites/cake/app/webroot

 Save file, close, restart Apache. Typing in a localhost address
 produces varied results described above. I've cleared browser cache on
 all these browsers, but nothing changes.

 Again, if this is not a CakePHP problem, I apologise. It was a coin
 toss between asking this group and Apache's. 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: Unwanted Session variables in on page links

2008-05-19 Thread [EMAIL PROTECTED]

Hi Disel,

It looks like the php-installation on your host does not allow php-
native session storage.
In the configuration for your Cake application ou can try to change it
to cakes own session storage. app/config/core.php
Locate the session directive and change it from php to cake.

This might be all that is needed but if the server is configured
without session-support then you may just be one step closer in a
longer list of configuration issues.

In general, if they are willing to change their configuration you
should ask them to make sure that php is not in safe mode. Also show
then the manuals installation chapter, specifically the list of
requirements. See if they find anything that does not match.
http://manual.cakephp.org/view/308/installing-cakephp

hope any of this helps.
/Martin


On May 19, 3:44 pm, DieselDirk [EMAIL PROTECTED] wrote:
 Hi

 We've got a specific host we need to use and for some reason our
 friendly URLs get abominated with an ugly session type 
 variablewww.mysite.com/menu-link-page/?CAKEPHP=a7942ddb199e66f3eb4bcbd4980f19f3.
 I'm not the developer, but I'm trying to assist in finding the
 solution for this problem as we've got it on two sites that are
 sitting on this server. Changing hosts is not an option for us at this
 stage, but the hosting company is willing to help if it's a server
 problem. Any ideas? We're using the latest stable release (I think).

 Regards
 Diesel
--~--~-~--~~~---~--~~
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 not working with safari

2008-05-19 Thread [EMAIL PROTECTED]

Sorry, but there is no way of knowing what the problem is from that
info.

You need to check each step from your controller to your gui.
Since I assume it works fine in Firefox and Internet Explorer you
should start with Safari's error console. You should see some
javascript errors there.

/Martin


On May 19, 11:00 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 my ajax is not working with safari, if there is 5 to 10 data element
 in array than it works fine and if i fetch more data from
 database(more than 10 rows)
 than the safari browser shows nothing
 wat should i do
 thanx 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: Auth Allow Problem

2008-05-19 Thread BrendonKoz

Well, I'm getting redirection errors on the CakePHP cookbook so I
can't see if it informs you about this there, however...  You cannot
use the allow() method of the auth component on the login action.
It will cause Auth to misbehave.  The login action is explicitly
allowed via Auth.

I'll link you to an older article on Auth from Chris Hartjes:
http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/

On May 19, 4:50 am, Crazy [EMAIL PROTECTED] wrote:
 I just started looking into the auth component, I don't need ACL's or
 anything, all I need is simple authentication and a small form where
 someone can make an account.

 Everything works fine, I can log in etc, that is untill I use the
 $this-Auth-allow('*'); or $this-Auth-allow(login,
 register); to have access to /users/register

 Once I use this I can't seem to log in anymore.
 The code I am using can be found here:http://bin.cakephp.org/view/472528663

 I am probably missing something very stupid

 All help is appreciated

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



Re: Auth Allow Problem

2008-05-19 Thread [EMAIL PROTECTED]

Hi there,
You should never allow access to the login or logout actions that Auth
uses. Auth will handle that on its own and the problem you describe
matches prefectly.

Only allow access to register and you should be fine.

/Martin

On May 19, 10:50 am, Crazy [EMAIL PROTECTED] wrote:
 I just started looking into the auth component, I don't need ACL's or
 anything, all I need is simple authentication and a small form where
 someone can make an account.

 Everything works fine, I can log in etc, that is untill I use the
 $this-Auth-allow('*'); or $this-Auth-allow(login,
 register); to have access to /users/register

 Once I use this I can't seem to log in anymore.
 The code I am using can be found here:http://bin.cakephp.org/view/472528663

 I am probably missing something very stupid

 All help is appreciated

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



Re: Auth Allow Problem

2008-05-19 Thread aranworld

Auth Component will break if you try to allow 'login'.


On May 19, 1:50 am, Crazy [EMAIL PROTECTED] wrote:
 I just started looking into the auth component, I don't need ACL's or
 anything, all I need is simple authentication and a small form where
 someone can make an account.

 Everything works fine, I can log in etc, that is untill I use the
 $this-Auth-allow('*'); or $this-Auth-allow(login,
 register); to have access to /users/register

 Once I use this I can't seem to log in anymore.
 The code I am using can be found here:http://bin.cakephp.org/view/472528663

 I am probably missing something very stupid

 All help is appreciated

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



Re: error message in view

2008-05-19 Thread da_student

try this in line 5
echo $form-create('Post', array());

On May 19, 3:49 pm, hi zahir [EMAIL PROTECTED] wrote:
 Hello,

 i am new in cake. i wan trying the blog example in online manual.

 according to manual i created a view called:
 /app/views/posts/add.ctp

 and added following code:
 /app/views/posts/add.ctp

 h1Add Post/h1
 ?php
 echo $this-form-create('Post');
 print $form-input('title');
 print $form-input('body',array('rows'='3'));
 print $form-end('Save Post');
 ?

 but when i click 'Add Post' from index view, it shows following
 message.

 as per document $form object should be available in view. but it seems
 to me, it is not. may be i missed something.

 /app/views/posts/add.ctp
 Add Post

 Notice: Undefined property: View::$form in C:\wamp\www\cake\app\views
 \posts\add.ctp on line 5

 Fatal error: Call to a member function create() on a non-object in C:
 \wamp\www\cake\app\views\posts\add.ctp on line 5

 could anyone give me any advice please?

 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: Status Update on Cake 1.2 and Call to Action

2008-05-19 Thread Sliv

Just a reminder to everyone about the freeze nate posted:

Enhancement tickets created on or after May 18, 2008 are being moved
to 2.0 (this does not include tickets that are open that were created
before that date).

--~--~-~--~~~---~--~~
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: error message in view

2008-05-19 Thread Tapos Pal
change
echo $this-form-create('Post');
to
echo $form-create('Post');

Form is a helper so that u can't access like $this-form. U can easily
access it like $form if u declare it in the $helpers array of the
controller.

On Mon, May 19, 2008 at 7:49 PM, hi zahir [EMAIL PROTECTED] wrote:


 Hello,

 i am new in cake. i wan trying the blog example in online manual.

 according to manual i created a view called:
 /app/views/posts/add.ctp

 and added following code:
 /app/views/posts/add.ctp

 h1Add Post/h1
 ?php
 echo $this-form-create('Post');
 print $form-input('title');
 print $form-input('body',array('rows'='3'));
 print $form-end('Save Post');
 ?

 but when i click 'Add Post' from index view, it shows following
 message.

 as per document $form object should be available in view. but it seems
 to me, it is not. may be i missed something.


 /app/views/posts/add.ctp
 Add Post

 Notice: Undefined property: View::$form in C:\wamp\www\cake\app\views
 \posts\add.ctp on line 5

 Fatal error: Call to a member function create() on a non-object in C:
 \wamp\www\cake\app\views\posts\add.ctp on line 5



 could anyone give me any advice please?



 thanks

 



-- 
Best Regards,
Tapos Pal
http://tapos.wordpress.com

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



Re: Auth Allow Problem

2008-05-19 Thread Crazy

Hah!, it works!

Thank you so much, that's another something I learned :)

On 19 mei, 16:57, aranworld [EMAIL PROTECTED] wrote:
 Auth Component will break if you try to allow 'login'.

 On May 19, 1:50 am, Crazy [EMAIL PROTECTED] wrote:

  I just started looking into the auth component, I don't need ACL's or
  anything, all I need is simple authentication and a small form where
  someone can make an account.

  Everything works fine, I can log in etc, that is untill I use the
  $this-Auth-allow('*'); or $this-Auth-allow(login,
  register); to have access to /users/register

  Once I use this I can't seem to log in anymore.
  The code I am using can be found here:http://bin.cakephp.org/view/472528663

  I am probably missing something very stupid

  All help is appreciated

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



Re: Can't get Save() to save certain fields

2008-05-19 Thread Joe

a i didn't know cakephp did caching of that sort! thank you so
much, that was what fixed it.

On May 16, 7:47 pm, francky06l [EMAIL PROTECTED] wrote:
 As Marcin think, to me it's caching problem . Delete files in tmp/
 cache/models or set debug  0 in core.php :-)

 On May 17, 12:55 am, Stephen Orr [EMAIL PROTECTED] wrote:

  I think it depends which Cake version you're using, but I'm pretty
  sure now the preferred method of saving is:

  $this-Model-create($this-data);
  $this-Model-save();

  I'm not sure if this changed between 1.1 and 1.2, but I'm using 1.2
  and this technique works perfectly. I usually wrap it in a condition,
  such as:

  if($this-Model-create($this-data)  $this-Model-save()) {
  // The information was saved} else {

  // There was an error while saving - handle it here.

  }

  Hope that helps.

  Steve

  On May 16, 11:37 pm, Marcin Domanski [EMAIL PROTECTED] wrote:

   set debug to 1 so cake can refresh the cache,
   you _should_ debug with debug  0 :)

   On Fri, May 16, 2008 at 11:17 PM, Joe [EMAIL PROTECTED] wrote:

Hi,

I'm having trouble with save() and was wondering if anyone could shed
some light on the problem. I inherited a project that has a page with
a form on it which updates information to a database upon submission.
It uses the save() method to update the data in the table, and it
works fine for all the fields that were on the form when I started
working on it. Now I'm trying to add a few new fields on the form and
in the database, but save() refuses to save my data. It still saves
every *other* field, just not my new ones. The line that saves the
data is simply:
  $this-Modelname-save($this-data, false);

I've print_r()'d $this-data, and the field names are in there just
fine. They exist in the database. There is no fields list in the call
to save() as you can see, and I tried turning validation off. I just
can't get it to work and it's rather frustrating.

I went into model_php5.php, and print_r()'d out $fields and $values
above this line:
   if ($db-update($this, $fields, $values)) {

and my new fields are not in there. So I printed out the result of the
$this-hasField($x) test above the line:
  if ($this-hasField($x)  ($whitelist  in_array($x,
$fieldList) || !$whitelist)) {

and it fails for the fields not in there. So that makes sense. But the
ridiculously frustrating thing is that the fields *are in the
database*. In the table that belongs to the model. Same name, same
capitalizations. I just can't figure out what the problem here is...
does anyone have any idea?

Joe

   --
   Marcin Domanskihttp://kabturek.info

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



Issue with displaying image - trailing slash on url causes issue

2008-05-19 Thread clrockwell

Hello all,

I have an element which displays an image based on a session variable,
problem is that if I visit:
domain.com/section
I see the image, but visiting:
domain.com/section/ (with trailing slash)
does not show the image.

My image call is:
?php echo IMAGES_URL; ?base/rotate/?php echo $imgBase;?/?php echo
$session-read('sessionImg.' . $imgBase);?

The entire element is:
style type=text/css media=all

#header_right { background: #FFF url(?php echo IMAGES_URL; ?base/
rotate/?php echo $imgBase;?/?php echo $session-
read('sessionImg.' . $imgBase);?) 0 0 no-repeat; }

/style

Thanks much for taking the time to look.
--~--~-~--~~~---~--~~
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: Issue with displaying image - trailing slash on url causes issue

2008-05-19 Thread clrockwell

Forgot: cakephp 1.2, WAMP

On May 19, 12:46 pm, clrockwell [EMAIL PROTECTED] wrote:
 Hello all,

 I have an element which displays an image based on a session variable,
 problem is that if I visit:
 domain.com/section
 I see the image, but visiting:
 domain.com/section/ (with trailing slash)
 does not show the image.

 My image call is:
 ?php echo IMAGES_URL; ?base/rotate/?php echo $imgBase;?/?php echo
 $session-read('sessionImg.' . $imgBase);?

 The entire element is:
 style type=text/css media=all

 #header_right { background: #FFF url(?php echo IMAGES_URL; ?base/
 rotate/?php echo $imgBase;?/?php echo $session-

 read('sessionImg.' . $imgBase);?) 0 0 no-repeat; }

 /style

 Thanks much for taking the time to look.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trac Downtime

2008-05-19 Thread Gwoo

We are going to be upgrading the Trac site today. Hopefully, this
upgrade will make Trac faster and more stable. We are estimating
downtime to be about 2 hours. Thank you for your patience.
--~--~-~--~~~---~--~~
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: Headers Problem

2008-05-19 Thread koko

@Filip: thank you I'll check that, but my redirects are done as
normal ... as manual advises ... but I'll look for something like that

@Samuel: you mean after ? if there is any return, I have to remove it
right??


But what bothers me that it's working on localhost but on server I got
these errors
--~--~-~--~~~---~--~~
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: Auth Allow Problem

2008-05-19 Thread francky06l

Actually after looking to some of my code, I have $this-Auth-
alow('login', 'logout', 'someothers'); and this does not break the
Auth at all (at least for me).
I am running the latest SVN branch ... maybe this is the explanation.
Cheers

On May 19, 4:47 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi there,
 You should never allow access to the login or logout actions that Auth
 uses. Auth will handle that on its own and the problem you describe
 matches prefectly.

 Only allow access to register and you should be fine.

 /Martin

 On May 19, 10:50 am, Crazy [EMAIL PROTECTED] wrote:

  I just started looking into the auth component, I don't need ACL's or
  anything, all I need is simple authentication and a small form where
  someone can make an account.

  Everything works fine, I can log in etc, that is untill I use the
  $this-Auth-allow('*'); or $this-Auth-allow(login,
  register); to have access to /users/register

  Once I use this I can't seem to log in anymore.
  The code I am using can be found here:http://bin.cakephp.org/view/472528663

  I am probably missing something very stupid

  All help is appreciated

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



Re: Headers Problem

2008-05-19 Thread Samuel DeVore

yes after ?  or before ?

On Mon, May 19, 2008 at 9:52 AM, koko [EMAIL PROTECTED] wrote:

 @Filip: thank you I'll check that, but my redirects are done as
 normal ... as manual advises ... but I'll look for something like that

 @Samuel: you mean after ? if there is any return, I have to remove it
 right??


 But what bothers me that it's working on localhost but on server I got
 these errors
 




-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
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: Auth Allow Problem

2008-05-19 Thread Crazy

I am running the latest svn version as well. It broke for me.


//Does not redirect
$this-Auth-allow('register', 'login');

//Works fine
$this-Auth-allow('register');


On 19 mei, 18:41, francky06l [EMAIL PROTECTED] wrote:
 Actually after looking to some of my code, I have $this-Auth-alow('login', 
 'logout', 'someothers'); and this does not break the

 Auth at all (at least for me).
 I am running the latest SVN branch ... maybe this is the explanation.
 Cheers

 On May 19, 4:47 pm, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  Hi there,
  You should never allow access to the login or logout actions that Auth
  uses. Auth will handle that on its own and the problem you describe
  matches prefectly.

  Only allow access to register and you should be fine.

  /Martin

  On May 19, 10:50 am, Crazy [EMAIL PROTECTED] wrote:

   I just started looking into the auth component, I don't need ACL's or
   anything, all I need is simple authentication and a small form where
   someone can make an account.

   Everything works fine, I can log in etc, that is untill I use the
   $this-Auth-allow('*'); or $this-Auth-allow(login,
   register); to have access to /users/register

   Once I use this I can't seem to log in anymore.
   The code I am using can be found 
   here:http://bin.cakephp.org/view/472528663

   I am probably missing something very stupid

   All help is appreciated

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



Re: Defining more than one hasMany relationship

2008-05-19 Thread Tony Thomas

I tried resetting the array as you describe but the problem persisted.
The only thing that worked was to stop using foreach. I don't get it,
but I stopped trying once I found a solution.

On May 16, 10:58 pm, David Christopher Zentgraf [EMAIL PROTECTED]
wrote:
 foreach() does neither modify nor unset the original array unless
 explicitly told to.
 Maybe you're having issues with the array pointer?

 http://jp2.php.net/foreach

  foreach has some side effects on the array pointer. Don't rely on
  the array pointer during or after the foreach without resetting it.

 http://jp2.php.net/manual/en/function.reset.php

 $numbers = array(1, 2, 3, 4);

 foreach ($numbers as $number) {
 $number = null; // does nothing to $numbers

 }

 print_r(current($numbers)); // prints nothing

 reset($numbers);
 print_r(current($numbers)); // prints '1'

 print_r($numbers);  // prints 'array([0] = 1, [1] = 2 
 ...)'

 On 16 May 2008, at 22:26, Tony Thomas wrote:



  No. It's simply looping through and echoing the array, but once it
  does, the contents of the array are no longer available. As soon as I
  looped through using while(list($key, $value) = each($array) instead
  of a foreach loop, I was able to loop through it twice to create the
  second table. Please correct me if I'm wrong, but I presume it's
  because foreach() operates from a copy of the array, which is then
  unset after looping through the data. At least, that's what my results
  suggest. As soon as I switched methods as noted above, the data
  remained available to loop through again to create a second table from
  separate data in the array.

  On May 15, 4:20 pm, Dovdimus Prime [EMAIL PROTECTED] wrote:
  Are you saying that this foreach loop is modifying the contents of
  the
  array?

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



Building an API to plug into Cake AppControllers.

2008-05-19 Thread theandystratton

Hey all:

We're in the process of re-developing an existing app using Cake and
are interesting in building API's.  Our goal is to not duplicate code,
so we'd like the API's living at api.myapplication.com to be able to
call/use the logic built into our controllers.

Any one done this before or have insights? We'd like to avoid
duplicating areas where the application logic lives, but both the API
and the application can live on the same box, or at least have file
access as if they were.

Thanks,

-Andy

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



RE: Building an API to plug into Cake AppControllers.

2008-05-19 Thread Ryan Rose

You can look at NoseRub (http://noserub.com/). I believe they have released
an API
(http://noserub.com/documentation/archives/API-Application-Programming-Inter
face.html). 

They have a Cake app available for download (http://noserub.com/download/).
You might be able to get some ideas from looking at how they are handling
their API with Cake (they're using 1.2 Beta).

HTH,

Ryan Rose
CTO, Brightegg
One Technology Drive
Tolland, CT 06084
e: [EMAIL PROTECTED]
p: 860.730.2631
http://www.brightegg.com
Build, Manage and Market A Better Website


-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of theandystratton
Sent: Monday, May 19, 2008 2:20 PM
To: CakePHP
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Building an API to plug into Cake AppControllers.


Hey all:

We're in the process of re-developing an existing app using Cake and
are interesting in building API's.  Our goal is to not duplicate code,
so we'd like the API's living at api.myapplication.com to be able to
call/use the logic built into our controllers.

Any one done this before or have insights? We'd like to avoid
duplicating areas where the application logic lives, but both the API
and the application can live on the same box, or at least have file
access as if they were.

Thanks,

-Andy



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



Re: Headers Problem

2008-05-19 Thread koko

h ... it was a redirect problem and until now I don't know the
reason, here is my function:

function register() {
$this-layout = 'default';
if (!empty($this-data)) {
if ($this-User-save($this-data)) {
$this-Session-setFlash('You\'ve been registered, thank you');
//$this-redirect('/');
}
else
$this-Session-setFlash('Please, correct the error(s) 
below');
}
}

if I remove the comment $this-redirect('/'); I got the header error,
is changing the layout is the reason...

I tried to remove $this-layout = 'default'; , but I got the same
header error

I don't know what to do now !!!
--~--~-~--~~~---~--~~
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: Issue with displaying image - trailing slash on url causes issue

2008-05-19 Thread clrockwell

I now am a step closer I think, any help would be very much
appreciated.

Using:
$path = Router::url();
$pathl = strlen($path) - 1;
if($path{$pathl} !== '/')
{
$imagePath = IMAGES_URL . 'base/rotate/' . $imgBase . '/' . 
$session-
read('sessionImg.' . $imgBase);
}
else
{
$imagePath = '../' . IMAGES_URL . 'base/rotate/' . $imgBase . 
'/' .
$session-read('sessionImg.' . $imgBase);
}
fixes the problem I mentioned before.

But if I go another level deep, i.e. domain.com/section1/section2
I lose it again.

Thanks for any direction as to a more extensible fix for this.

On May 19, 12:47 pm, clrockwell [EMAIL PROTECTED] wrote:
 Forgot: cakephp 1.2, WAMP

 On May 19, 12:46 pm, clrockwell [EMAIL PROTECTED] wrote:

  Hello all,

  I have an element which displays an image based on a session variable,
  problem is that if I visit:
  domain.com/section
  I see the image, but visiting:
  domain.com/section/ (with trailing slash)
  does not show the image.

  My image call is:
  ?php echo IMAGES_URL; ?base/rotate/?php echo $imgBase;?/?php echo
  $session-read('sessionImg.' . $imgBase);?

  The entire element is:
  style type=text/css media=all

  #header_right { background: #FFF url(?php echo IMAGES_URL; ?base/
  rotate/?php echo $imgBase;?/?php echo $session-

  read('sessionImg.' . $imgBase);?) 0 0 no-repeat; }

  /style

  Thanks much for taking the time to look.
--~--~-~--~~~---~--~~
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: Issue with displaying image - trailing slash on url causes issue

2008-05-19 Thread jonknee

What does the generated HTML look like? Sounds like it's using a
relative path.
--~--~-~--~~~---~--~~
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: Status Update on Cake 1.2 and Call to Action

2008-05-19 Thread Jonathan Snook

Is it possible to have those very few last minute entries submitted
with patches get secondary glances? (since I only see 4 listed...)

:)

Otherwise, fantastic work! The progress has been exciting to see and
I'm looking forward to the RC release.

On Mon, May 19, 2008 at 11:51 AM, Sliv [EMAIL PROTECTED] wrote:

 Just a reminder to everyone about the freeze nate posted:

 Enhancement tickets created on or after May 18, 2008 are being moved
 to 2.0 (this does not include tickets that are open that were created
 before that date).

--~--~-~--~~~---~--~~
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: Status Update on Cake 1.2 and Call to Action

2008-05-19 Thread Sliv

I guess you'll have to bribe Nate, I just work here hehe :P

On May 19, 5:35 pm, Jonathan Snook [EMAIL PROTECTED] wrote:
 Is it possible to have those very few last minute entries submitted
 with patches get secondary glances? (since I only see 4 listed...)


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



Limiting Routes to specific Controllers

2008-05-19 Thread benjam

I'm having a menu problem, I have a section of my site which 'wraps'
several controllers and models, therefore, while doing things in this
section, the menu I have created with $menu-menu breaks (the current
menu tab highlighting is incorrect) because my URL keeps changing,
although I am in the same 'section' of the site.

I figured I could fix this with routes and and have a route set up as
the following... (/training is the topmost dir for the section)

Router::connect('/training/:controller/:action/*', array('controller'
= 'lessons', 'action' = 'index'));

which basically clones the entire site at /training/*

This is fine for the moment, because using the menu will take people
back out of the /training dir.  But my question is this...

How (if it's possible), can I limit the controllers allowed to go
through the /training dir?  I only have four controllers that I want
to have access to the /training dir, all other requests should show an
error, or better yet, redirect to the proper controller directory.

As it stands, I can enter the /training section by simply typing /
training/some_other_non_training_controller, which is not bad, but it
would break the menu the other way, instead of always losing focus on
the 'Training' tab, it would always show focus on the 'Training' tab.

--~--~-~--~~~---~--~~
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 migrations support planned for Cake?

2008-05-19 Thread Keith

@ Dardo

The goal of my post was not to discredit your argument or you as you
suggest multiple times (ad hominem argument).  I thought you wrote a
well thought out argument in favor of using Cake's built in Schema
which I stated in my post.  I will continue to argue that your
provided workflow and associated argument are the essential points in
favor of Schema when people are looking for justification about it.

I would, however, suggest you read through the articles that I posted
as some of the things you noted in your line-by-line commentary are
addressed by people far more qualified to comment than I.  When
writing about the differences I did due dilligence to understand the
benefits of cakePHP's built in Schema tool.  I even looked for outside
commentary about it and as far as I could tell it is something that
has some similarities from practices in the Java world.  So far, you
are the definitive voice on the subject in the CakePHP world!

@ Joel

I'm actually going to throw my summary into my blog and do not mind if
you put it into your blog as well.  It is something that Dardo's post
got me thinking about.  What started as a quick response turned into
something I too wouldn't mind using.  I'm thrilled you'd want to use
it that way.

---

The bottom line is this: If CakePHP's Schema is working for you then
it should absolutely be the tool / approach you use.  It is worthwhile
to mention that if it does not work for you, Joel has created an
alternative system that may be a better fit.



On May 19, 7:45 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  The cake Schemas are far better than migrations, because they are a
  different concept.

  If I agree that the concept is different then you have wasted time in
  comparing apples to oranges

 As they are different approaches to solve the same problem I can compare them.

  Migrations *don't have to be* written in YAML - this is one of the prime
  things which I don't like with Joel's implementation.

 I know, but, can you tell me in what language they are easy to write
 and look pretty? Post an example please.

 Regards,
 - Dardo Sordi.



  Other than that I agree with what Keith has written.

  Cheers
  Tarique

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

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



Problem calling user controler from app controler.

2008-05-19 Thread Knud Soerensen

In app_controler.php i have

class appControler extends Controler
{

function beforeFilter()
{
App::Import('Model','User');
$this-User=new User();
$this-User-login();
}

}

But I get 2 simmilar looking warnings:
warning (2): pg_query() [function.pg-query] Query failed: ERROR: syntax
error at or near login
LINE 1: login

and

warning (512): SQL Error: ERROR: syntax error at or near login
LINE 1:  login


What am i doing wrong ??






--~--~-~--~~~---~--~~
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: Pretty urls not working

2008-05-19 Thread Marcos Aruj
Hi again,

I've installed the 1.2 version, since the 1.1 was not working fine without
mod_rewrite.
With 1.2, I get to the page I want by doing:

http://www.mysite.com/index.php?url=controller/action

But I think Cake is handling the URLs in a different way internally. When I
try to use the add form

http://www.mysite.com/index.php?url=controller/add

it redirects to http://www.mysite.com/index.php/controller/action

which throws a: No input file specified and no record is saved.

Any clues?

Thanks!

On Fri, May 16, 2008 at 1:33 PM, Marcos Aruj [EMAIL PROTECTED] wrote:

 Anyone? :(
 Or does any body has deployed cake php on a godaddy hosting? Any steps to
 follow? Things to check?
 Thanks again.


 On Fri, May 16, 2008 at 9:48 AM, Marcos Aruj [EMAIL PROTECTED]
 wrote:

 Thanks fot the suggestion. With no slash (
 http://www.mysite.com/index.php?url=surveys/index) I get this:
  CakePHP Rapid Development
 Missing controller

 You are seeing this error because controller *Controller* could not be
 found.

 *Notice:* If you want to customize this error message, create
 app/views/errors/missing_controller.thtml.

 *Fatal*: Create the class below in file : app/controllers/controller.php
 ?php
 class Controller extends AppController {
var $name = '';
 }
 ?

 **
 It's not parsing the controller name at all.. :(
 Any other suggestion? Thanks for helping ;)

 On Fri, May 16, 2008 at 5:14 AM, Esoteric [EMAIL PROTECTED]
 wrote:


 Try:
 www.mysite.com/index.php?url=controller/action (no slash before
 controller)

 Let us know.
 -Erik

 On May 15, 6:44 pm, Markitusss [EMAIL PROTECTED] wrote:
  Hi all,
 
  I've been trying to run cake on a godaddy hosting service. mod_rewrite
  is not  available, so I set up cake to use its Pretty URLs, by
  uncommenting the line inside core.php and by deleting .htaccess files.
  I got the index page to perfectly, with CSS styling and connection to
  the database, but I can't access controllers/actions. I get a 404 not
  found. I tried
 
 
 www.mysite.com/index.php/controller/actionandwww.mysite.com/index.php?url=/controller/actionwithno
  success.
 
  On my computer, everything works fine with mod_rewrite, but I can'
  make it to work on the server. Is it something special with godaddy,
  or am I missing some other settings. Please help.
 
  I also tried this fix:https://trac.cakephp.org/ticket/812
 
  1. The URL's need to contain the extra '?'. In app/config/core.php
  [line 42] you will have uncommented this line for no mod_rewrite.
  Change it to:
 
  define('BASE_URL',env('SCRIPT_NAME') . '?');
 
  2. Need to extract the controller/view differently. Index.php (line
  68) currently reads:
 
  $uri = setUri();
 
  Change this line to:
 
  $uri = env('PHP_SELF') . env('QUERY_STRING');
 
  but no luck...
 
  Thanks in advance,
 
  Best regards,
 
  Marcos
 



 --
 Marcos Aruj Alvarez
 Ingeniero de Software
 ---
 [EMAIL PROTECTED]
 -




 --
 Marcos Aruj Alvarez
 Ingeniero de Software
 ---
 [EMAIL PROTECTED]
 -




-- 
Marcos Aruj Alvarez
Ingeniero de Software
---
[EMAIL PROTECTED]
-

--~--~-~--~~~---~--~~
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: Issue with displaying image - trailing slash on url causes issue

2008-05-19 Thread 3lancer.eu

Hi,

 What does the generated HTML look like? Sounds like it's using a
 relative path.

Exactly, any reason for not using $html-image() for that?

Piotr

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



Setting the meta description

2008-05-19 Thread Jared

Hey all,
I have recently been tasked with maintaining a cakephp application. I
am trying to make it a bit more seo friendly by doing the custom page
titles and meta descriptions. The meta description has been pretty
straight forward in being able to set the pageTitle in the controller.
Is there a way to do the same in the controller with the meta
description. The layout for the site has hard coded titles and
descriptions already. I hacked it so that in the layout it checks to
see if a variable for the meta description is set and then it replaces
it. But I am thinking that there is probabbly a better way to do this
that I can't figure out.

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



Re: Limiting Routes to specific Controllers

2008-05-19 Thread Jonathan Snook

What you might be interested in is prefix routing.

http://book.cakephp.org/view/39/configuration#routes-configuration-46


On Mon, May 19, 2008 at 5:41 PM, benjam [EMAIL PROTECTED] wrote:

 I'm having a menu problem, I have a section of my site which 'wraps'
 several controllers and models, therefore, while doing things in this
 section, the menu I have created with $menu-menu breaks (the current
 menu tab highlighting is incorrect) because my URL keeps changing,
 although I am in the same 'section' of the site.

 I figured I could fix this with routes and and have a route set up as
 the following... (/training is the topmost dir for the section)

 Router::connect('/training/:controller/:action/*', array('controller'
 = 'lessons', 'action' = 'index'));

 which basically clones the entire site at /training/*

 This is fine for the moment, because using the menu will take people
 back out of the /training dir.  But my question is this...

 How (if it's possible), can I limit the controllers allowed to go
 through the /training dir?  I only have four controllers that I want
 to have access to the /training dir, all other requests should show an
 error, or better yet, redirect to the proper controller directory.

 As it stands, I can enter the /training section by simply typing /
 training/some_other_non_training_controller, which is not bad, but it
 would break the menu the other way, instead of always losing focus on
 the 'Training' tab, it would always show focus on the 'Training' tab.

 


--~--~-~--~~~---~--~~
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 migrations support planned for Cake?

2008-05-19 Thread Dardo Sordi Bogado

 The goal of my post was not to discredit your argument or you as you
 suggest multiple times (ad hominem argument).

I wasn't saying that you tried to discredit me, but to argument in
favor of migration with

 Migrations have a reputable body or work behind them

seems like an ad hominem argument to me.

  I thought you wrote a
 well thought out argument in favor of using Cake's built in Schema
 which I stated in my post.  I will continue to argue that your
 provided workflow and associated argument are the essential points in
 favor of Schema when people are looking for justification about it.

Well, I've just wanted to share my experience with both, migrations
and cake schema (something I found to be very different from the
things in the java world you mention, but I'm not a java programmer).
For me, cake schema worked better than migrations in my working
enviroment, with the tools I've been using.

 I would, however, suggest you read through the articles that I posted
 as some of the things you noted in your line-by-line commentary are
 addressed by people far more qualified to comment than I.  When
 writing about the differences I did due dilligence to understand the
 benefits of cakePHP's built in Schema tool.  I even looked for outside
 commentary about it and as far as I could tell it is something that
 has some similarities from practices in the Java world.

I've read them, but it didn't answer what Joel is adressing here:

http://developingwithstyle.com/2008/05/05/the-problem-with-migrations/

and what happens when two or more migrations conflicts.


  So far, you
 are the definitive voice on the subject in the CakePHP world!

I've didn't noticed it, isn't anyone else using the Cake schema shell?
If that is the case, they are missing a great tool.


As a final note, while re reading what I've wrote I've noticed that it
was too bad spelled and worded (actually it seems like I'm writing
using my elbows) sorry for that. Also, I didn't want to sound too
hash, but in the final result the was tone too grumpy (maybe I'm
reading this list too much, jaja).

Cheers,
- Dardo Sordi.

--~--~-~--~~~---~--~~
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 calling user controler from app controler.

2008-05-19 Thread Ketan Patel

Looks like you don't know what you are trying to do here. Read the
manual. As you don't have a clue what a model and controller is. In
your code, you are importing the User model and then calling the
action of the users controller. On top of that, this is not the way to
do whatever you are trying to do.

On May 19, 6:16 pm, Knud Soerensen [EMAIL PROTECTED] wrote:
 In app_controler.php i have

 class appControler extends Controler
 {

 function beforeFilter()
 {
 App::Import('Model','User');
 $this-User=new User();
 $this-User-login();

 }
 }

 But I get 2 simmilar looking warnings:
 warning (2): pg_query() [function.pg-query] Query failed: ERROR: syntax
 error at or near login
 LINE 1: login

 and

 warning (512): SQL Error: ERROR: syntax error at or near login
 LINE 1:  login

 What am i doing wrong ??
--~--~-~--~~~---~--~~
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 migrations support planned for Cake?

2008-05-19 Thread David Christopher Zentgraf

On 20 May 2008, at 08:21, Dardo Sordi Bogado wrote:

 I've didn't noticed it, isn't anyone else using the Cake schema shell?
 If that is the case, they are missing a great tool.

Speaking for me personally, I'm not using schema because there's very  
little documentation to be found. This thread seems like the most  
informative thing I've read about the whole topic so far (thanks both  
for your posts). I've played around with schema once just looking at  
the provided ones, but couldn't figure out how to create multiple  
UNIQUE indexes and got frustrated.

You've got me interested in the whole concept again, but I really wish  
there were some in-depth articles about schema. *wink*wink*nudge*nudge*

Chrs,
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: Is migrations support planned for Cake?

2008-05-19 Thread Keith

On May 19, 7:21 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 I've read them, but it didn't answer what Joel is adressing here:

 http://developingwithstyle.com/2008/05/05/the-problem-with-migrations/

 and what happens when two or more migrations conflicts.

He addresses the answer in that post.  You don't label the migration
sequentially.  You label it based on UTC timestamp as the race
condition where 2 developers generate a migration at exactly the same
moment is highly unlikely.  Rails 2.1 is going that way (http://
railscasts.com/episodes/107).

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



Validating only specific fields within a model?

2008-05-19 Thread Matt Huggins

In CakePHP 1.2, is there a way to validate only some specific fields
within a model?

I have a Member model is set up to validate several fields under
normal conditions, such as username, password, email, etc.  I'm
trying to make a change password form for users of my application.
Since I'll only be saving the password field of the model, I only
want to validate the password  password2 (validate password)
fields that are entered by the user.  Unfortunately, the model class's
validate() function does not take any parameters, meaning that the
entire model is validated despite only updating a single field value
via saveField().

Does anyone have any insight on how to go about validating specific
fields in a model for special circumstances like this?  Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Enum radio buttons/select boxes and validation

2008-05-19 Thread Dianne van Dulken

Hi,

I have a registration form that has enum set radio buttons for gender,
and a select box for user type.  I also use the same page for updating
the users details (mainly).

When I go initially to set a new user or to update a member, it sets
the information correctly in these fields.  For example, if I am
female, it has F checked, and if I am a consumer, it has consumer
selected.

However, if it fails validation on update/register, it loses this
information.  I've done a var_dump on $this-data and it is appearing
there, but it doesn't seem to be finding the previously selected
values.  I can't for the life of me work out why.

I assume that I may need to set the default values again on failure,
but I also cannot work out what I should be setting them to.  I've
tried $this-set('gender', $this-data['User']['gender']), $this-
set('User.gender', ...) etc.  None works.

Has anyone else come across this problem and have a brilliant solution
on how to fix it?

cheers

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



Email Component sends email with empty body

2008-05-19 Thread donnerbeil

Hi!

I'm using the latest nightly so this is probably not the case:
https://trac.cakephp.org/ticket/3820

But I still receive empty emails. The strangest part is, that it
depends on the email provider. I have an email account at my own
domain. I check the mails with Thunderbird (IMAP) and it works. Then I
have an Email account at freenet.de, a popular email provider in
germany. When I check the freenet account with thunderbird(Pop3) I get
an empty email body. When I check the freenet account via the
webinterface, I can read the body but it's not formatted correctly. It
shows the headers then.

I followed exactly the instructions here: 
http://manual.cakephp.org/view/269/sending-a-basic-message

I assume, that it has maybe something to do with utf8 encoding.
Because when I check the freenet mail with Thunderbird and manually
set the encoding for the mail  to utf8 in Thunderbird, then I can at
least read the email, but still only with all the headers in it.

I'm trying to fix this for over a week now. My whole web app is
working, but I need to send an email with an activation code for the
new users. So please help me fix this last issue.

Thanks a lot for any help.

Donnerbeil

--~--~-~--~~~---~--~~
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: Email Component

2008-05-19 Thread cooked

Thanks for the reply I will try out the debug and let you know what I
see. I am
use version 1.2 the latest available for download.

On May 16, 10:45 pm, b logica [EMAIL PROTECTED] wrote:
 Weird. It might be worth putting a die(debug($View)) statement in
 EmailComponent::__renderTemplate() just after it's set. After the
 layout is set on it, actually.

 What version are you using?

 On Fri, May 16, 2008 at 7:51 PM, cooked [EMAIL PROTECTED] wrote:

  Sorry about not supplying the context. Here is the code snippet from
  my Controller.

 var $component= array('Email');

 function join()
 {
   if (!empty($this-data)) {
 
 
 if ($this-Player-save($this-data)) {
  $this-sendJoinEmail($this-data['Player']
  ['email'],
   $this-data['Player']
  ['activation_code']);
  }
}
 }

 function sendJoinEmail($emailaddr, $code)
 {
 $this-Email-to = $emailaddr;
 $this-Email-subject = 'Fremont Tennis Ladder Activation Code';
 $this-Email-replyTo = '[EMAIL PROTECTED]';
 $this-Email-from= 'Tennis Ladder';
 $this-Email-template = 'welcome';
 $this-set('code', $code);
 $this-Email-send();
 }

  On May 16, 4:12 pm, b logica [EMAIL PROTECTED] wrote:
  I think the obvious question is, how are you specifying the path to
  your template?

  On Fri, May 16, 2008 at 1:48 PM, cooked [EMAIL PROTECTED] wrote:

   I have seeing a weird issue with theemailcomponent. Theemailare
   being sent
   but with a message that the template file is not found. For some
   reason cake is trying to
   find the template in
   .../app/views/views/elements/email/text/welcome.ctp.

   As you can see there is an extra views in the path. Can someone let
   me why
   is this hapening. Is this a known bug?

   Thanks- Hide quoted text -

  - Show quoted text -

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



Re: Validating only specific fields within a model?

2008-05-19 Thread Matt Huggins

Alright, well I solved my own problem.  It might not be the most
efficient method, but given that I didn't find anything within CakePHP
to handle this, I think it's pretty good.  In case anyone else is
looking for how to do it, here's what I did.  Within app_model.php,
simply create the following function:

/**
 * Name: validates()
 * Desc: Allow only specified fields to be validated for a model.
 */
function validates($fieldList = null) {
// If no fields are specified, then simply use the standard
validation method.
if ($fieldList === null) {
return parent::validates();
} else {
// If a single value is passed as a string, convert it to an 
array.
if (!is_array($fieldList)) {
$fieldList = array($fieldList);
}

// If the validation array is not set for the model, then there 
is
nothing to check.
if (!isset($this-validate) || empty($this-validate)) {
return true;
} else {
// Create a placeholder for the original validation 
array, then
filter out
// any fields that do not require validation.  Perform 
the
validation, then
// restore the original validation array for the model.
$validate = $this-validate;
$this-validate = array_intersect_key($this-validate,
array_flip($fieldList));
$result = parent::validates();
$this-validate = $validate;

return $result;
}
}
}

Now, when you want to validate specific fields, just pass an array of
field names to the validates() function.

$this-Member-set($this-data);
$result = $this-Member-validates(array('password', 'password2'));
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Multiple rule Validation causes Redirect to fail.

2008-05-19 Thread Mr-Yellow

Depending on the validation rules in my models CakePHP will fail on
redirect with a PHP memory error.

[code]
var $validate = array(
'email' = VALID_EMAIL,
'passphrase' = VALID_NOT_EMPTY,
'displayname' = VALID_NOT_EMPTY,
);
[/code]

Works.

[code]
var $validate = array(
'slug' = array(
array(
'allowEmpty' = false,
'required' = true,
'rule' = 'alphaNumeric',
'message' = 'Slug URL should only contain alpha-numeric
characters.'
),
array(
'rule' = array('between', 3, 30),
'message' = 'Slug URL should be between 3 and 30 
characters long.'
),
array(
'rule' = 'isUnique',
'message' = 'Slug URL is already in use.'
)
),
'displayname' = array(
array(
'allowEmpty' = false,
'required' = true,
'rule' = 'alphaNumeric',
'message' = 'Displayname should only contain 
alpha-numeric
characters.'
),
array(
'rule' = array('between', 3, 30),
'message' = 'Displayname should be between 3 and 30 
characters
long.'
),
array(
'rule' = 'isUnique',
'message' = 'Displayname is already in use.'
)
),
'email' = array(
array(
'allowEmpty' = false,
'required' = true,
'rule' = 'email',
'message' = 'Invalid Email address.'
),
array(
'rule' = 'isUnique',
'message' = 'Email is already in use.'
)
),
'passphrase' = array(
array(
'allowEmpty' = false,
'required' = true,
'rule' = 'alphaNumeric',
'message' = 'Invalid Password.'
)
)
);
[/code]

Breaks $this-redirect.

Any ideas? Whitespace in validation part of the core?

-Ben

--~--~-~--~~~---~--~~
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: Validating only specific fields within a model?

2008-05-19 Thread David C. Zentgraf

I'm not quite sure why you're going through all the trouble.
Validation is supposed to work transparently in the background.

If a field in your input data has a corresponding rule in the model,  
it'll be validated, thus always ensuring sane input into your  
database. If you're only sending the new password field, than only  
that's going to be validated.

The catch is setting 'required' = true on a rule, which means that  
the field has to be present every time in your input data.

On 20 May 2008, at 11:46, Matt Huggins wrote:


 Alright, well I solved my own problem.  It might not be the most
 efficient method, but given that I didn't find anything within CakePHP
 to handle this, I think it's pretty good.  In case anyone else is
 looking for how to do it, here's what I did.  Within app_model.php,
 simply create the following function:

 /**
 * Name: validates()
 * Desc: Allow only specified fields to be validated for a model.
 */
 function validates($fieldList = null) {
   // If no fields are specified, then simply use the standard
 validation method.
   if ($fieldList === null) {
   return parent::validates();
   } else {
   // If a single value is passed as a string, convert it to an 
 array.
   if (!is_array($fieldList)) {
   $fieldList = array($fieldList);
   }

   // If the validation array is not set for the model, then there 
 is
 nothing to check.
   if (!isset($this-validate) || empty($this-validate)) {
   return true;
   } else {
   // Create a placeholder for the original validation 
 array, then
 filter out
   // any fields that do not require validation.  Perform 
 the
 validation, then
   // restore the original validation array for the model.
   $validate = $this-validate;
   $this-validate = array_intersect_key($this-validate,
 array_flip($fieldList));
   $result = parent::validates();
   $this-validate = $validate;

   return $result;
   }
   }
 }

 Now, when you want to validate specific fields, just pass an array of
 field names to the validates() function.

 $this-Member-set($this-data);
 $result = $this-Member-validates(array('password', 'password2'));
 


--~--~-~--~~~---~--~~
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: Multiple rule Validation causes Redirect to fail.

2008-05-19 Thread Mr-Yellow

It could be purely memory related, if I take out rules one by one it
reaches a point that it works regardless of what the rules actually
are.

So I guess the validation lib needs a bunch of optimisation work done
on it, and I guess CakePHP on the whole is bound to use a crap-load of
memory given how it stores/generates/loops such large arrays all the
time (I just hope their pointers and not copied all the time).

-Ben

--~--~-~--~~~---~--~~
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: Reusing controller code for multiple instances of the same application

2008-05-19 Thread Bruce

Thought of that too - having done that several times.

Departing from the theoretical and exposing my actual code -- the
system is a job tracking and management tool, with the base data in a
table named 'jobs'. The model is job.php and the controller is
jobs_controller.php. It all works fine under /cake12/jobs/ with or
without specific routing.

I want to use two different URLs to access different 'instances' of
the application - using different database tables. The two paths I
want to use are '/cake12/jobtrack' and '/cake12/biotrack'. I have the
database and configuration working fine for the first call to the app.
The index page works just as I would expect.

If I try to access the URL (say '/cake12/jobtrack' ) with no router
settings, I get Error: JobtrackController could not be found - exactly
what I would expect.

If I add  Router::connect('/jobtrack', array('controller' = 'jobs',
'action' = 'index')) to the router file, I can connect to the index
page, but any subsequent pages, such as '/cake12/jobtrack/add', I get
the no controller error again - which makes perfect sense.

If I add Router::connect('/jobtrack/*', array('controller' = 'jobs'))
- the additional address works, but seems to always go to the index
page.

Here is the code from the router file:
Router::connect('/', array('controller' = 'pages', 'action'
= 'display', 'home'));
Router::connect('/pages/*', array('controller' = 'pages',
'action' = 'display'));
Router::connect('/jobtrack/*', array('controller' = 'jobs'));

Here is a parameter dump from the first line of beforefilter in the
controller:

1. accessed as /cake12/jobs/add
app/controllers/jobs_controller.php (line 15)
Array
(
[pass] = Array
(
)

[named] = Array
(
)

[controller] = jobs
[action] = add
[plugin] =
[form] = Array
(
)

[url] = Array
(
[url] = jobs/add
)

[bare] = 0
[webservices] =
)

2. Accessed as /cake12/jobtrack/add
app/controllers/jobs_controller.php (line 15)
Array
(
[pass] = Array
(
[0] = add
)

[named] = Array
(
)

[plugin] =
[controller] = jobs
[action] = index
[form] = Array
(
)

[url] = Array
(
[url] = jobtrack/add
)

[bare] = 0
[webservices] =
)

So where does it get the action=index from?

--~--~-~--~~~---~--~~
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: Validating only specific fields within a model?

2008-05-19 Thread Matt Huggins

I originally thought the same thing as you David.  It seems
instinctive that only the fields being saved should be validated.
However, looking into the model.php file of the core shows that ALL
fields are in fact being validated, even if only one or several fields
are being updated.

Specifically, the following if-condition stands out within the save()
function.  Note how it doesn't validate some fields; instead it
validates all fields.  This is confirmed by verifying the
functionality of the validates() function as well, which in turn calls
invalidFields() without specifying specific fields for validation.

if ($options['validate']  !$this-validates()) {
$this-whitelist = $_whitelist;
return false;
}
--~--~-~--~~~---~--~~
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: Validating only specific fields within a model?

2008-05-19 Thread David C. Zentgraf

I haven't come across any problems with the validations yet...
Are you saying that it attempts to validate fields which aren't  
present in your input data and fails on them?

On 20 May 2008, at 12:34, Matt Huggins wrote:


 I originally thought the same thing as you David.  It seems
 instinctive that only the fields being saved should be validated.
 However, looking into the model.php file of the core shows that ALL
 fields are in fact being validated, even if only one or several fields
 are being updated.

 Specifically, the following if-condition stands out within the save()
 function.  Note how it doesn't validate some fields; instead it
 validates all fields.  This is confirmed by verifying the
 functionality of the validates() function as well, which in turn calls
 invalidFields() without specifying specific fields for validation.

 if ($options['validate']  !$this-validates()) {
   $this-whitelist = $_whitelist;
   return false;
 }
 


--~--~-~--~~~---~--~~
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: Validating only specific fields within a model?

2008-05-19 Thread jonknee

 Does anyone have any insight on how to go about validating specific
 fields in a model for special circumstances like this?  Thanks!

We had a discussion that got into this topic recently:

http://groups.google.com/group/cake-php/browse_thread/thread/dc119a9b9cf4a89/5ef7b179de86f7a1#5ef7b179de86f7a1

There are a few ways to go, the easiest in your case is probably using
the 'on' key in your validation rules. You could also fetch the user's
data, modify it with the new password and then attempt to save the
whole thing back.

--~--~-~--~~~---~--~~
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: Enum radio buttons/select boxes and validation

2008-05-19 Thread Dianne van Dulken


Don't mind me, worked it out after I posted.

I needed to set _type_label and _gender_label.  Why, I don't know, but
it worked, and that is all I care about at this moment

(Anyone want to explain the reasons???)

cheers

Di
--~--~-~--~~~---~--~~
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: Reusing controller code for multiple instances of the same application

2008-05-19 Thread Jonathan Snook

 Here is the code from the router file:
Router::connect('/', array('controller' = 'pages', 'action'
 = 'display', 'home'));
Router::connect('/pages/*', array('controller' = 'pages',
 'action' = 'display'));
Router::connect('/jobtrack/*', array('controller' = 'jobs'));

I just thought of an alternative routing:

Router::connect('/jobtrack/:action/*', array('controller' = 'jobs'));

--~--~-~--~~~---~--~~
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: Email Component sends email with empty body

2008-05-19 Thread Brian Rojas

The most obvious problem would be that you aren't setting the Email-
template correctly.  This happened to me cause i misspelt the
template.  You should check that, also pls send code if that is not
problem so can investigate better.

On May 19, 8:54 pm, donnerbeil [EMAIL PROTECTED] wrote:
 Hi!

 I'm using the latest nightly so this is probably not the 
 case:https://trac.cakephp.org/ticket/3820

 But I still receive empty emails. The strangest part is, that it
 depends on the email provider. I have an email account at my own
 domain. I check the mails with Thunderbird (IMAP) and it works. Then I
 have an Email account at freenet.de, a popular email provider in
 germany. When I check the freenet account with thunderbird(Pop3) I get
 an empty email body. When I check the freenet account via the
 webinterface, I can read the body but it's not formatted correctly. It
 shows the headers then.

 I followed exactly the instructions 
 here:http://manual.cakephp.org/view/269/sending-a-basic-message

 I assume, that it has maybe something to do with utf8 encoding.
 Because when I check the freenet mail with Thunderbird and manually
 set the encoding for the mail  to utf8 in Thunderbird, then I can at
 least read the email, but still only with all the headers in it.

 I'm trying to fix this for over a week now. My whole web app is
 working, but I need to send an email with an activation code for the
 new users. So please help me fix this last issue.

 Thanks a lot for any help.

 Donnerbeil

--~--~-~--~~~---~--~~
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: Reusing controller code for multiple instances of the same application

2008-05-19 Thread Bruce

Jonathan,
You are a gem - that did the trick.

I will set all my internal app links to work that way and that will
overcome my problem I think.

--~--~-~--~~~---~--~~
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: Caching System with Language in the file name

2008-05-19 Thread robert123

hello,

I am not sure does this help, but I am able to get caching to work in
cakephp1.2 beta for my multilanguage site,

at the products_controller, there is a show action I put something
like this

 var $cacheAction = array('en_gb/products/show/' = '72 hour',
 'zh_tw/products/show/' = '72 hour')

in the products_controller file

and the file generated in   \tmp\cache\views folder is in the format

_en_gb_products_show_170.php

hence it will get the correct cache file

www.generics.ws
www.genericsmed.com


On May 17, 6:31 pm, francky06l [EMAIL PROTECTED] wrote:
 It seems yes, post a ticket on trac (unless it's already reported)..

 On May 17, 11:08 am, foxmask [EMAIL PROTECTED] wrote:

  i've done some tests and a simple one is in core.php :

 Cache::config('default', array('engine' = 'File',
   'path'=
  realpath(dirname(__FILE__) .DS.'..'.DS.'tmp'.DS.'cache'.DS.'fr'.DS)
   ));

  and when i look into my /home/foxmask/www/tmp/cache/fr/ directory (in
  views/persistent/models) everything is still empty.

  here it's clearly a bug...

  On 17 mai, 01:06, francky06l [EMAIL PROTECTED] wrote:

   I guess Config::language is available in beforeFiler, but not before.
   I never tried to override theCache::config('default...) in
   beforeFilter, but I do not see any reason this would not work..
   However, I am not sure if in case of a cached view,
   app_controller:beforeFilter is even reached...

   On May 17, 12:45 am, foxmask [EMAIL PROTECTED] wrote:

Hello,
i would like to avoid to change something inside cakephp .

i tried in the core.php file :
   Cache::config('default', array('engine' = 'File','path'=
dirname(__FILE__) 
.DS.'..'.DS.'tmp'.DS.'cache'.Configure::read('Config.language')));

but unfortunatly, Config.language is not set yet at this moment.

in app_controller.php in beforeRender Config.language is available
but i dont know if it's the right place to modify the
   Cache::config('default'.)

So, I really dont understand how a so simple thing cant work

Anyone get an idea ?

On 16 mai, 09:42, Filip Camerman [EMAIL PROTECTED] wrote:

 Hi,

 I've had the exact same problem: thecacheprefix that you can specify
 in the core config is not used for cached views - which is a major bug
 imo. I solved it by hacking the core in the places where it reads/
 writes cached views, since I absolutely needed this functionality.
 I've described how to do it in the second message of this 
 thread:http://groups.google.com/group/cake-php/browse_thread/thread/62b4d61b...

 hth
--~--~-~--~~~---~--~~
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: Multiple rule Validation causes Redirect to fail.

2008-05-19 Thread Mr-Yellow

hmmm ok so I increase memory limit via htaccess until I can redirect
with validation rules in with no error.

However soon as I add the Email component in it gives timeouts.
Somethings not right in the backend here, having trouble nailing it
down, but something broken surely.

-Ben


On May 20, 1:26 pm, Mr-Yellow [EMAIL PROTECTED] wrote:
 It could be purely memory related, if I take out rules one by one it
 reaches a point that it works regardless of what the rules actually
 are.

 So I guess the validation lib needs a bunch of optimisation work done
 on it, and I guess CakePHP on the whole is bound to use a crap-load of
 memory given how it stores/generates/loops such large arrays all the
 time (I just hope their pointers and not copied all the time).

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