Re: Routing with slugs.

2009-08-19 Thread Taff

Thanks for your help.

On Aug 18, 2:32 pm, Martin Westin martin.westin...@gmail.com wrote:
 You should be alright with something like:

 Router::connect('/optimised_category_name/*', array('controller' =
 'controller_from_cake', 'action' = 'view'));

 Anything beginning with desired controller name is routed to the view
 action. You would also need to add specific routes (above that one)
 for any edit, delete.. and so on.

 On Aug 18, 2:25 pm, Taff taff.law...@googlemail.com wrote:

  Hey Martin,

  thanks for the reply. That is currently how I have it working. My
  intention is to do away with the view part of the URL to all intensive
  purposes so that an call to

  controller/slug

  actually reroutes to controller/view/slug

  The other issue was that I have rerouted my controller from its
  original name to something a little more search engine friendly.

  controller_from_cake/view/4

  to

  optimised_category_name/optimised_page_name/

  I have no need to visit the frontends controller_from_cakes other
  methods (just the view).

  Thanks again
  Taff

  On Aug 18, 1:49 pm, Martin Westin martin.westin...@gmail.com wrote:

   I should also say that the routing bit is useful as a first line of
   defence against bad slugs.

   On Aug 18, 12:46 pm, Taff taff.law...@googlemail.com wrote:

After reading 
throughhttp://book.cakephp.org/view/46/Routes-Configuration
along withhttp://c7y.phparch.com/c/entry/1/art,cake-seoandpottering
around for quite some time, I have come to the conclusion that I need
some help. Here is the scenario:

I am rerouting a controllername to a different name that is SEO
friendlier:

Router::connect('/consulting/:action/*', array('controller' =
'consultingskills', 'action' = 'index'));

This works just fine, and I can now go to site/consulting/view/4 and
it will load the relevant information.

How would I go about routing to make a URL such as site/consulting/seo
redirect to site/consultingskills/view/4

whereby id 4 in the database has a slug called seo.

I found a random post with

Router::connect('/consultingskills/:slug',
        array('controller' = 'consultingskills', 'action' = 'view'),
        array('slug' = '[-_A-Za-z0-9]+')
        );

Can anyone walk me through what steps I need to take?
Thanks,
Taff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Data Formatting Errors

2009-08-19 Thread majna

http://groups.google.com/group/cake-php/browse_thread/thread/4f462c16187e9c99/96cc07bb376797b2?tvc=2#96cc07bb376797b2

On Aug 18, 5:10 pm, Andy and...@websitesthatdostuff.com wrote:
 Greetings, all,
      I'm working on a CMS based on CakePHP and I've been enjoying
 working with Cake so far. However, I'm having some issues saving
 information. My CMS has a normal post-oriented setup in which each
 post can be related to multiple tags and multiple categories. I've set
 up the associations correctly in the models and the views generated by
 Bake seem to work fine.

 However, I'm using a custom client and building my array inside the
 client. The client has the capability of adding new tags to each post,
 then saving the tags at the same time as the post. However, when I try
 to save all the data, it fails to save either the categories or the
 tags.

 Here's an example of the array that the client generates:

     [Post] = Array
         (
             [user_id] = 11
             [posted] = 2009-08-18 10:20:00
             [title] = This is a Great Post!
             [comments_allowed] = 1
             [media_id] = 1
             [slug] = this-is-a-great-post
             [seo_title] = SEO rocks.
             [status] = 1
             [created] = 2009-08-18 10:25:53
             [id] = 2
             [content] = whatever
         )

     [Category] = Array
         (
             [0] = Array
                 (
                     [id] = 1
                     [name] = Latest News
                     [slug] = news
                 )

             [1] = Array
                 (
                     [id] = 3
                     [name] = Stuff
                     [slug] = stuff
                 )

         )

     [Tag] = Array
         (
             [0] = Array
                 (
                     [id] = 3
                     [name] = college
                     [slug] = college
                 )

             [1] = Array
                 (
                     [name] = snap
                     [slug] = snap
                 )

             [2] = Array
                 (
                     [name] = fish
                     [slug] = fish
                 )

         )

 Right now I'm passing this into Cake and doing a saveAll() call. It
 saves the post correctly, but erases all related tags and categories.
 Would you all have any comments or suggestions on what I need to do to
 get this working correctly? Thanks for your time!

 ~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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Fulltext Index with schema console

2009-08-19 Thread PaSToReT

If you read my post, I said:

 I know that it is because of the key length is not specified in
the
 schema.php, but I don't know how to do it.

Of course, I have searched before. I know how to solve this problem in
mysql (adding the key length when you define the index), but I would
like to have a good executable schema.php for my migrations, and i
don't know how to add this parameter to it.

May be I'm not explaining so well... sorry... :(

Thank you anyway!

