Re: accessing a url param in a router

2007-04-08 Thread Zoltan

Ok,

this is what I have now:
Router::connect('/:id', array('controller' = 'places','action' =
'view'), array ('id' = '[a-z_0-9]{1,15}') );

The error I get is, if I enter something like: http://127.0.0.1:8084/edragon

it thinks it's looking for a controller called Edragon:

Missing controller
You are seeing this error because controller EdragonController could
not be found...
class EdragonController extends AppController {

Cake, helpful as usual, is slightly more confused than I am :)

Zoltan



On Mar 24, 4:11 pm, nate [EMAIL PROTECTED] wrote:
 Yeah, that's not really how you're supposed to use it.  See the
 example here:http://cake.insertdesignhere.com/posts/view/10

 On Mar 24, 1:55 pm, Zoltan [EMAIL PROTECTED] wrote:

  I found making this the last condition seems to do the trick, but I'm
  not sure if this is the proper way to do it:

  Router::connect('/[0-9]{1,4}', array('controller' = 'places','action'
  = 'view', $_GET['url'] ));

  Zoltan

  On Mar 24, 12:49 pm, Chowsapal [EMAIL PROTECTED] wrote:

   I'm not sure I know the best answer for this, but one thing you could
   do is:

   Router::connect('/:param_name', array('controller' = 'places',
   'action' = 'view'));

   This will set $this-params['param_name'] to 123 or whatever is
   there.  As far as limiting this to only numbers, or using info from
   the first parameter in the second one, I'm not really sure.  hth.

   On Mar 24, 10:34 am, Zoltan [EMAIL PROTECTED] wrote:

I'm sure this has been asked before, but I haven't be able to turn up
the answer:

I want to have a url like mysite/123 resolve to mysite/places/view/506