On Aug 18, 8:17 pm, brian bally.z...@gmail.com wrote:
 This is a MySQL issue. Did you search 
 first?http://www.google.ca/search?q=used+in+key+specification+without+a+key...

 On Tue, Aug 18, 2009 at 12:05 PM, PaSToReTpastor...@gmail.com wrote:

  Hi!

  I have this table in mysql:

  CREATE TABLE `search_index` (
   `id` int(11) NOT NULL auto_increment,
   `association_key` varchar(36) collate utf8_unicode_ci NOT NULL,
   `model` varchar(128) collate utf8_unicode_ci NOT NULL,
   `data` longtext collate utf8_unicode_ci NOT NULL,
   `created` datetime NOT NULL,
   `modified` datetime NOT NULL,
   PRIMARY KEY  (`id`),
   KEY `association_key` (`association_key`,`model`),
   FULLTEXT KEY `data` (`data`)
  ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
  COLLATE=utf8_unicode_ci;

  I have generated a schema.php with 'cake schema generate'.
  When I try to execute it ('cake schema run create') i get this error.

  search_index: 1170: BLOB/TEXT column 'data' used in key specification
  without a key length

  I know that it is because of the key length is not specified in the
  schema.php, but I don't know how to do it.

  Could anyone help me?

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



Re: webroot and htaccess

2009-08-19 Thread designvoid

I have tried duplicating the lines and removing the trailing slash and
also removing it from the existing lines but to no avail...

Any ideas?



On Aug 19, 3:55 am, brian bally.z...@gmail.com wrote:
 Just remove the trailing slash from the rule:

 RewriteCond %{REQUEST_URI} ^/forums(.*)$

 On Tue, Aug 18, 2009 at 8:02 PM,

 designv...@gmail.comdesignv...@gmail.com wrote:

  Hi there,

  I have some forums in my webroot and have added the following to my
  htaccess:

    RewriteCond %{REQUEST_URI} ^/forums/(.*)$
    RewriteRule ^.*$ - [L]

  And this is fine if I type:

   www.mydomain.com/forums/

  However if I dont put the trailing slash (www.mydomain.com/forums) I
  get redirected to:

   www.mydomain.com/app/webroot/forums/

  Can anyone help with a quick fix or suggestion?

  TIA

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



Re: Database Date/Time Functions?

2009-08-19 Thread rich...@home

or...

'conditions'=array(
Bar.created' = (NOW() - interval '7 days')
)

On Aug 19, 6:23 am, Elmo emre...@gmail.com wrote:
 I would like to use the built in database date/time functions as part
 of a 'conditions'. How is this done?

 i.e.: select foo from bar where created = (NOW() - interval '7
 days');

 I tried: 'conditions'=array('Bar.created' = = (NOW() - interval '7
 days')) to no avail.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Contains and conditions gives rather unexpected results

2009-08-19 Thread Martin Westin

Well the manual might be slightly misleading. The text states that
Containable can filter the associated data. It is the example output
that is wrong (AFAIK), showing data as from a join.

Containable does nothing more than filter the returned data, model
for model. It does not mimic joins. I am not saying this is a fault or
a shortcoming of Containable... it is just the way it is designed and
it does it's job well.

We answered a question yesterday, giving the exact example of Posts
and Comments... funny. It is here, along with links to some code and
articles showing how to set up something like Joinable.
http://groups.google.com/group/cake-php/browse_thread/thread/43b4a9fcc18cf442

The alternative is to do some array-looping in php to remove unwanted
results. This is fine for small datasets but gets very slow when you
get up into thousands of results.

/Martin


On Aug 18, 7:55 pm, channel5 edd.daw...@comptonsolutions.com wrote:
 Hi All

 I am working through examples of containable and applying conditions
 to the results.

 I have a basic blog example running, where Posts can have many
 comments.

 I'm trying to use contain with conditions so I can pick out only posts
 that have been commented on by a particular user.

 Here is my test function from my controller:

         function test() {
                 $result =  $this-Post-find('all',array('contain' = 
 'Comment.name
 = Howard'));
                 debug($result);
         }

 I would expect the debug output in my view to only contain Posts which
 user Howard has commented on.. however here are the results I get:

 Array
 (
     [0] = Array
         (
             [Post] = Array
                 (
                     [id] = 1
                     [name] = First post
                     [date] = 2009-08-13 15:01:00
                     [content] = This is our first blog post, how
 exciting.
                     [user_id] = 1
                 )

             [Comment] = Array
                 (
                     [0] = Array
                         (
                             [id] = 1
                             [name] = Howard
                             [content] = Lovely post, really lovely
 post.
                             [post_id] = 1
                         )

                 )

         )

     [1] = Array
         (
             [Post] = Array
                 (
                     [id] = 2
                     [name] = Our second post
                     [date] = 2009-08-14 10:11:00
                     [content] = Our second post
                     [user_id] = 1
                 )

             [Comment] = Array
                 (
                 )

         )

 So as you can see it is still returning ALL posts yet only attaching
 comments if they were made by Howard.

 This isn't the behaviour I was expecting, as the example code shown 
 athttp://book.cakephp.org/view/474/Containableclaims it should exclude
 all Posts without comments by the specified user.

 I am hoping someone can point me in the right direction here.

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



Re: Strange contain/find issue

2009-08-19 Thread delocalizer

I experienced something similar a while ago and logged this -
https://trac.cakephp.org/ticket/6268
Nate's reply was (quite correctly) that I should write a test case to
prove/disprove.
4 months later  I still haven't done it :(
My lazy solution: refactor my code until it went away! (No excuse
really, but I was busy... and I can't even remember now what changes I
made)
@MonkeyGirl: got time to write a tc? Your relationship context looks a
bit simpler than the one I had...


On Aug 18, 10:31 pm, MonkeyGirl z...@monkeehouse.com wrote:
 I believe this may be the same issue I'm experiencing.  After a bit of
 investigation, I've found out the issue is that specifying contain
 would appear to affect things in subsequent queries.

 For example, say I have Cart hasMany CartedProduct belongsTo Product
 belongsTo Brand.  Product also belongsTo VatRate.  (In other words,
 CartedProduct is a linking table between Cart and Product.  It has a
 quantity column, hence I'm not using hABTM.)  I might have a piece of
 code like this, in a method of the Cart model:

 // This is fine.  It displays products along with their brand.
 $products = $this-CartedProduct-Product-find('all', array(
   'contain' = array(
     'Brand'
   )
 ));

 pr($products);

 // This causes issues
 $ignore = $this-find('first', array(
   'conditions' = array(
     'Cart.id' = $cartID
   ),
   'contain' = array(
     'CartedProduct.Product.VatRate' = array(
       'fields' = array(
         'percentage'
       )
     )
   )
 ));

 // This is now broken.  The brand is no longer displayed.
 $products = $this-CartedProduct-Product-find('all', array(
   'contain' = array(
     'Brand'
   )
 ));

 pr($products);

 There are a few interesting things to note here:

 Product is now broken, even though the query that broke it was
 performed on Cart.

 If I contain 'CartedProduct.Product.VatRate' then it's fine, but as
 soon as I get as far as specifying its field, in this case
 percentage, it breaks.  This is regardless of whether I specify
 'CartedProduct.Product.VatRate.percentage' or use the proper array-
 based method above.

 By breaking, I specifically mean that any subsequent queries
 regarding products will only show data that meet the contain criteria
 above as well as any new contain criteria.

 I would expect this from unbindModel() if I was telling it to remember
 the unbinding, but I wouldn't expect it from a contain argument passed
 to find().

 I've checked, and yes, Product does still belongTo both Brand and
 VatRate after the query.  A pr() of $this-CartedProduct-Product and
 of $this (the Cart) show that both are identical before and after the
 troublesome query.

 Before anyone asks, I'm using CakePHP version 8166.

 I've implemented a temporary workaround: because I know I want Brand
 in a subsequent query, I'm including it in the contain in the query
 that breaks the subsequent ones.  However, that's not a viable long-
 term solution as I'm concerned that I may have some other piece of
 code somewhere that thinks it's pulling out important data that it now
 isn't.

 Is this a bug?  should I go ahead and report 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Contain() or INNER JOIN

2009-08-19 Thread Long

Greetings!

I have 3 models:

jobs hasMany job_comments
job_comments belongsTo jobs

Site-Job-JobComment

Help me please to find works on a site which have 'trouble' comments

$this-Site-find( 'all', array (  'fields'= array('Site.id'),
'conditions' = array
('Site.id' = 3),
'contain' = array (
'Job' = array(
'conditions'
= array ('Job.site_id' = 3),
'JobComment'
= array (
'fields' =
array ('JobComment.comment'),
 
'conditions' = array (
 
'JobComment.trouble' = 1
 )
   )
 )
   )
)
));

...It doesn't work good.
I no need all Jobs on site. I need only Jobs which have
JobComment.trouble = 1

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



Re: Contain() or INNER JOIN

2009-08-19 Thread Long
Update:

3 models:
sites hasMany jobs
jobs belongsTo sites

jobs hasMany job_comments
job_comments belongsTo jobs

Site-Job-JobComment

$this-Site-find( 'all',
array('fields'=array('Site.id'),
'conditions' =array(
'Site.id' = 3),
'contain' = array (
'Job' = array(
 'conditions' = array (
 'Job.site_id' = 3),
 'JobComment' = array (
  'fields' = array (
  'JobComment.comment'),
  'conditions' = array (
  'JobComment.trouble' = 1
)
  )
)
  )
)
));


On 19 авг, 16:17, Long longma...@gmail.com wrote:
 Greetings!

 I have 3 models:

 jobs hasMany job_comments
 job_comments belongsTo jobs

 Site-Job-JobComment

 Help me please to find works on a site which have 'trouble' comments

 $this-Site-find( 'all', array (  'fields'    = array('Site.id'),
                                             'conditions' = array
 ('Site.id' = 3),
                                             'contain' = array (
                                             'Job' = array(
                                                         'conditions'
 = array ('Job.site_id' = 3),
                                                         'JobComment'
 = array (
                                                         'fields' =
 array ('JobComment.comment'),

 'conditions' = array (

 'JobComment.trouble' = 1
                                                                          )
                                                                )
                                                          )
                                                    )
                                             )
                                         ));

 ...It doesn't work good.
 I no need all Jobs on site. I need only Jobs which have
 JobComment.trouble = 1

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



related to Session-setFlash

2009-08-19 Thread Chander Bhan

I always get the digit 1 in the next line of the message sent through
Session-setFlash from controller, need help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Best way to pass parameter to application

2009-08-19 Thread simplesi


Last year I learnt PHP and wrote a ICT helpdesk for some small schools that
I'd like to redo using CakePHP.

Previously each school used a url e.g
http://www.school.com/helpdesk/?vsh_place=NameofSchool to pre-select their
school in the database.

I believe I should pass the school name using a url but I'm not sure
whether/how to collect it in the controller and then pass it onto my add
view (which is the view my users will use) or is it OK to directly collect
it in my view e.g http://www.school.com/helpdesk/view/NameofSchool 

Just want to do it the proper CakePHP way :)

regards

Simon

-- 
View this message in context: 
http://www.nabble.com/Best-way-to-pass-parameter-to-application-tp25043152p25043152.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: If Auth isAuthorize() == false, how to redirect user?

2009-08-19 Thread Bert Van den Brande

Not entirely sure but I think it's loginAction you need :
http://book.cakephp.org/view/248/AuthComponent-Variables

On Wed, Aug 19, 2009 at 5:42 AM, zotiumzot...@gmail.com wrote:

 When using the Auth-Authorize = 'controller' method of authorization,
 and isAuthorized() returns false, how do you set the URL where the
 user gets redirected?
 


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



Re: Contain() or INNER JOIN

2009-08-19 Thread Martin Westin
You are right (in the subject), you need a join.
You can force Cake to do joins if you build something like what Nate
wrote about in january:

http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

I took some ideas from that and made a joining feature that would join
models for me when needed, using a very similar syntax to Containable
(often interchangeable).

http://bin.cakephp.org/saved/49446

I have linked to these before (twice in the last 24hrs). I am not
doing it to spam the group, honestly.

http://groups.google.com/group/cake-php/browse_thread/thread/3e6644c906fbc656
http://groups.google.com/group/cake-php/browse_thread/thread/43b4a9fcc18cf442

hope you find it useful.


On Aug 19, 2:26 pm, Long longma...@gmail.com wrote:
 Update:

 3 models:
 sites hasMany jobs
 jobs belongsTo sites

 jobs hasMany job_comments
 job_comments belongsTo jobs

 Site-Job-JobComment

 $this-Site-find( 'all',
 array('fields'=array('Site.id'),
     'conditions' =array(
         'Site.id' = 3),
     'contain' = array (
         'Job' = array(
              'conditions' = array (
                  'Job.site_id' = 3),
                  'JobComment' = array (
                       'fields' = array (
                           'JobComment.comment'),
                       'conditions' = array (
                           'JobComment.trouble' = 1
                                                     )
                                                   )
                                                 )
                                               )
                                             )
                                         ));

 On 19 авг, 16:17, Long longma...@gmail.com wrote:



  Greetings!

  I have 3 models:

  jobs hasMany job_comments
  job_comments belongsTo jobs

  Site-Job-JobComment

  Help me please to find works on a site which have 'trouble' comments

  $this-Site-find( 'all', array (  'fields'    = array('Site.id'),
                                              'conditions' = array
  ('Site.id' = 3),
                                              'contain' = array (
                                              'Job' = array(
                                                          'conditions'
  = array ('Job.site_id' = 3),
                                                          'JobComment'
  = array (
                                                          'fields' =
  array ('JobComment.comment'),

  'conditions' = array (

  'JobComment.trouble' = 1
                                                                           )
                                                                 )
                                                           )
                                                     )
                                              )
                                          ));

  ...It doesn't work good.
  I no need all Jobs on site. I need only Jobs which have
  JobComment.trouble = 1

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



Re: Contain() or INNER JOIN

2009-08-19 Thread Long
Thanks for the reply

I have changed my app_model.php to (http://bakery.cakephp.org/articles/
view/quick-tip-doing-ad-hoc-joins-in-model-find) code.
How can i use the new FIND() method?

$this-Site-find ('matches', array (
  'model' = array ('Job'),
   'scope' = array (
  'Area'  = array ('Site.id'  = 3),
  )
   )
);

Isn't it?

On 19 авг, 17:02, Martin Westin martin.westin...@gmail.com wrote:
 You are right (in the subject), you need a join.
 You can force Cake to do joins if you build something like what Nate
 wrote about in january:

 http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-...

 I took some ideas from that and made a joining feature that would join
 models for me when needed, using a very similar syntax to Containable
 (often interchangeable).

 http://bin.cakephp.org/saved/49446

 I have linked to these before (twice in the last 24hrs). I am not
 doing it to spam the group, honestly.

 http://groups.google.com/group/cake-php/browse_thread/thread/3e6644c9...http://groups.google.com/group/cake-php/browse_thread/thread/43b4a9fc...

 hope you find it useful.

 On Aug 19, 2:26 pm, Long longma...@gmail.com wrote:



  Update:

  3 models:
  sites hasMany jobs
  jobs belongsTo sites

  jobs hasMany job_comments
  job_comments belongsTo jobs

  Site-Job-JobComment

  $this-Site-find( 'all',
  array('fields'=array('Site.id'),
      'conditions' =array(
          'Site.id' = 3),
      'contain' = array (
          'Job' = array(
               'conditions' = array (
                   'Job.site_id' = 3),
                   'JobComment' = array (
                        'fields' = array (
                            'JobComment.comment'),
                        'conditions' = array (
                            'JobComment.trouble' = 1
                                                      )
                                                    )
                                                  )
                                                )
                                              )
                                          ));

  On 19 авг, 16:17, Long longma...@gmail.com wrote:

   Greetings!

   I have 3 models:

   jobs hasMany job_comments
   job_comments belongsTo jobs

   Site-Job-JobComment

   Help me please to find works on a site which have 'trouble' comments

   $this-Site-find( 'all', array (  'fields'    = array('Site.id'),
                                               'conditions' = array
   ('Site.id' = 3),
                                               'contain' = array (
                                               'Job' = array(
                                                           'conditions'
   = array ('Job.site_id' = 3),
                                                           'JobComment'
   = array (
                                                           'fields' =
   array ('JobComment.comment'),

   'conditions' = array (

   'JobComment.trouble' = 1
                                                                            )
                                                                  )
                                                            )
                                                      )
                                               )
                                           ));

   ...It doesn't work good.
   I no need all Jobs on site. I need only Jobs which have
   JobComment.trouble = 1

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



Re: related to Session-setFlash

2009-08-19 Thread Marcelo Andrade

On Wed, Aug 19, 2009 at 9:27 AM, Chander Bhangotob...@gmail.com wrote:

 I always get the digit 1 in the next line of the message sent through
 Session-setFlash from controller, need help

Are you echoing the Session-setFlash() call from the controller?

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: auto guest login .. Auth

2009-08-19 Thread Brendon Kozlowski (Realm)

You wouldn't set an auto-login, you simply would not deny access to
whatever action(s) you wish them to have access to.

On Aug 19, 12:48 am, Marojahan M.T. Sigiro maroja...@gmail.com
wrote:
 with Auth.. what should i do to create auto login mechanism for certain user
 (e.g. guest)

 anybody has an idea? since i'm still a newbie with cake

 Thankyou

 --
 ---
 I Don't Know Who/What I Am Yet, But I Know Who/What I Am Not!
 --
 Marojahan M.T. Sigiro
 maroja...@gmail.com
 GTalk : marojahan
 Y! : ojak_shttp://ojakaja.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n

2009-08-19 Thread RhythmicDevil

Thanks Marcelo. I will do as you suggested.

On Aug 18, 6:38 pm, Marcelo Andrade mfandr...@gmail.com wrote:
 On Tue, Aug 18, 2009 at 12:30 PM, RhythmicDevilrhythmicde...@gmail.com 
 wrote:

 (..)
  From what I have read I gather that I wrap all my strings in my views
  with __(). Create language directories in /app/locale like the
  following:
  /app/locale/
               eng/
                    LC_MESSAGES/
                en_GB/
                    LC_MESSAGES/
  Then I go to the console and run $cakei18n. I give that the path
  where the files I want to extract reside and then give it the path
  where I want it output the files. The paths I used were:

  /home/swright/vhosts/solowsc/app/views
  /home/swright/vhosts/solowsc/app/locale

  This created a file called default.pot in the following location:
  /home/swright/vhosts/solowsc/app/locale

 You have to put the .po files into the LC_MESSAGES
 directory for each language.

  Thats about as far as I get. I have no idea what to do with the
  created file. Where do the .po and .mo files come in? Do I have to
  create them? I also would have thought that the output path should
  have been a particular language directory. I get the impression from
  what I have read that the translation and file creation is an
  automated process, is that correct?

 All you have to do to create the files is enclose youri18nstring messages 
 with the __() function.  Then,
 running cakei18nfrom console, you'll have a default
 language version .po file.  Then copy it to the other
 LC_MESSAGES language directory and make the
 translations (with poEdit or a plain text editor).

 CakePHP uses the .po files to generate (compile) the
 .mo files internally.  You don't have to deal with it.

  I have a basic test working but the files are hand created and I dont
  think thats the correct way to do it. I would really appreciate if
  someone could fill in the holes with, perhaps, a set of detailed steps
  what will work for CakePHP1.2.

 Well...  I did ani18napplication with Cake sometime
 ago and I didn't dive into problems.  It was an easy
 job.  Check this tips and read the cookboo too and
 tell us if you're still getting into problems.

 http://book.cakephp.org/view/161/Internationalization-Localization

 Best regards.

 --
 MARCELO DE F. ANDRADE
 Belem, PA, Amazonia, Brazil
 Linux User #221105

 http://mfandrade.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Security component in older CakePHP version