Using 1.2, I have a route like:
Router::connect('/[0-9]+', array('controller' = 'places', 'action' =
'view', $this-params['url'] -- **doesn't work ***  ));  // places/
view/506

how do I specify this?

thanks,
Zoltan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: custom sitename before EACH controller

2007-04-08 Thread Chris Hartjes

I think you need to use mod_rewrite (or it's equivalent) ro make that
happen.  Otherwise you *will* need to do custom routes for each
site...


On 4/7/07, gerbenzomp [EMAIL PROTECTED] wrote:

 I've read the article on routing (http://bakery.cakephp.org/articles/
 view/86) and serached through this group, but couldn't really find an
 answer to this question:

 How can I enable users to have their custom sitename, like this:

 http://www.site.com/users_custom_sitename/controller/action/

 So each user has their own sitename, and ALL controllers and actions
 come after that in the URL.

 Is there a way to do this without having to make custom routes for
 every controller and action?


 



-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

rallyhat.com - digital photo scavenger hunt
@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: How to stop Ajax triggered by onLoad event?

2007-04-08 Thread bernardo

You probably need to pass the callback functions to Event.observe in a
variable, so you can use that variable when calling
Event.stopObserving(). It's all explained in the prototype
documentation:
http://prototypejs.org/api/event/stopObserving

Also read about Event.stop() which is used for a different thing.

On Apr 8, 12:12 am, skyblueink [EMAIL PROTECTED] wrote:
 The code below, using prototype and Ajax, populates 3 divs.  But,
 once the page is loaded and Event.observing is acting, can I stop the
 populating with a click button? I thought Event.stop() and
 Event.stopObserving() should come, and did some tries but failed.

 div id=red/divscript type=text/
 javascriptEvent.observe(window, 'load',function(event)
 {Ajax.Updater('red','/test/content.php?id=red',...)/script

 div id=blue/divscript type=text/
 javascriptEvent.observe(window, 'load',function(event)
 {Ajax.Updater('red','/test/content.php?id=blue',...)/script

 div id=orange/divscript type=text/
 javascriptEvent.observe(window, 'load',function(event)
 {Ajax.Updater('red','/test/content.php?id=orange',...)/script


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: custom sitename before EACH controller

2007-04-08 Thread jitka

I think fastest solution could be route

$Route-connect('/:sitename/:controller/:action/*');

so You can switch something in dependency of

$this-params['sitename']

in controller.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



othAuth in nao mode

2007-04-08 Thread LSL

Hallo.
I have made othAuth working just in oth mode according to othAuth
documentation (http://bakery.cakephp.org/articles/view/148). I would
like to make it working in nao mode so I can have more groups user
belongs to.

I have not found any docs about this mode so I have tried to do it
myself.
1) I have created table:
CREATE TABLE `users_groups` (
`user_id` int(10) unsigned NOT NULL default 0,
`group_id` int(10) unsigned NOT NULL default 0,
KEY `user_id` (`user_id`,`group_id`)

2) I have dropped group_id in users table.

3) I have adjusted models according to this new scheme:
  Users: var $hasAndBelongsToMany =
array('Group'=array('className'='Group','joinTable'='users_groups'));
  Groups: var $hasAndBelongsToMany = array('Permission' ...  'User'
=array('className' = 'User', 'joinTable' = 'users_groups'));

4) Changed 'mode' to 'nao' in app_controller.php

But now it seems I cannot login. What am I doing wrong? Or is there
some mini-howto for nao?

Thanks...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Help with GROUP BY

2007-04-08 Thread [EMAIL PROTECTED]

i tried to use group by to cont comments like this
$this-BlogPost-
bindModel(array('hasOne'=array('Dummy'=array('className'='BlogComment','foreignKey'='blog_post_id';
$this-set('blog_posts', $this-BlogPost-FindAll('1=1 GROUP BY
BlogPost.id',array('id','title','created','COUNT(`Dummy`.`id`)'),'',
'6'));

also

$this-BlogPost-
bindModel(array('hasOne'=array('Dummy'=array('className'='BlogComment','foreignKey'='blog_post_id';
$this-set('blog_posts', $this-BlogPost-FindAll('GROUP BY
BlogPost.id',array('id','title','created','COUNT(`Dummy`.`id`)'),'',
'6'));

both failed.

ERROR:
--
Query: SELECT `BlogPost`.`id`, `BlogPost`.`title`,
`BlogPost`.`created`, COUNT(`Dummy`.`id`) FROM `blog_posts` AS
`BlogPost` LEFT JOIN `users` AS `User` ON (`BlogPost`.`user_id` =
`User`.`id`) LEFT JOIN `blog_comments` AS `Dummy` ON (1=1 GROUP BY
`BlogPost`.`id` AND `Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE
1=1 GROUP BY `BlogPost`.`id` LIMIT 6
Warning: SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'GROUP BY `BlogPost`.`id` AND
`Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE 1=' at line 1 in

SO what the correct way to use GROUP BY


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



newbie question

2007-04-08 Thread [EMAIL PROTECTED]

Hi everybody,

I'm considering converting my application into CakePHP.

Currently I have 3 databases within my application and the first one
has several tables that are referenced by tables in the other two
databases.

Problem 1. I have tables that are named the same in at least two
databases. Can models, controllers and views be isolated to a folder
that would correspond to a specific database? Cake Views are already
in a folder by the controller name but models and controllers exist in
the same directories.

Problem 2. I don't know how to describe a model that has a
relationship with a table from a different database.

What's the best way to handle this situation in Cake?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: mysterious SQL query

2007-04-08 Thread [EMAIL PROTECTED]

thx for you info

but the SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1
 still confuse me...

On 4月7日, 下午10时41分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 The DESC command asks the database to DESCribe a table. Cake uses
 these queries to get the names and data types of your fields.

 Try running DESC `users` and look at the results.

 On Apr 7, 7:25 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  1   DESC `groups`   3   3   4
  2   DESC `users`4   4   4
  3   DESC `contacts` 7   7   4
  4   SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1

  when I debug ,I always find some sql query like above ...

  I didn't do anything to cause that query ,what hell does that do?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Making REST Requests to a web-server like yahoo

2007-04-08 Thread Tonyz

Hi Chris
I need to handle session and cookie this is why I will use the pear
class.

I found also this class http://sourceforge.net/projects/snoopy/

Tonyz

On 7 Apr, 19:24, Chris Hartjes [EMAIL PROTECTED] wrote:
 On 4/7/07, Tonyz [EMAIL PROTECTED] wrote:



  I have no need to parse xml as the response is in php serialized. My
  only concern is doing in php the http request and after some searches
  I think will use the pear package html client as my host has no curl.

 Why can't you use file_get_contents?

 --
 Chris Hartjes

 My motto for 2007:  Just build it, damnit!

 rallyhat.com - digital photo scavenger hunt
 @TheBallpark -http://www.littlehart.net/attheballpark
 @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



newbie question about multiple databases

2007-04-08 Thread [EMAIL PROTECTED]

Hmm, I posted this a couple of hours ago but couldn't find it in the
post list. So, I'm posting it again. Sorry if this is the second time
you guys are getting it.

===
Hi everybody,

I'm considering converting my application into CakePHP.

Currently I have 3 databases within my application and the first one
has several tables that are referenced by tables in the other two
databases.

Problem 1. I have tables that are named the same in at least two
databases. Can models, controllers and views be isolated to a folder
that would correspond to a specific database? Cake Views are already
in a folder by the controller name but models and controllers exist in
the same directories.

Problem 2. I don't know how to describe a model that has a
relationship to a table from a different database.

What's the best way to handle this situation in Cake?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: mysterious SQL query

2007-04-08 Thread Chris Hartjes
It's used by the database models themselves.


On 4/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 thx for you info

 but the SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1
  still confuse me...

 On 4月7日, 下午10时41分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  The DESC command asks the database to DESCribe a table. Cake uses
  these queries to get the names and data types of your fields.
 
  Try running DESC `users` and look at the results.
 
  On Apr 7, 7:25 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
   1   DESC `groups`   3   3   4
   2   DESC `users`4   4   4
   3   DESC `contacts` 7   7   4
   4   SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1
 
   when I debug ,I always find some sql query like above ...
 
   I didn't do anything to cause that query ,what hell does that do?


 



-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

rallyhat.com - digital photo scavenger hunt
@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Making REST Requests to a web-server like yahoo

2007-04-08 Thread Chris Hartjes

I'm confused now, what do cookies and sessions have to do with
connecting to a REST service?

I also use another web client library called HttpClient (don't have
the URL handy) for things like this, but sometimes file_get_contents
because it's simpler.



On 4/8/07, Tonyz [EMAIL PROTECTED] wrote:

 Hi Chris
 I need to handle session and cookie this is why I will use the pear
 class.

 I found also this class http://sourceforge.net/projects/snoopy/

 Tonyz

 On 7 Apr, 19:24, Chris Hartjes [EMAIL PROTECTED] wrote:
  On 4/7/07, Tonyz [EMAIL PROTECTED] wrote:
 
 
 
   I have no need to parse xml as the response is in php serialized. My
   only concern is doing in php the http request and after some searches
   I think will use the pear package html client as my host has no curl.
 
  Why can't you use file_get_contents?
 
  --
  Chris Hartjes
 
  My motto for 2007:  Just build it, damnit!
 
  rallyhat.com - digital photo scavenger hunt
  @TheBallpark -http://www.littlehart.net/attheballpark
  @TheKeyboard -http://www.littlehart.net/atthekeyboard


 



-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

rallyhat.com - digital photo scavenger hunt
@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: custom sitename before EACH controller

2007-04-08 Thread GreyCells

I think this may be what you're looking for:

http://groups.google.com/group/cake-php/browse_thread/thread/71be76876702c64d/268e6000dc8665d5?#268e6000dc8665d5

~GreyCells

On Apr 7, 10:41 pm, gerbenzomp [EMAIL PROTECTED] wrote:
 I've read the article on routing (http://bakery.cakephp.org/articles/
 view/86) and serached through this group, but couldn't really find an
 answer to this question:

 How can I enable users to have their custom sitename, like this:

 http://www.site.com/users_custom_sitename/controller/action/

 So each user has their own sitename, and ALL controllers and actions
 come after that in the URL.

 Is there a way to do this without having to make custom routes for
 every controller and action?


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



Re: newbie question about multiple databases

2007-04-08 Thread BlenderStyle

A brief overview.

You need to create separate entries in your database config file, one
for each database. In your model, specify which database to use. Then,
in your controller, specify which models to use. You can use multiple
models in your controller. If you need to know the specifics of each
of these steps, search or ask here.

Matt

On Apr 8, 9:09 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hmm, I posted this a couple of hours ago but couldn't find it in the
 post list. So, I'm posting it again. Sorry if this is the second time
 you guys are getting it.

 ===
 Hi everybody,

 I'm considering converting my application into CakePHP.

 Currently I have 3 databases within my application and the first one
 has several tables that are referenced by tables in the other two
 databases.

 Problem 1. I have tables that are named the same in at least two
 databases. Can models, controllers and views be isolated to a folder
 that would correspond to a specific database? Cake Views are already
 in a folder by the controller name but models and controllers exist in
 the same directories.

 Problem 2. I don't know how to describe a model that has a
 relationship to a table from a different database.

 What's the best way to handle this situation in Cake?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Help with GROUP BY

2007-04-08 Thread Mariano Iglesias

What version of CakePHP are you using? We solved an issue with hasOne
conditions on this revision:

https://trac.cakephp.org/changeset/4818

So depending on your CakePHP version (1.1 or 1.2) update dbo_source.php with
latest version and try again. Please report here if it's successful.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de [EMAIL PROTECTED]
Enviado el: Domingo, 08 de Abril de 2007 12:30 p.m.
Para: Cake PHP
Asunto: Help with GROUP BY

ERROR:
--
Query: SELECT `BlogPost`.`id`, `BlogPost`.`title`,
`BlogPost`.`created`, COUNT(`Dummy`.`id`) FROM `blog_posts` AS
`BlogPost` LEFT JOIN `users` AS `User` ON (`BlogPost`.`user_id` =
`User`.`id`) LEFT JOIN `blog_comments` AS `Dummy` ON (1=1 GROUP BY
`BlogPost`.`id` AND `Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE
1=1 GROUP BY `BlogPost`.`id` LIMIT 6
Warning: SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'GROUP BY `BlogPost`.`id` AND
`Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE 1=' at line 1 in


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Text in textarea not shown with TinyMCE

2007-04-08 Thread [EMAIL PROTECTED]

Hello. I have created edit action and use TinyMCE to edit my pages.

If iI write html input stuff (like input, textarea nodes) tinymce
show text

But if I use html helper function, tinymce don't show. I page source I
see valid code :

textarea name=data[Page][content]  rows=20 cols=100
id=PageContenttest test test/textarea

My view code is :
?  echo $html-hidden('Page/page_id');
echo $html-input('Page/title', array('size' = 40));
echo $html-textarea('Page/content', array('rows' = 20, 'cols' =
100));
?

All shows except of textarea content.

What I'm doing wrong?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Help with GROUP BY

2007-04-08 Thread [EMAIL PROTECTED]

IMHO, the only right way to make a SQL query with a GROUP BY statement
is to use a 'custom query' with $this-[model]-query() method.

Note, that in your examle you will get only one comment per post.
Useage of GROUP BY statement may be useful if you want to get a
multiple Posts with number of comments for each.

On 8 апр, 19:30, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 i tried to use group by to cont comments like this
 
 $this-BlogPost-bindModel(array('hasOne'=array('Dummy'=array('className'='BlogComment',-'foreignKey'='blog_post_id';

 $this-set('blog_posts', $this-BlogPost-FindAll('1=1 GROUP BY
 BlogPost.id',array('id','title','created','COUNT(`Dummy`.`id`)'),'',
 '6'));

 also

 $this-BlogPost-bindModel(array('hasOne'=array('Dummy'=array('className'='BlogComment',-'foreignKey'='blog_post_id';

 $this-set('blog_posts', $this-BlogPost-FindAll('GROUP BY
 BlogPost.id',array('id','title','created','COUNT(`Dummy`.`id`)'),'',
 '6'));

 both failed.

 ERROR:
 --
 Query: SELECT `BlogPost`.`id`, `BlogPost`.`title`,
 `BlogPost`.`created`, COUNT(`Dummy`.`id`) FROM `blog_posts` AS
 `BlogPost` LEFT JOIN `users` AS `User` ON (`BlogPost`.`user_id` =
 `User`.`id`) LEFT JOIN `blog_comments` AS `Dummy` ON (1=1 GROUP BY
 `BlogPost`.`id` AND `Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE
 1=1 GROUP BY `BlogPost`.`id` LIMIT 6
 Warning: SQL Error: 1064: You have an error in your SQL syntax; check
 the manual that corresponds to your MySQL server version for the right
 syntax to use near 'GROUP BY `BlogPost`.`id` AND
 `Dummy`.`blog_post_id` = `BlogPost`.`id`) WHERE 1=' at line 1 in

 SO what the correct way to use GROUP BY


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: mysterious SQL query

2007-04-08 Thread DJ Spark
 and most of them are cached when in debug is 0
 :)

 spark

On 4/8/07, Chris Hartjes [EMAIL PROTECTED] wrote:
 It's used by the database models themselves.


 On 4/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  thx for you info
 
  but the SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1
   still confuse me...
 
  On 4月7日, 下午10时41分, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   The DESC command asks the database to DESCribe a table. Cake uses
   these queries to get the names and data types of your fields.
  
   Try running DESC `users` and look at the results.
  
   On Apr 7, 7:25 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
1   DESC `groups`   3   3   4
2   DESC `users`4   4   4
3   DESC `contacts` 7   7   4
4   SELECT COUNT(*) AS count FROM `groups` AS `Group` WHERE 1 = 1
  
when I debug ,I always find some sql query like above ...
  
I didn't do anything to cause that query ,what hell does that do?
 
 
  
 


 --
 Chris Hartjes

 My motto for 2007:  Just build it, damnit!

 rallyhat.com - digital photo scavenger hunt
 @TheBallpark - http://www.littlehart.net/attheballpark
 @TheKeyboard - http://www.littlehart.net/atthekeyboard

 



-- 
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br/mp3

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



Re: Strange problem with $javascript in renderElement

2007-04-08 Thread stephen.b

On Mar 26, 4:57 pm, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 2007/3/26, Samuel DeVore [EMAIL PROTECTED]:



  Sometimes I have found that different installs are more picky about
  the case of these kind of things

  try $Javascript and see if that helps

 Thanks, I tried that and I have done similar thinks before, but it did not
 help.
 The strange thing is, that everything works on Win2k with php5. I have
 thought about problems with ansi/utf8 files. Sometimes I had the problem
 with BOMs in the files, but I have checked and have not found any BOMs.

 Any other hints, where I could look further or a debugging method I could
 use to track down the problem ?

 Siegfried

I am having the same problem in php 4.4.1.  I've seen a couple of
suggestions in random forums to put $helpers var in your AppController
(the main one).   However when I do this, I get a ton of other
errors.

class AppController extends Controller {

var $helpers = array('html', 'ajax', 'javascript');

Like: Notice: Use of undefined constant ?html? - assumed '?html?'
in .../dispatcher.php on line 158
Notice: Use of undefined constant ?ajax? - assumed '?ajax?' in .../
dispatcher.php on line 158
Notice: Use of undefined constant ?javascript? - assumed
'?javascript?' in .../dispatcher.php on line 158
Notice: Use of undefined constant ?html? - assumed '?html?' in .../
controller.php on line 250
Notice: Use of undefined constant ?ajax? - assumed '?ajax?' in .../
controller.php on line 250
Notice: Use of undefined constant ?javascript? - assumed
'?javascript?' in .../controller.php on line 250
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at .../dispatcher.php:158) in .../
session.php on line 146
Warning: Cannot modify header information - headers already sent by
(output started at .../dispatcher.php:158) in .../session.php on line
147
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at .../dispatcher.php:158) in .../session.php
on line 146
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at .../dispatcher.php:158) in .../
session.php on line 146
Warning: Cannot modify header information - headers already sent by
(output started at .../dispatcher.php:158) in .../session.php on line
147

and then of course the Fatal error: Call to a member function on a non-
object


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



Re: newbie question about multiple databases

2007-04-08 Thread Sergei Gerasenko

On Sun, Apr 08, 2007 at 06:58:33PM -, BlenderStyle wrote:
 
 A brief overview.
 
 You need to create separate entries in your database config file, one
 for each database. In your model, specify which database to use. Then,
 in your controller, specify which models to use. You can use multiple
 models in your controller. If you need to know the specifics of each
 of these steps, search or ask here.

Well, the problem I have is that in one of the models that belongs to
database A I needed to include a belongsTo relationship with a model
in database B. Is that possible?

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



Re: Strange problem with $javascript in renderElement

2007-04-08 Thread stephen.b

haha, ok joke is on me.  I cut and pasted the line var $helpers =
array('html', 'ajax', 'javascript'); from a forum and it was using
the left and right single quotes (hence the question marks in the
errors. )

Once I fixed that it worked fine.

Although the HTML helper is available by default, you have to declare
the rest of the helpers you plan to use in your AppController.  Also
if you are porting anything from php 5 to 4 make sure your $name vars
are all declared.


On Apr 8, 4:20 pm, stephen.b [EMAIL PROTECTED] wrote:
 On Mar 26, 4:57 pm, Siegfried Hirsch [EMAIL PROTECTED]
 wrote:



  2007/3/26, Samuel DeVore [EMAIL PROTECTED]:

   Sometimes I have found that different installs are more picky about
   the case of these kind of things

   try $Javascript and see if that helps

  Thanks, I tried that and I have done similar thinks before, but it did not
  help.
  The strange thing is, that everything works on Win2k with php5. I have
  thought about problems with ansi/utf8 files. Sometimes I had the problem
  with BOMs in the files, but I have checked and have not found any BOMs.

  Any other hints, where I could look further or a debugging method I could
  use to track down the problem ?

  Siegfried

 I am having the same problem in php 4.4.1.  I've seen a couple of
 suggestions in random forums to put $helpers var in your AppController
 (the main one).   However when I do this, I get a ton of other
 errors.

 class AppController extends Controller {

 var $helpers = array('html', 'ajax', 'javascript');

 Like: Notice: Use of undefined constant ?html? - assumed '?html?'
 in .../dispatcher.php on line 158
 Notice: Use of undefined constant ?ajax? - assumed '?ajax?' in .../
 dispatcher.php on line 158
 Notice: Use of undefined constant ?javascript? - assumed
 '?javascript?' in .../dispatcher.php on line 158
 Notice: Use of undefined constant ?html? - assumed '?html?' in .../
 controller.php on line 250
 Notice: Use of undefined constant ?ajax? - assumed '?ajax?' in .../
 controller.php on line 250
 Notice: Use of undefined constant ?javascript? - assumed
 '?javascript?' in .../controller.php on line 250
 Warning: session_start(): Cannot send session cache limiter - headers
 already sent (output started at .../dispatcher.php:158) in .../
 session.php on line 146
 Warning: Cannot modify header information - headers already sent by
 (output started at .../dispatcher.php:158) in .../session.php on line
 147
 Warning: session_start(): Cannot send session cookie - headers already
 sent by (output started at .../dispatcher.php:158) in .../session.php
 on line 146
 Warning: session_start(): Cannot send session cache limiter - headers
 already sent (output started at .../dispatcher.php:158) in .../
 session.php on line 146
 Warning: Cannot modify header information - headers already sent by
 (output started at .../dispatcher.php:158) in .../session.php on line
 147

 and then of course the Fatal error: Call to a member function on a non-
 object


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Text in textarea not shown with TinyMCE

2007-04-08 Thread Langdon Stevenson

Fastest way to work this out would be to see the textarea tag that you 
wrote by hand, as well as the textarea tag output by the html helper.

If they are not identical, then you have a place to start looking for 
your problem.

Regards,
Langdon


[EMAIL PROTECTED] wrote:
 Hello. I have created edit action and use TinyMCE to edit my pages.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Blank Lines before DOCTYPE

2007-04-08 Thread PaulV

Hi,

I am using cake 1.13 and I am getting 1 blank line before the DOCTYPE
on all my pages. I have checked my layout file and there is no blank
line there,

Any suggestions how I track down where the extra line is coming from?

   Paul


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Blank Lines before DOCTYPE

2007-04-08 Thread PaulV



On 9 Apr, 00:38, PaulV [EMAIL PROTECTED] wrote:
 Hi,

 I am using cake 1.13 and I am getting 1 blank line before the DOCTYPE
 on all my pages. I have checked my layout file and there is no blank
 line there,

Cake version 1.1.13

I have also checked all my model files, controller files which do not
have blank lines outside the enclosing ?php and ? tags.

If I add html comments at the beginning and end of app_controller,
app_model and pages_controller, they appear before the blank line and
the DOCTYPE.

If I add an HTML comment before the doctype in the layout file, the
blank line appears before the html comment.

Which bit of cake code runs between loading all the models and the
particular controller, and the rendering of the layout?

   Paul


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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 criteria array using DATE_FORMAT

2007-04-08 Thread [EMAIL PROTECTED]

I'm trying to use a findall query and use the MYSQL DATE_FORMAT
function.

The code is

$criteria = array();
$criteria['DATE_FORMAT(Schedule.start,\'%w\')'] = 3;
$this-Schedule-findAll($criteria);


My code as it runs produces...

SELECT * FROM `studioschedules` AS `Schedule`WHERE
DATE_FORMAT(`Schedule`.`start,'%w'`) = 3

which causes an error.  What is the correct way to put this query
together?


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



caching problem, need help to debug my code.

2007-04-08 Thread feelexit

here's my code.

If I comment out
var $cacheAction = array('view/' = 86400);
and using var $cacheAction = 1 hour;

?php

class PagesController extends AppController{
  var $name = 'Pages';
  var $helpers = array('Cache');
  var $cacheAction = array('view/' = 86400);
  //var $cacheAction = 1 hour;

  function view(){
$this-set('CSS', 'style');
  }
}

?


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



caching problem, need help to debug my code.

2007-04-08 Thread feelexit

here's my code.

If I comment out
  var $cacheAction = array('view/' = 86400);
and using
  var $cacheAction = 1 hour;
it works fine,   but if I am using
  var $cacheAction = array('view/' = 86400);
then, it stops working, nothing cached, and I checked cache folder, no
file generated there.  I copy  paste directly from manual, I must
make some stupid bugs, just couldn't debug my own code.

?php

class PagesController extends AppController{
  var $name = 'Pages';
  var $helpers = array('Cache');
  var $cacheAction = array('view/' = 86400);   use
this one, not working
  //var $cacheAction = 1 hour;  - use this one, it works

  function view(){
$this-set('CSS', 'style');
  }
}

?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Scary associations with recursive calls

2007-04-08 Thread Derick Ng

Hi,

As models get complicated, I have been thinking at some point that
defining association by default in the model gets little to no use. I
understand that the auto-magic queries are what made the association
important but the sheer amount of queries just irritates me at times.
I end up thinking why wouldn't I just use bindModel in my self defined
Model-getSomeData or Model-getOtherData method so only the required
data and tables get queried. Now, I understand that with these, the
rapid development gets not so rapid. For example of a very simple job
application system, this is a model defined according to the actual
relationship:

[Application]
belongsTo
  - Job
  - User

[Job]
belongsTo
  - Department
hasMany
  - Application

[Department]
hasMany
  - Job

[User]
hasOne
  - Profile
hasMany
  - Application
  - Document

[Document]
belongsTo
  - User

[Profile]
belongsTo
  - User

To get a show a list of applications with the relevant profile, I did
a Application-findAll() with recursive level of 2. The results goes
like:

array(
[0] = array(
[Application] = array(
...data...
)

[User] = array(
...data...

[Profile] = array(
   ...data...
)

[Application] = array(
[0] = array(
...data...
)

[1] = array(
...data...
)
)

[Document] = array(
[0] = array(
...data...
)

[1] = array(
...data...
)
)
)

[Job] = array(
...data...

[Department] = array(
   ...data...
)

[Application] = array(
[0] = array(
...data...
)

[1] = array(
...data...
)
)
)
)

[1] = array(
... more data here ...
)
)

Clearly, in such cases when the models are mostly inter-linked, the
amount of duplicated information gets scary. I was just trying to get
Profile information of the user of each Application to show up but so
much more other information gets queried. The most scary one being Job
hasMany Application. See how all the applications of the Job applied
will get queried each time for each Application listed. The easy way
out is to change or remove some association or even add a Application
belongsTo Profile association but that will mean the relationship is
somewhat  awkard since Application really belongsTo a User whom hasOne
Profile.

Alright, in case my post gets really lengthy (it already is... :p), I
hope you guys get the point. So what will you do in this case or
rather in general, will you rather not define any association to begin
with? Or maybe it will be nice to have a way to specify like i just
want Application.User.Profile in my recursive call so I can actually
pass that into my findAll() call and magic happens? Despite not
knowing CakePHP very well, please let me know if there is anything I
can help with.

Will be nice to hear from you guys!

Cheers,
Derick Ng


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Scary associations with recursive calls

2007-04-08 Thread Mariano Iglesias

This sounds like a scream for help, and expects() is up to the challenge ;)

http://bakery.cakephp.org/articles/view/185

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Derick Ng
Enviado el: Lunes, 09 de Abril de 2007 12:39 a.m.
Para: Cake PHP
Asunto: Scary associations with recursive calls

As models get complicated, I have been thinking at some point that
defining association by default in the model gets little to no use. 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---