2009-08-19 Thread andphe

Hi there,

I have a website running a old version of cakePHP (1.1.19.6305), the
fact is that the security component blackhole some legitimate
requests, I traced the issue where it compares the age of the _token
session variable with the current time, anyways...

I would like to try the latest 1.1 release of cakePHP but it seems
that is not possible to download it from the cake forge, is there any
alternative place for old downloads ?

Thank,

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



Re: webroot and htaccess

2009-08-19 Thread Jamie

You just need to make the forward slash optional in the regular
expression. So this:

RewriteCond %{REQUEST_URI} ^/forums/(.*)$

Becomes this:

RewriteCond %{REQUEST_URI} ^/forums/?(.*)$

The question mark after the slash makes it optional.

- Jamie

On Aug 19, 1:13 am, designvoid designv...@gmail.com wrote:
 I have tried duplicating the lines and removing the trailing slash and
 also removing it from the existing lines but to no avail...

 Any ideas?

 On Aug 19, 3:55 am, brian bally.z...@gmail.com wrote:

  Just remove the trailing slash from the rule:

  RewriteCond %{REQUEST_URI} ^/forums(.*)$

  On Tue, Aug 18, 2009 at 8:02 PM,

  designv...@gmail.comdesignv...@gmail.com wrote:

   Hi there,

   I have some forums in my webroot and have added the following to my
   htaccess:

     RewriteCond %{REQUEST_URI} ^/forums/(.*)$
     RewriteRule ^.*$ - [L]

   And this is fine if I type:

    www.mydomain.com/forums/

   However if I dont put the trailing slash (www.mydomain.com/forums) I
   get redirected to:

    www.mydomain.com/app/webroot/forums/

   Can anyone help with a quick fix or suggestion?

   TIA

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



Using Render() in Component-startup()

2009-08-19 Thread ZYP

Hi, I'm new here :)

I'm trying to create web service in CakePHP but I have some problem.
First of all I would like you to look at this ...
http://bakery.cakephp.org/articles/view/soap-services-in-cakephp

I followed this article to make web service. And please browse to page
3 and scroll down you can see Component class extends. Please look
at Component-startup() their is a line that call Render().

The problem is when it came to display in browser, something wrong so
in the browser there's nothing to see! ... but if I change to another
way to Render() without using Component (place Render() directly
in controller) it's fine : I can see XML file smoothly.

So I don't understand why :(
If someone can help I'm really love you a lot :)

Thanks
ZYP

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



Re: related to Session-setFlash

2009-08-19 Thread zaboo

Don't echo $this-Session-setFlash()

On Aug 19, 8:27 am, Chander Bhan gotob...@gmail.com wrote:
 I always get the digit 1 in the next line of the message sent through
 Session-setFlash from controller, need help

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



Using Render() in Component-startup()

2009-08-19 Thread ZYP

I have a problem I want to render WSDL file in browser in order to
make is for web service.
I looked at this page as tutorial - 
http://bakery.cakephp.org/articles/view/soap-services-in-cakephp

In page 3 the writer showed how to Render() from his Component, my
problem this way didn't work.
If I placed Render() directly to Controller it worked, but if I did
like him, it didn't work.

So if anyone have any idea, that would be nice :)
Thanks
ZYP

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



Re: Possible, saving null with saveField?

2009-08-19 Thread viktor

you could try
Model-saveField('fieldName', 'NULL');

On Aug 18, 10:00 am, Martin Westin martin.westin...@gmail.com wrote:
 Hi,
 I would prefer to be abel to use saveField for a simple ajax inline-
 edit functionality. Setting a value is fine, clearing out the field
 does not apear to work. I can't seem to call Model-saveField
 ('fieldname',null) or even pass an empty string.

 Am I doing something wrong or is it just not possible, and I should do
 a normal save?

 /Martin

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



Problems with print_r

2009-08-19 Thread Gildonei Mendes A. (Junior)

  Hello,

I'm using cake to develop a great LMS tool.
When I try to use  print_r($this) , I don't receive any response,
only a blank page.

Somebody knows if it's a PHP Problem or a Cake Problem ?

Thank's a lot

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



Re: How i can use after properties in textarea.

2009-08-19 Thread Travis L

Just testing this, and it seems to work.  Try:

?php echo $form-input('name',array('type' = 'textarea',
'label'='name','after'='Must be 6 character')); ?

Just add the type = textarea and it worked OK for me.

On Aug 18, 2:56 am, arif hossen arifhossen2...@gmail.com wrote:
 Dear all,

 How i can use after properties in textarea.

 such as :below textfield after properties
 echo $form-input('name',array('label'='name','after'='Must be 6
 character'));

 i need used it textarea field.
 --

 Regards,
 Mohammad Arif Hossen
 Web Developer
 United Group International(UGIBD)www.ugibd.net
 Mobile no:  +88 01714355911
 Mobile no:  +88 01922110308
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions and Redirect

2009-08-19 Thread Jukai

Dear All
I have same problem with LS,
The Session didn't save anything when redirect, it means Auth didnt
work!!,
i think there is some configure nedeed but i dont know what, i was
waste a week for this same problem...
HELP!!!

best regard

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



Re: Problems with print_r

2009-08-19 Thread Martin Westin

That should work even though inside a Cake app you should use debug
($this) for some extra features. (like the debug not printing when you
set the app in production mode)

var_dump($this) is another one you can try. If none of them work you
are in trouble :)


On Aug 19, 4:02 pm, Gildonei Mendes A. (Junior) anjol...@gmail.com
wrote:
   Hello,

 I'm using cake to develop a great LMS tool.
 When I try to use  print_r($this) , I don't receive any response,
 only a blank page.

 Somebody knows if it's a PHP Problem or a Cake Problem ?

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



Re: Inflector and compound names

2009-08-19 Thread jordicakephp

Sorry...

Maybe I should have been even more specific (because of the language).
My table's name is sede_uves (the compound name), my controller's name
is SedeUvesController and my model's name is SedeUve. I would like to
define a rule for Cake to deduce SedeUve (the name of the model) from
sede_uves (the name of the table). Sorry again and thanks a lot.

On 19 ago, 19:06, jordicakephp jordicake...@gmail.com wrote:
 Good afternoon everybody,

 I'm trying to define a new rule of type singular-plural so that
 CakePHP joins magically the table and the model names that these rule
 refers to. More specifically, I go to inflections.php and write:

 $irregularPlural = array('sedeuve', 'sedeuves');

 But this doesn't work because my table, sede_uves, is a compound noun.
 I've worked before in this way, with simple nouns, and everything has
 gone ok, but now, with a compound name, this doesn't work... Could
 somebody give me a clue to solve this? Thanks a lot in advance! :-D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Security component in older CakePHP version

2009-08-19 Thread majna

https://svn.cakephp.org/repo/trunk/cake/1.1.x.x/
if you need zip version, email me.

On Aug 19, 4:26 pm, andphe and...@gmail.com wrote:
 Hi there,

 I have a website running a old version of cakePHP (1.1.19.6305), the
 fact is that the security component blackhole some legitimate
 requests, I traced the issue where it compares the age of the _token
 session variable with the current time, anyways...

 I would like to try the latest 1.1 release of cakePHP but it seems
 that is not possible to download it from the cake forge, is there any
 alternative place for old downloads ?

 Thank,

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



Re: Problems with print_r

2009-08-19 Thread Brendon Kozlowski (Realm)

If for some reason the $this variable isn't populated or doesn't exist
(which as Martin said, you are in trouble if this is the case),
print_r won't do anything.  Try setting debug to 1 (or 2)...does the
app show anything without print_r($this)?

On Aug 19, 12:38 pm, Martin Westin martin.westin...@gmail.com wrote:
 That should work even though inside a Cake app you should use debug
 ($this) for some extra features. (like the debug not printing when you
 set the app in production mode)

 var_dump($this) is another one you can try. If none of them work you
 are in trouble :)

 On Aug 19, 4:02 pm, Gildonei Mendes A. (Junior) anjol...@gmail.com
 wrote:



    Hello,

  I'm using cake to develop a great LMS tool.
  When I try to use  print_r($this) , I don't receive any response,
  only a blank page.

  Somebody knows if it's a PHP Problem or a Cake Problem ?

  Thank's a lot- Hide quoted text -

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



Re: Data Formatting Errors

2009-08-19 Thread Andy

Great! Thanks for that. The stuff in the article helped with the
saving of the Categories, which had already been created in the
database.

However, in the case of the Tags, most of the records in the array did
not exist in the database. It was not working with either the saveAll
() function or associating the Post ID with the tags and then saving.
What I did was go through the Tags individually and save them before
saving the Post, to which I just passed the array of Tag IDs. Is there
a better way to do this?

Thanks again!

On Aug 19, 3:15 am, majna majna...@gmail.com wrote:
 http://groups.google.com/group/cake-php/browse_thread/thread/4f462c16...

 On Aug 18, 5:10 pm, Andy and...@websitesthatdostuff.com wrote:



  Greetings, all,
       I'm working on a CMS based on CakePHP and I've been enjoying
  working with Cake so far. However, I'm having some issues saving
  information. My CMS has a normal post-oriented setup in which each
  post can be related to multiple tags and multiple categories. I've set
  up the associations correctly in the models and the views generated by
  Bake seem to work fine.

  However, I'm using a custom client and building my array inside the
  client. The client has the capability of adding new tags to each post,
  then saving the tags at the same time as the post. However, when I try
  to save all the data, it fails to save either the categories or the
  tags.

  Here's an example of the array that the client generates:

      [Post] = Array
          (
              [user_id] = 11
              [posted] = 2009-08-18 10:20:00
              [title] = This is a Great Post!
              [comments_allowed] = 1
              [media_id] = 1
              [slug] = this-is-a-great-post
              [seo_title] = SEO rocks.
              [status] = 1
              [created] = 2009-08-18 10:25:53
              [id] = 2
              [content] = whatever
          )

      [Category] = Array
          (
              [0] = Array
                  (
                      [id] = 1
                      [name] = Latest News
                      [slug] = news
                  )

              [1] = Array
                  (
                      [id] = 3
                      [name] = Stuff
                      [slug] = stuff
                  )

          )

      [Tag] = Array
          (
              [0] = Array
                  (
                      [id] = 3
                      [name] = college
                      [slug] = college
                  )

              [1] = Array
                  (
                      [name] = snap
                      [slug] = snap
                  )

              [2] = Array
                  (
                      [name] = fish
                      [slug] = fish
                  )

          )

  Right now I'm passing this into Cake and doing a saveAll() call. It
  saves the post correctly, but erases all related tags and categories.
  Would you all have any comments or suggestions on what I need to do to
  get this working correctly? Thanks for your time!

  ~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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Need advice on testing

2009-08-19 Thread Zac Tolley

I'm currently developer a set of test cases for an app I'm working on.
I've read though the docs on creating tests, and have created a set of
unit tests for my model, allowing me to make confirm that my model can
save, find, update, count data and confirm relationships between
tables work.

Now I'm moving onto my controllers. Some of my controller functions
gather data and then use the $this-set method to set variable and
then I've got a simple thing to turn those into json. Those functions
are easy to test as I can just use something like:

$data = array('query' = 'Test');
$result = $this-testAction('/accounts/accountDropDown', array(
'return' = 'vars',
'method' = 'get',
'url' = $data)
);
$this-assertEqual($result['accounts'][0]['name'], 'Test 
Account');

But I'm a little stuck on some of the more common things, like the
edit function. In edit I will need to test that it retrieves the
correct data as well as saving it. For the retrieving data I figured 2
sets of tests. One to confirm that the function gets the correct ID
from the URL and gathers the correct record from the model. The second
one I kinda want to test that the page rendered is correct but that
could be a big job.

So 2 questions:

1. I want to test that my function gets the correct data, but it
doesn't use $this-('key',value), it uses something more like $this-
data = $this-Account-findById($id); , so how do I get the $this-
data value from within my test case so I can run an assert on it? it
I just use the return=vars method and debug($result) then result is an
empty array.

2. Any advice on how to test the rendered html? I've use JSUnitTest in
the past and my website uses YUI so I'm going to investigate YUI's
unit testing for the client side code, is there something that maybe
lets me do asserts to see if html elements exist, and to also get the
value for fields? Should I be trying to write the unit tests for this
on the server or client side?


I know this may all seem a little OTT writing so much testing , but
I've started using a TDD approach for some other projects I'm working
on and found it to be very effective.

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



saveAll with a hasMany relationship

2009-08-19 Thread Nancy

I was so happy.  I finally figured out how to make saveAll work with
my HABTM relationship so I figured adding a hasMany would be a piece
of cake.  I have a little practice data structure set up to test it
out.

$save[1]['Constoptvalue']['device_id'] = 16;
$save[1]['Constoptvalue']['constopt_id'] = 1;
$save[1]['Constoptvalue']['valid'] = 1;
$save[1]['Layer'][0]['layer_id']=4;
$save[1]['Layer'][1]['layer_id']=2;
$save[1]['Layer'][2]['layer_id']=3;

This works brilliantly.  So then I add in my hasMany data:
$save[1]['Cotest'][0]['symbol']='buggers';

And do my saveall:
$this-Constoptvalue-saveAll($save);

Everything works, except Cotest.  I can tell the relationship is
defined well, I get the proper data when I read my Constoptvalue
structure.

Any ideas?  Darn, I thought I had this nailed finally.

Thanks all.


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



Re: saveAll with a hasMany relationship

2009-08-19 Thread Nancy

I just wanted to add, I'm saving multiple records at a time.  So $this-
data might have an index going up to 5 or so with models for 3 or
more different things.

I did manage to get a hasMany to work, but not with multiple records.

$save['Firstname']['firstname']='Margarie';
$save['Nickname'][0]['nickname'] = 'Margy';
$this-Firstname-saveAll($save);

That worked, but what if I want to save 3 different firstname/nickname
pairs at a time?


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



Autocomplete not working when created on the fly

2009-08-19 Thread alejandro.lopez.hernan...@gmail.com

Hello guys,

I have the following scenario: I have a set of input fields that need
to be cloned as requested in order to add more records of a single
model, this is my view code:

div id=productos0 style=display:block;
?php echo $form-input(FacturaDetalle.producto_id, 
array('div'
= '', 'type' = 'hidden', 'name' = data[FacturaDetalle][0]
[producto_id])) ?
?php echo $form-input(FacturaDetalle.cantidad, 
array('div' =
'', 'label' = 'Cantidad','name' = data[FacturaDetalle][0]
[cantidad], 'size' = '3', 'onChange' = calcularImporte(this.value,
document.getElementById('FacturaDetallePrecioUnitario').value,
'FacturaDetalleImporte'))); ?
?php echo $form-label
('FacturaDetalle.producto_codigo','Clave'); ?
?php echo $ajax-autocomplete('FacturaDetalle.producto_codigo',
'/productos/seleccionar', array('size' = 5, 'afterUpdateElement' =
'getProductId'));?
?php echo $ajax-ObserveField('FacturaDetalleProductoId', array
('url' = '/facturas/agregarProducto', 'update' = 'productos0',
'frequency' = 1, 'with' = Form.Element.serialize
('FacturaDetalleProductoId')+''+Form.Element.serialize
('FacturaDetalleCantidad')));?
?php //echo 
$form-input('FacturaDetalle.producto_codigo', array
('div' = '','label' = 'Clave', 'name' = data[FacturaDetalle][0]
[producto_codigo], 'size' = 5, 'afterUpdateElement' =
'getProductId'));?
?php echo $form-input(FacturaDetalle.concepto, 
array('div' =
'', 'label' = 'Concepto','name' = data[FacturaDetalle][0]
[concepto], 'size' = '30')); ?
?php echo 
$form-input(FacturaDetalle.precio_unitario, array
('div' = '', 'label' = 'P.U. small(con I.V.A.)/small','name' =
data[FacturaDetalle][0][precio_unitario], 'size' = '6', 'onChange'
= calcularImporte(document.getElementById
('FacturaDetalleCantidad').value, this.value,
'FacturaDetalleImporte'))); ?
?php echo $form-input(FacturaDetalle.importe, 
array('div' =
'', 'label' = 'Importe','name' = data[FacturaDetalle][0][importe],
'size' = '6')); ?
?php echo $form-button('+', array('onclick' = 
addRow())); ?
?php echo $form-button('-', array('onclick' =
'this.parentNode.parentNode.removeChild(this.parentNode);'));?

/div
span id=writeroot/span

If I click on + button, all the form fields are cloned using
javascript, this is the code of addRow function:

function addRow() {
counter++;
var newRows = document.getElementById('productos0').cloneNode
(true);
newRows.style.display = 'block';
newRows.id = 'productos' + counter;
var newRow = newRows.childNodes;
for(var i=0;inewRow.length;i++) {
if(newRow[i].nodeName == 'SCRIPT') {
var html = newRow[i].innerHTML;
html = html.replace(/FacturaDetalleProductoCodigo/,
FacturaDetalleProductoCodigo + counter);
html = 
html.replace(/FacturaDetalleProductoCodigo_autoComplete/,
FacturaDetalleProductoCodigo_autoComplete + counter);
html = html.replace(/FacturaDetalleProductoId/g,
FacturaDetalleProductoId + counter);
html = html.replace(/FacturaDetalleCantidad/,
FacturaDetalleCantidad + counter);
html = html.replace(/productos0/g, productos + 
counter);
newRow[i].innerHTML = html;
}
var domid = newRow[i].id;
var name = newRow[i].name;
if(domid) {
if(domid == FacturaDetalleCantidad){
newOnChange = 
newRow[i].attributes.onchange.value;
newOnChange = 
newOnChange.replace(/FacturaDetalleImporte/g,
FacturaDetalleImporte + counter);
newRow[i].attributes.onchange.value = 
newOnChange.replace(/
FacturaDetallePrecioUnitario/g, FacturaDetallePrecioUnitario +
counter);
//  alert(newRow[i].attributes.onchange.value);
}
else if(domid == FacturaDetallePrecioUnitario){
newOnChange = 
newRow[i].attributes.onchange.value;
newOnChange = 
newOnChange.replace(/FacturaDetalleImporte/g,
FacturaDetalleImporte + counter);
newRow[i].attributes.onchange.value = 
newOnChange.replace(/
FacturaDetalleCantidad/g, FacturaDetalleCantidad + counter);
//  alert(newRow[i].attributes.onchange.value);
}
newRow[i].id = domid + counter;
}
if(name)
newRow[i].name = name.replace(/[0]/, counter);
}
var insertHere = document.getElementById('writeroot');

Re: Database Date/Time Functions?

2009-08-19 Thread Dr. Loboto

Actually you messed quotes:

'conditions' = array(
Bar.created = NOW() - INTERVAL 7 DAY
)

(valid for MySQL, don't know about others)

On Aug 19, 3:34 pm, rich...@home richardath...@gmail.com wrote:
 or...

 'conditions'=array(
     Bar.created' = (NOW() - interval '7 days')
 )

 On Aug 19, 6:23 am, Elmo emre...@gmail.com wrote:



  I would like to use the built in database date/time functions as part
  of a 'conditions'. How is this done?

  i.e.: select foo from bar where created = (NOW() - interval '7
  days');

  I tried: 'conditions'=array('Bar.created' = = (NOW() - interval '7
  days')) to no avail.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using Render() in Component-startup()

2009-08-19 Thread Dr. Loboto

Set debug to at least 1 to see actual error. Check that in component
you call $this-controller-render() ( NOT  $this-render() ). Check
this call params.

On Aug 19, 3:29 pm, ZYP sita...@gmail.com wrote:
 Hi, I'm new here :)

 I'm trying to create web service in CakePHP but I have some problem.
 First of all I would like you to look at this 
 ...http://bakery.cakephp.org/articles/view/soap-services-in-cakephp

 I followed this article to make web service. And please browse to page
 3 and scroll down you can see Component class extends. Please look
 at Component-startup() their is a line that call Render().

 The problem is when it came to display in browser, something wrong so
 in the browser there's nothing to see! ... but if I change to another
 way to Render() without using Component (place Render() directly
 in controller) it's fine : I can see XML file smoothly.

 So I don't understand why :(
 If someone can help I'm really love you a lot :)

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



Re: related to Session-setFlash

2009-08-19 Thread cbhan

Yes, i was doing exactly the same,in views/layouts/default.ctp file of
my application.thanks a lot for help

On Aug 19, 7:02 pm, Marcelo Andrade mfandr...@gmail.com wrote:
 On Wed, Aug 19, 2009 at 9:27 AM, Chander Bhangotob...@gmail.com wrote:

  I always get the digit 1 in the next line of the message sent through
  Session-setFlash from controller, need help

 Are you echoing the Session-setFlash() call from the controller?

 Best regards.

 --
 MARCELO DE F. ANDRADE
 Belem, PA, Amazonia, Brazil
 Linux User #221105

 http://mfandrade.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: related to Session-setFlash

2009-08-19 Thread cbhan

thanks a lot for  helping.

On Aug 19, 6:01 pm, zaboo adambartholo...@gmail.com wrote:
 Don't echo $this-Session-setFlash()

 On Aug 19, 8:27 am, Chander Bhan gotob...@gmail.com wrote:

  I always get the digit 1 in the next line of the message sent through
  Session-setFlash from controller, need help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using jquery with cakephp

2009-08-19 Thread jeremy



am able to do the client side validation using jquery...

but is having difficulty in implementing server side validations...

so if there is a tutorial on how to use this, i suppose it would be
very helpful..

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



Tutorials on implementing server side validation in cakephp using jquery

2009-08-19 Thread jeremy

hai guys,

 i am looking for tutorials on using cakephp with jquery
to implement the server side

 validations...

please send me the links..as am not able to find a
proper subject in this material


Thamks 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---