400 Bad Request when URL contains %

2009-04-03 Thread RichardAtHome

Hi bakers! :-)

I'm pretty surprised I haven't come across this one before.

The following URL generated by the pagination helper causes a 400 Bad
Request response:

http://localhost/projects/jisc_pims_19/outputs/index/page:2/find:a%

Remove the '%' from the URL and its all fine

If you change the url to http://localhost/projects/jisc_pims_19/%
or
http://localhost/projects/jisc_pims_19/programmes/view/%

you also get a bad request.

The following URL works as expected:

http://localhost/projects/jisc_pims_19/outputs?find=a%25

I've check back to a bunch of other CakePHP apps I've written and they
all exhibit the same behaviour :-(

After a bit more of a dig, it seems most CakePHP sites suffer the same
problem too:

http://cheesecake-photoblog.org/demo/view/%

http://overheard.it/people/%

http://snook.ca/archives/cakephp/%

How do I (and everyone else) fix this?
--~--~-~--~~~---~--~~
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: isn't a form in the view supposed to find the correct action?

2009-02-18 Thread RichardAtHome

Sindey, Marcelo is right. The default action for a form is to post to
the $controller-add() method. You have to override it for other
actions

On Feb 18, 12:00 am, Sidney aussiealthomp...@gmail.com wrote:
 I think the default action is to self-post i.e. the form post/get goes
 to the same controller/action that served the view with the form on
 it. This is a normal design convention and seems logical to me
 (although quite a noob myself). Perhaps I misunderstand your question?

 On Feb 17, 8:01 am, Marcelo Andrade mfandr...@gmail.com wrote:

  Hi there,

  By the CakePHP conventions, the view's name must be the same
  as an action in a controller.  A common mistake for the newbies is
  when creating a form in the view is that the

  echo $form-create('MyModel');

  defaults to generate a form for the add action.  But I think that
  should be more intuitive that it's defaults to the action with the
  same name as the view.  Isn' it?

  Best regards.

  --
  MARCELO DE F. ANDRADE (aka eleKtron)
  Belem, PA, Amazonia, Brazil
  Linux User #221105
--~--~-~--~~~---~--~~
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: EasySoft MS SQL Drive with unixODBC

2009-02-16 Thread RichardAtHome

I'd start with a blank (non-cake) php page and try and get that
working to make sure your odbc driver is set up correctly.

Haven't used ODBC with cake but I can tell you the Easysoft stuff is
very good (caveat: I used to work at Easysoft :-) )

On Feb 12, 4:37 pm, Stinkbug justink...@gmail.com wrote:
 We're trying to connect to sql server and we've installed the EasySoft
 MS SQL Driver and I'm told that the connection is working (I'm not the
 one that installed it and test it), but we can't get it to work in
 Cake.

 Has anyone tried using this driver and if so, what did you have to do
 to get it to work?

 Our database config looks something like this.

         var $webserver = array(
                 'driver' = 'odbc',
                 'connect' = 'webserver',
                 'persistent' = false,
                 'host' = 'webserver',
                 'login' = 'saweb',
                 'password' = '54web',
                 'database' = 'webserver',
                 'prefix' = '',
         );
--~--~-~--~~~---~--~~
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: deprecation of useful functions

2009-02-16 Thread RichardAtHome

You could always add your own wrappers to your AppModel :-)

On Feb 16, 3:52 pm, leo ponton@gmail.com wrote:
  I could never remember the order of the many many
  arguments to find and had to look them up at least once a day. Putting
  them info an associative array helps me a lot because I don't have to
  remember pointless index-numbers.

 I have the same problem the new way round. The associative array is
 good, but too often the documentation in the API lists options. What
 options? And when it actually tells you what they are, they're not
 necessarily all there, as with neighbours (in its non-English version
 of the spelling, neighbors).

 Also, I suffer bracket-and-comma blindness, so when I see more than
 one consecutive array, I can't see whether or not it is nested.

 I shouldn't have to delve into the code to find the correct args.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Catching PHP/MySQL errors with query()

2009-02-13 Thread RichardAtHome

Hi All :-)

How do you trap errors that may be the result of a custom query? For
example:

$results = $model-query($sql);

In my case, some of the custom sql queries creates such a large
dataset that the script exceeds the memory allocated to php.

I would like to catch these errors and present something a bit more
friendly to the user.

I've tried wrapping the code in a try/catch block as I would normally
do:

try {

$results = $model-query($sql);

}
catch (Exception $e) {

  // handle error here

}

but the error is still raised and the try/catch is ignored.

While trying out this approach I noticed that if I do:

try {

 echo 1/0; // generate a divide be zero error to test

}
catch (Exception $e) {

  // handle error here

}

The error message is still displayed! I'm guessing that CakePHP is
already trapping these errors, so ultimately my question is:

How do I stop Cake from trapping errors so I can use my own error
handler, and how do I re-enable Cake error handling after the bit of
code I want to check has finished?

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



Re: how to set css for internet explorer

2009-02-13 Thread RichardAtHome

Conditional comments are the way forward. The user agent can be
spoofed.


On Feb 13, 11:37 am, Marcelo Andrade mfandr...@gmail.com wrote:
 On Fri, Feb 13, 2009 at 7:17 AM, mona poojapinj...@gmail.com wrote:

  hi viewers

  i have one serious problem i have to set the page layout in such a way
  that my website should perfectly viewed in internet explorer . It is
  working fine in firefox but in IE it is not so can anybody tell me how
  to call two different css for two different browsers or any other
  solution for that so that is should be correctly displayed in internet
  explorer

 With PHP, you can check the browser using the user agent in the
 $_SERVER superglobal variable[1].

 In another way, you can use css hacks for IE ou even the conditional
 comments[2].

 [1]http://php.about.com/od/learnphp/p/http_user_agent.htm
 [2]http://haslayout.net/condcom

 Best regards.

 --
 MARCELO DE F. ANDRADE (aka eleKtron)
 Belem, PA, Amazonia, Brazil
 Linux User #221105

 [...@pará ~]# linkshttp://pa.slackwarebrasil.org/
--~--~-~--~~~---~--~~
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: DebugKit plugin: not available for Windows users?

2009-02-06 Thread RichardAtHome

Another vote here for Chaw needing a download link!

On Feb 6, 7:43 pm, Matt Curry m...@mcurry.net wrote:
 The Git link Brandon referenced does work once you get everything
 setup.  I did it yesterday so I could download the API Plugin.  It
 would be nice if TheChaw had a download link like GitHub.  I assume
 it's forthcoming.

 Most of the changes from my forked version have been merged back into
 the official one.  I think the last few will be added eventually.  I
 probably won't keep my version up to date after that, but right now it
 should be *relatively* close to the official one.

 -Matthttp://www.pseudocoder.com

 On Feb 6, 1:56 pm, BrendonKoz brendon...@hotmail.com wrote:

  Git installer for Windows:http://code.google.com/p/msysgit/

  Allows you to run Git from the Windows' command line.  There's
  probably another way to get access to it as well, but I'm not really
  familiar with Git or TheChaw.  Matt Curry's forked version
  (pseudocoder.com) is on GitHub which offers a download, but I'd highly
  recommend sticking with the official source, I only mention this as a
  possible temporary alternative until you can get access to the real
  source.

  On Feb 6, 11:48 am, rcurzon s...@interlog.com wrote:

   I guess it would work fine in Windows... but you can't get it without
   git... which isn't ready for Windows?  Let me know if I missed
   something please!

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



Quick Question about Chaw

2009-02-05 Thread RichardAtHome

I think the Chaw repository is an excellent idea.

Are there plans to include a download link?

If don't have SVN or GIT set up, how do I download projects?
--~--~-~--~~~---~--~~
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: ERD recommendation

2009-02-04 Thread RichardAtHome

I've been using MySQL Workbench. Does everything I need.

http://dev.mysql.com/workbench/

On Feb 4, 7:13 am, Wayne Fay wayne...@gmail.com wrote:
  I was wondering if anyone has any recommendations for a database
  design tool.  I was hoping to use an OSS product.

 I generally use Squirrel SQL, or a DB editor in Eclipse/Netbeans IDE
 which can connect to any database that has a JDBC driver.

 For postgres, I also use pgAdmin. This page has more info about
 pg-specific tools:http://postgresql.openmirrors.org/docs/techdocs-9.html

 Wayne
--~--~-~--~~~---~--~~
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: Use the dreaded requestAction()... or use something else?

2009-02-03 Thread RichardAtHome

Request action isn't *that* bad ;-)

In this case request action should be fine as you wont be calling it
very often (as opposed to say from in an element that is displayed on
every page).

That said, Graham's suggestion is a better solution.

Note, to get the best performance from requestAction you should use
the following syntax:

$this-requestAction(array(controller=sites, action=add));


On Feb 2, 12:14 pm, Turgs timb@gmail.com wrote:
 Hello all

 What's an appropriate use of requestAction()?

 I have 3 controllers:
    * UsersController
    * SiteController
    * SitePagesController

 Within the add() function of UsersController, I want to (a) create a
 new user (b) create a new site for that user with (c) one new page for
 that site.

 What's the best way to do this?

 I was thinking of:

 ##

 if ($this-User-save($this-data))
 {
    # create site
    $this-requestAction('/sites/add');

    # add a page (homepage) for this site
    $this-requestAction('/sitepages/add');

    # Login the user and redirect to the dashboard
    // login code here
    $this-Session-setFlash(SOTF_MSG_USER_WELCOME);
    $this-redirect(array('controller' = 'users' ,'action' =
 'dashboard'));

 }

 ##

 While the code for this looks clean, what I've read seems to indicate
 this isn't such a good idea due to performance issues.

 What else would I do?

 Thanks
 Turgs
--~--~-~--~~~---~--~~
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: $form-dateTime() field name breaks with 4 or more levels

2009-01-28 Thread RichardAtHome

Found the solution. Documenting it here in case anyone else stumbles
into this issue:

You need to use an alternative format to specify the model/field
names:

? echo $form-dateTime([a][b][c][d]) ?

Thanks to the person on IRC who hinted at this solution :-)

On Jan 24, 4:17 pm, RichardAtHome richardath...@gmail.com wrote:
 Hate to do this, but... Bump!

 Is this a bug in CakePHP (I'd be surprised if it was as I can't fault
 the rest of CakePHP's code) or expected behaviour?

 On Jan 23, 3:39 pm, RichardAtHome richardath...@gmail.com wrote:

  Hi all

  I've hit a snag I'm hoping someone can help with. Perhaps one of the
  devs can explain this behaviour?

  ? echo $form-dateTime(a.b.c) ?

  generates (as expected):

  select name=data[a][b][c][day] id=abCDay...

  whereas:

  ? echo $form-dateTime(a.b.c.d) ?

  generates:

  select name=data[a] id=a...

  and

  ? echo $form-dateTime(a.b.c.d.e) ?

  generates

  select name=data[] id=...

  Unfortunately, I'm building a dynamic search form and my code needs 4
  levels:

  $form-dateTime({$model}.nextIndex.{$field_id}.value, DMY, NONE)

  (nextIndex is replaced with a number at runtime)

  I've just tried this with a basic text field ?echo $form-text
  (a.b.c.d.e) ? and got the same results as above.

  What do I do?
--~--~-~--~~~---~--~~
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: Calling $html-css() from inside an element

2009-01-28 Thread RichardAtHome

If the element is being rendered in the layout, why not add the $html-
css to the header as normal in the layout?

Is the element optional in the layout? ie. is it only displayed on
some pages and not others?

If so, I think the minor overhead of including the CSS on every page
(and therefore cached by the browser) would outway the overhead of
using an additional helper.


On Jan 27, 2:58 pm, Gonzalo Servat gser...@gmail.com wrote:
 On Tue, Jan 27, 2009 at 12:51 PM, RichardAtHome 
 richardath...@gmail.comwrote:



  Try it from a layout.

  ...but your question is about calling it from inside an element :-S

  ... or do you mean an element that's linked from a layout and not a
  view?

 Right! An element called from a layout that has a call to $html-css() in it
 (with inline set to false). Like I said, the way I fixed it was by creating
 a helper which I call from the element to add the custom CSS file and called
 from the layout inside the head/head section to print it out.

 - Gonzalo
--~--~-~--~~~---~--~~
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: twitter users?

2009-01-28 Thread RichardAtHome

Aye, I've noticed hashtags was missing a few posts too.

On Jan 27, 8:55 am, p...@otaqui.com p...@otaqui.com wrote:
 I've found Hastags.org to be quite unreliable (going offline
 regularly, missing tagged posts, that kind of thing).

 Another option is just to search twitter itself:

 http://search.twitter.com/search?q=%23cakephp

 On Jan 27, 8:23 am, RichardAtHome richardath...@gmail.com wrote:

  There's also a #cakephp hashtag:

 http://hashtags.org/search?query=cakephpsubmit=Search

  On Jan 26, 5:42 pm, gerhardsletten gerhardslet...@gmail.com wrote:

  http://www.twitter.com/gerhardsletten

   A salty mix of cake, ez publish, triathlon, food and live. Code stuff
   mostly in english, but some norwegian now and than

   On Jan 25, 5:33 pm, Marcelo Andrade mfandr...@gmail.com wrote:

   http://twitter.com/mfandrade

Mainly in portuguese.

--
MARCELO DE F. ANDRADE (aka eleKtron)
Belem, PA, Amazonia, Brazil
Linux User #221105

[...@pará ~]# linkshttp://pa.slackwarebrasil.org/

For Libby's backstory be told on 
Losthttp://www.petitiononline.com/libby423/petition.html
--~--~-~--~~~---~--~~
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: CakePHP In A Subdirectory?

2009-01-27 Thread RichardAtHome

Did you reboot the web server yet. This sounds exactly like the issue
I was having.

Also, check your web server error log files just in case.

On Jan 27, 7:56 am, leo ponton@gmail.com wrote:
  I tried doing phpinfo() from the index.php file and nothing was
  displayed

 Doesn't this ring any alarm bells?
--~--~-~--~~~---~--~~
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: twitter users?

2009-01-27 Thread RichardAtHome

There's also a #cakephp hashtag:

http://hashtags.org/search?query=cakephpsubmit=Search


On Jan 26, 5:42 pm, gerhardsletten gerhardslet...@gmail.com wrote:
 http://www.twitter.com/gerhardsletten

 A salty mix of cake, ez publish, triathlon, food and live. Code stuff
 mostly in english, but some norwegian now and than

 On Jan 25, 5:33 pm, Marcelo Andrade mfandr...@gmail.com wrote:

 http://twitter.com/mfandrade

  Mainly in portuguese.

  --
  MARCELO DE F. ANDRADE (aka eleKtron)
  Belem, PA, Amazonia, Brazil
  Linux User #221105

  [...@pará ~]# linkshttp://pa.slackwarebrasil.org/

  For Libby's backstory be told on 
  Losthttp://www.petitiononline.com/libby423/petition.html
--~--~-~--~~~---~--~~
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: Calling $html-css() from inside an element

2009-01-27 Thread RichardAtHome

Try it from a layout.

...but your question is about calling it from inside an element :-S

... or do you mean an element that's linked from a layout and not a
view?

On Jan 26, 2:19 pm, Gonzalo Servat gser...@gmail.com wrote:
 On Mon, Jan 26, 2009 at 12:17 PM, RichardAtHome 
 richardath...@gmail.comwrote:



  Sorry AD7six, just tried it in an element and the code IS injected
  into the header:

  view.ctp
  ?php echo $this-element(test) ?

  elements\test.ctp
  ?php echo $html-css(test, array(), null, false) ?

  I'm using the latest stable build of Cake

 Try it from a layout.

  - Gonzalo
--~--~-~--~~~---~--~~
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: What is the advised way to call a function from another controller?

2009-01-27 Thread RichardAtHome

or you could put the function in your AppController

On Jan 27, 2:17 pm, leo ponton@gmail.com wrote:
 I'm not suggesting this is the correct way to do it, but I would put
 those methods in the model definitions to which they relate. Then they
 are accessible from any controller that 'uses' that model in addition
 to its own. Then you can say something like:

     $organisations= $this-Person-Organisation-formData();
     $genders = $this-Person-Gender-formData();
     ...and so on...

 On Jan 27, 2:07 pm, WebbedIT p...@webbedit.co.uk wrote:

  Are you sure a component would be correct for this as again the
  CookBook states To access/use a model in a component is not generally
  recommended and my __formData() functions are made to access models:

  function formData() {
    $organisations= $this-Person-Organisation-find('list', array(
    'order'='Organisation.name ASC'
    ));
    $this-set(compact('organisations'));

    $users = $this-Person-User-find('list', array
  ('fields'='User.username'));
    $this-set(compact('users'));
    $ethnicities = $this-Person-Ethnicity-find('list', array(
    'conditions'=array('Ethnicity.option_list_id'='13'),
    'fields'=array('Ethnicity.value'),
    'order'='Ethnicity.value ASC'
    ));
    $this-set(compact('ethnicities'));

    $sexualities = $this-Person-Sexuality-find('list', array(
    'conditions'=array('Sexuality.option_list_id'='18'),
    'fields'=array('Sexuality.value'),
    'order'='Sexuality.value ASC'
    ));
    $this-set(compact('sexualities'));

    $religions = $this-Person-Religion-find('list', array(
    'conditions'=array('Religion.option_list_id'='30'),
    'fields'=array('Religion.value'),
    'order'='Religion.value ASC'
    ));
    $this-set(compact('religions'));

    $genders = $this-Person-Gender-find('list', array(
    'conditions'=array('Gender.option_list_id'='12'),
    'fields'=array('Gender.value'),
    'order'='Gender.value ASC'
    ));
    $this-set(compact('genders'));

  }

  Also I would still have to create a lot of logic or duplicate
  functions within the component so that the find calls were made via
  the right associations, i.e. the above function would work fine when
  the referencing controller was PeopleController but when called from
  ClientController the find calls would have to start $this-Client-

  Person... and from Staff $this-Staff-Person... etc.
--~--~-~--~~~---~--~~
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: CakePHP In A Subdirectory?

2009-01-26 Thread RichardAtHome

You also need to delete the contents off the app/tmp directory. Leave
the file structure intact and just remove any files.

This is rapidly becoming my stock answer :-S

On Jan 26, 5:49 am, Paolo Stancato paolodo...@gmail.com wrote:
 Find .htaccess files (there are two)  and add RewriteBase /myapp
 into mod_rewrite section.

 Regards

 2009/1/26 inVINCable invinceable...@gmail.com:



  Hey all,

  Very simply question but cannot seem to find the answer. I have the
  directory structure and everything in tact in the normal way. However,
  on my server I put the entire structure in the /myapp folder in the
  document root.

  Now, everything is all mest up and there is no CSS and files are
  missing and such. Surely cake has a simple variable to reflect these
  changes? Any advice? I have already looked at the book and the bakery
  and have tried things but they have not worked, such as messing with
  the variables in the index.php file.

  I am using version 1.2

  Thank you for any advice/pointers.

  Regards
--~--~-~--~~~---~--~~
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: Performing a Query using a curdate as condition, help asap?

2009-01-26 Thread RichardAtHome

$this-Event-find('all',array(
'conditions' =array(
'event_category_id'=$catId,
'DATE(Event.event_date)  getdate()'
),
'order'=array('Event.event_date ASC',
'Event.event_time ASC'
)
) ) ;

On Jan 26, 9:38 am, Martin Westin martin.westin...@gmail.com wrote:
 There are lots of goodies you can use (for MySQL at least).

 Datediff is my preferred comparison since it does not fail on leap-
 years and things like that.
 DATEDIFF(date1,date2)  0
 - true or false

 To construct modified versions of today I sometimes use Addate adn
 Subdate
 ADDDATE(CURDATE(), INTERVAL 4 HOUR)
 - 2009-01-26 04:00:00

 /Martin

 On Jan 26, 12:53 am, Parris presid...@parrisstudios.com wrote:

  Hi Everyone,
  I am just trying to perform a simple query using cakephp. In the
  conditions array I am trying to filter by dates. The results should be
  all 'events' that will be today or greater (in other words, any date
  in the future).

  $this-Event-find('all',array( 'conditions' =array
  ('event_category_id'=$catId,'DATE(Event.event_date)'='getdate
  ()'),'order'=array('Event.event_date ASC','Event.event_time
  ASC') ) ) ;

  That is what i have so far. The first condition is just to filter by
  category. The part I need help with is 'DATE
  (Event.event_date)'='getdate()'). There are no errors. So i guess its
  kind of working. Also how can i adjust 'today' by 4 hours ?

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



Re: Calling $html-css() from inside an element

2009-01-26 Thread RichardAtHome

Syntax should be:

echo $html-css( 'right_column', array( 'media' = 'screen' ), null,
false );


On Jan 24, 6:45 pm, Gonzalo Servat gser...@gmail.com wrote:
 Hi All,

 I never had the need to do this, but I've come across a situation where it
 comes in handy. I'd like to add a stylesheet for inclusion in head/head
 from an element. This is because the element I'm including is called
 right_column.ctp and the CSS to-be-included modifies a few of the styles
 on the main page to accomodate for it. There are probably better ways of
 doing this, and I'd love to hear your suggestions and ways of doing this,
 but for the time being I'd like to find out why I can't include a stylesheet
 from an element. My code looks like this:

 $html-css( 'right_column', null, array( 'media' = 'screen' ), false );

 I started looking into cake/libs/view/view.php and it looks like the layout
 is rendered before the elements which explains why it doesn't work
 ($this-__scripts is empty at the time that the layout is being rendered).
 Anyone?

 Thanks!
 Gonzalo
--~--~-~--~~~---~--~~
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: CakePHP In A Subdirectory?

2009-01-26 Thread RichardAtHome

Might be worth re-starting the (web) server. It fixed a 500 error I
was getting a while back. Been fine every since (even after uploading
source updates).

On Jan 26, 1:38 pm, inVINCable invinceable...@gmail.com wrote:
 Hey,

 Ok, I found both of the .htacess files and added RewriteBase /myapp
 so my .htacess file looks like:

 IfModule mod_rewrite.c
     RewriteEngine on
     RewriteBase /myapp
     RewriteRule    ^$    webroot/    [L]
     RewriteRule    (.*) webroot/$1    [L]
  /IfModule

 I also deleted the cache (just the files) and now I am getting a 500
 Internal Server Error. I have tried this both on my local machine and
 a live server and the same thing happens. Anyone know what I might be
 doing wrong?

 On Jan 25, 9:49 pm, Paolo Stancato paolodo...@gmail.com wrote:

  Find .htaccess files (there are two)  and add RewriteBase /myapp
  into mod_rewrite section.

  Regards

  2009/1/26 inVINCable invinceable...@gmail.com:

   Hey all,

   Very simply question but cannot seem to find the answer. I have the
   directory structure and everything in tact in the normal way. However,
   on my server I put the entire structure in the /myapp folder in the
   document root.

   Now, everything is all mest up and there is no CSS and files are
   missing and such. Surely cake has a simple variable to reflect these
   changes? Any advice? I have already looked at the book and the bakery
   and have tried things but they have not worked, such as messing with
   the variables in the index.php file.

   I am using version 1.2

   Thank you for any advice/pointers.

   Regards
--~--~-~--~~~---~--~~
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: Calling $html-css() from inside an element

2009-01-26 Thread RichardAtHome

Sorry AD7six, just tried it in an element and the code IS injected
into the header:

view.ctp
?php echo $this-element(test) ?

elements\test.ctp
?php echo $html-css(test, array(), null, false) ?

I'm using the latest stable build of Cake



On Jan 26, 11:33 am, Gonzalo Servat gser...@gmail.com wrote:
 On Mon, Jan 26, 2009 at 9:24 AM, RichardAtHome richardath...@gmail.comwrote:



  Syntax should be:

  echo $html-css( 'right_column', array( 'media' = 'screen' ), null,
  false );

 Not if you're using the last parameter as false. It just adds it to an
 array which later gets printed in the $scripts_for_layout section so there's
 no need to print it out.

 That wasn't the problem though. After speaking with AD7six, basically what
 happens is that the head scripts section is already processed by the time it
 gets to the elements in the layout so I can't use that array unless I want
 to re-work the order in which things are processed in CakePHP (which would
 surely break lots of other stuff). What I had to do was create a head helper
 (AD7six's suggestion) which I would call to add CSS (from the element) and
 later get the CSS (from the layout in the head section).

 If anyone wants to see an example of how to include a custom CSS file from
 an element, let me know and I'll do a quick blog on it.

 - Gonzalo
--~--~-~--~~~---~--~~
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: Problem to use Ajax layout.

2009-01-26 Thread RichardAtHome

I think you'll need to post some code before anyone can help you with
this...

On Jan 27, 12:49 am, Mahesh Sutar maheshsuta...@gmail.com wrote:
 I am using ajax in ctp page to populate table.
 number of rows I am reading from text box and passing to view action

 I am able to get table structure, but Its overlapping on footer which
 is present in default layout.

 Any one has solution for this?

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



Re: Problem with routing using Javascript's location.href

2009-01-26 Thread RichardAtHome

I'd wager its not your code, but CakePHP's security settings. In app/
config/core.php change

Configure::write('Security.level', 'high');

To

Configure::write('Security.level', 'low');

and see if that clears up the problem.

On Jan 27, 2:14 am, MichTex bill.cav...@gmail.com wrote:
 I have been working for a number of months on an application using
 CakePHP, and have for the most part found it to be a very congenial
 development environment. However, for the last few weeks I've been
 struggling with what looks to be some peculiar CakePHP behavior.
 Basically, I am trying to implement keyboard shortcuts (hotkeys) using
 simple Javascript event handling to capture keycodes, and then, via
 the browser's location.href property, route the user to the
 appropriate page. This approach works great most of the time. However,
 there are a couple of users for whom this approach causes the browser
 to route them to the login page rather than the desired page. I have
 rummaged through hundreds of postings here in the CakePHP Google
 group, and done dozens of Google searches through CakePHP
 documentation and numerous relevant blogs, but so far have turned up
 no clues to what the problem is.

 Let me expand on the details a little bit:

 -The application I am working on mostly provides a few basic screens
 which present blocks of text followed either by simple forms, or by
 sets of link-type or button-type navigation choices. This part of the
 system works very well.

 -Recently, the product director wanted me to add hotkeys to speed up
 navigation. For example, in cases where the navigation consists of a
 short list of choices, he wants the user to be able to type a single
 digit associated with each choice. Thus, if there were 5 navigation
 choices, numbered 1 to 5, the user could either use the mouse to click
 on any of the 5 links for those choices, or type the individual digits
 1 to 5 on the keyboard to select the corresponding link. In another
 case, there is an informational screen with a big Next button at the
 bottom. The product director wants the user to be able to go to the
 next page either by clicking on the Next button with the mouse, or by
 typing either the letter 'n' or a carriage return.

 -In order to implement the hotkey idea, I wrote some CakePHP code to
 generate simple Javascript to capture keycodes from keypress events,
 and then execute for particular characters a Javascript line of the
 form

   location.href = 'http://mysite.com/controller/action/arg';

 which would cause the browser to switch to the specified page. [I used
 the Event class from the Prototype Javascript library together with
 CakePHP's Javascript Helper. I've attached an example of the kind of
 Javascript that gets generated to the end of this posting.]

 -When I wrote the hotkey-handling code several weeks ago, it appeared
 to work fine. In fact, it continues to work perfectly for me. Here's
 where it gets weird, though. About 90% of the time, when the product
 director himself tries a hotkey, he ends up on a login screen, as if
 he had been logged out. However, if he hits the back button, and then
 uses the mouse to make a choice on the screen he had been on, that
 works fine. So, he had not in fact been logged out.

 -The product director has so far tried this with 3 different browsers
 (IE, Firefox and Chrome) on 5 different machines in 2 different
 locations, and gotten the same bad behavior in roughly the same 90/10
 bad/good behavior split. There are two other people involved with this
 project, as well. For one of them, like me, the hotkeys have never
 failed, while for the other user hotkey navigation has almost always
 worked, but has in fact failed a few times.

 So, can anyone provide some insight into this situation? Is there any
 reason why routing to a CakePHP page using Javascript's location.href
 should always work for some users, most of the time for other users,
 and rarely for yet others? Is there an alternative way to route to a
 CakePHP page from Javascript? Or is there some other way to implement
 a hotkey capability?

 Thanks in advance for any help or advice you can give.

 BillCavnar
 -
 Example of the generated Javascript code for handling hotkeys:

 script type=text/javascript src=/js/prototype.js/script
 script type=text/javascript
 //![CDATA[
 Event.observe(window, 'load', function() {
   Event.observe(document, 'keypress', function(e){
     var code;
     if (!e) {
       var e = window.event;
     }
     if (e.keyCode) {
       code = e.keyCode;
     } else if (e.which) {
       code = e.which;
     }
     var character = String.fromCharCode(code);
     switch(character) {
       case '1':
         location.href = 'http://http://mysite.com/worksheet/
 show_answer/1';
         break;
       case '2':
         location.href = 'http://http://mysite.com/worksheet/
 show_answer/2';
         break;
       case '3':
         location.href = 

Re: $form-dateTime() field name breaks with 4 or more levels

2009-01-24 Thread RichardAtHome

Hate to do this, but... Bump!

Is this a bug in CakePHP (I'd be surprised if it was as I can't fault
the rest of CakePHP's code) or expected behaviour?

On Jan 23, 3:39 pm, RichardAtHome richardath...@gmail.com wrote:
 Hi all

 I've hit a snag I'm hoping someone can help with. Perhaps one of the
 devs can explain this behaviour?

 ? echo $form-dateTime(a.b.c) ?

 generates (as expected):

 select name=data[a][b][c][day] id=abCDay...

 whereas:

 ? echo $form-dateTime(a.b.c.d) ?

 generates:

 select name=data[a] id=a...

 and

 ? echo $form-dateTime(a.b.c.d.e) ?

 generates

 select name=data[] id=...

 Unfortunately, I'm building a dynamic search form and my code needs 4
 levels:

 $form-dateTime({$model}.nextIndex.{$field_id}.value, DMY, NONE)

 (nextIndex is replaced with a number at runtime)

 I've just tried this with a basic text field ?echo $form-text
 (a.b.c.d.e) ? and got the same results as above.

 What do I do?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



$form-dateTime() field name breaks with 4 or more levels

2009-01-23 Thread RichardAtHome

Hi all

I've hit a snag I'm hoping someone can help with. Perhaps one of the
devs can explain this behaviour?

? echo $form-dateTime(a.b.c) ?

generates (as expected):

select name=data[a][b][c][day] id=abCDay...

whereas:

? echo $form-dateTime(a.b.c.d) ?

generates:

select name=data[a] id=a...

and

? echo $form-dateTime(a.b.c.d.e) ?

generates

select name=data[] id=...



Unfortunately, I'm building a dynamic search form and my code needs 4
levels:

$form-dateTime({$model}.nextIndex.{$field_id}.value, DMY, NONE)

(nextIndex is replaced with a number at runtime)

I've just tried this with a basic text field ?echo $form-text
(a.b.c.d.e) ? and got the same results as above.

What do I do?
--~--~-~--~~~---~--~~
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: Fatal error: CakePHP core could not be found

2009-01-23 Thread RichardAtHome

You will need to clear our the files in your app/tmp directory. Leave
the directories intact, just remove the files.

On Jan 23, 1:42 pm, Mono sirmonit...@gmail.com wrote:
 Hello!!

 My Cake-App works perfect on my localhost, but after i uploaded it i
 become the error msg:

 Warning: Failed opening 'cake/bootstrap.php' for inclusion
 (include_path='/mnt/web2/13/38/51150638/htdocs/plPATH_SEPARATOR/mnt/
 web2/13/38/51150638/htdocs/pl/app/PATH_SEPARATOR.:') in /mnt/
 web2/13/38/51150638/htdocs/pl/app/webroot/index.php on line 84

 Fatal error: CakePHP core could not be found. Check the value of
 CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to
 the directory containing your /cake core directory and your /vendors
 root directory. in /mnt/web2/13/38/51150638/htdocs/pl/app/webroot/
 index.php on line 85

 ...and i dont know why.

 if i do a var_dump on the define CAKE_CORE_INCLUDE_PATH in the file
 app/webroot/index.php i get:

 string(34) /mnt/web2/13/38/51150638/htdocs/pl

 ... and that looks ok. The url to my app is:http://cbmono.de/pl/
 similar as on my localhost:http://localhost/pl/

 Could anyone help me pls?

 Best regards!
 claudio.
--~--~-~--~~~---~--~~
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: Counting Tags. What is the find() syntax?

2009-01-19 Thread RichardAtHome

@Webweave. That's the article I was struggling with. I'll drink a few
more cups of coffee and have another look.

I'll use your select field tip in the meantime.

On Jan 18, 3:46 pm, Webweave webwe...@gmail.com wrote:
 Easiest way I've found is just to include a select field in the query
 like:

 $data = $this-find(all, array(
                         fields=array(
                                 Tag.id,
                                 Tag.name,
                                 (select COUNT(Article.id) from
 articles Article where Article.tag_id = Tag.id and Article.published =
 1) AS tag_count
                                  )));

 Here's an example of using the 
 finderQuery:http://groups.google.com/group/cake-php/msg/c10840be78a34df0

 On Jan 17, 12:55 am, RichardAtHome richardath...@gmail.com wrote:

  Given the following Model relations:

  article -- HABTM (articles_tags) -- tag

  How do I fetch back a list of Tags with the count of associated
  Articles?

  I've tried (in the Tag Model):

                  $data = $this-find(all, array(
                          fields=array(
                                  Tag.id,
                                  Tag.name,
                                  COUNT(Article.id) AS tag_count
                          ),
                          conditions=array(
                                  Article.published = 1
                          ),
                          group = Tag.id
                  ));

  But that doesn't generate the HABTM join in the SQL:

  SQL Error: 1054: Unknown column 'Article.id' in 'field list'
  SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count
  FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY
  `Tag`.`id`

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



Re: Counting Tags. What is the find() syntax?

2009-01-19 Thread RichardAtHome

I couldn't see the point in a separate tags table

What about 2 articles that share the same tags? You run the risk of
tagging either with one or 1 (for example) or CakePHP,
cakephp, Cakephp, cakePHP...

There's an awful lot of processing happening in your foreach loop.
What happens when you get 10,000 records? or 100,000? A relational
database eats this kind of aggregation for breakfast :-)

On Jan 19, 4:20 pm, leo ponton@gmail.com wrote:
 I couldn't see the point in a separate tags table, so I have a tags
 column on the table that requires it.

 To retrieve the tags and tag count, I do this:

         function getTagsWithCounts($conditions = array())
         {
                 // Return assoc_array(tags) for all records in
 database. Keyed on tagword,
                 // value = tagcount

                 $tagCounts = array();
                 $tagRows = $this-findAll($conditions, 'tags');

                 foreach ($tagRows as $row):
                   $tags = explode(',',$row['Event']['tags']);
                   foreach ($tags as $tag):
                     $tag = trim($tag);
                     if (array_key_exists($tag, $tagCounts)):
                       $tagCounts[$tag]++;
                     else:
                       $tagCounts[$tag] = 1;
                     endif;
                   endforeach;
                 endforeach;
                 return $tagCounts;
         }

 It's simple and it is working on two commercial sites, soon to be four.
--~--~-~--~~~---~--~~
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: Counting Tags. What is the find() syntax?

2009-01-18 Thread RichardAtHome

@Miles: Do you have a link to some example code that illustrates
finderQuery. The stuff I've seen online was a bit impenetrable :-(

@Amit: Yes, I *could* write the SQL by hand, but I was hoping there
was a more 'cakey' way :-)

On Jan 17, 10:34 am, Amit Badkas amitrb...@gmail.com wrote:
 For our photoblog, athttp://cheesecake-photoblog.org/demo/tags/, we use
 something like following query

 SELECT tags.*, COUNT(photos_tags.tag_id) AS totalPhotos FROM tags LEFT JOIN
 photos_tags ON tags.id = photos_tags.tag_id GROUP BY tags.id ORDER BY
 tags.tag ASC

 to generate tag cloud

 Hope this helps

 2009/1/17 RichardAtHome richardath...@gmail.com





  Given the following Model relations:

  article -- HABTM (articles_tags) -- tag

  How do I fetch back a list of Tags with the count of associated
  Articles?

  I've tried (in the Tag Model):

                 $data = $this-find(all, array(
                         fields=array(
                                 Tag.id,
                                 Tag.name,
                                 COUNT(Article.id) AS tag_count
                         ),
                         conditions=array(
                                 Article.published = 1
                         ),
                         group = Tag.id
                 ));

  But that doesn't generate the HABTM join in the SQL:

  SQL Error: 1054: Unknown column 'Article.id' in 'field list'
  SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count
  FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY
  `Tag`.`id`

  Thanks in advance :-)

 --
 Amit

 http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas
--~--~-~--~~~---~--~~
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: beginner: single view for index and add?

2009-01-18 Thread RichardAtHome

The simplest solution is to copy the code from the add method of the
controller to the index method.

Not looked at the blog code for quite a while, but it would go
something like this:

function index() {

  if ($this-data) {
// add form submitted
$this-Model-create();

if ($this-Model-save($this-data)) {
// data saved
}
else {
// data failed to save
}

// rest of index code
$this-set(data, $this-Model-find(all));

}


On Jan 18, 10:39 am, Zach zachr...@gmail.com wrote:
 Hi All. I've gone through the blog tutorial and i'm trying to make my
 first cake site. My site is more or less the same as the blog
 tutorial, except I want the add view and the index view to be the same
 thing (one page that collects and displays posts, like a comment
 thread).

 Do i have to have an add view? Can I redirect somehow?
--~--~-~--~~~---~--~~
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: edit function is not working

2009-01-18 Thread RichardAtHome

Are you including the Model.id field in your edit form view?

?php echo $form-create(Model); ?
?php echo $form-input(Model.id); ? -- important line
?php ... rest of fields in your form ?
?php echo $form-end(Submit); ?

On Jan 16, 4:37 pm, mona poojapinj...@gmail.com wrote:
 Here is my edit function code i don't know where i mistaken if i edit
 my record it added automatically one new record and i didn't get
 validation messages also below is my edit function code
 function edit($id = null){
         $this-set('sections', $this-Entry-Section-find
 ('list',array
 ('fields'='Section.section','Section.id','recursive' = 1,'page' =
 1,)));
         if (empty($this-data)){
         if (!$id){
         $this-Session-setFlash('Invalid id for Entry');
         $this-redirect('/entries/index');
         }
         $this-data = $this-Entry-read(null, $id);
         }
         else{
     $query=mysql_query(select max(counter) from entries);
    $row=mysql_fetch_array($query);
         $co=$row[0]+1;
     $q=mysql_query(update entries set counter=$co where id=$id);
         if ($this-Entry-save($this-data)){
         $this-Session-setFlash('The Entry has been saved');
         $this-redirect('/entries/index');
         }
         else{
         $this-Session-setFlash('Please correct errors below.');
         }
         }
         }

 can anybody tell me where i m mistaken this function doesn't edit my
 record instead of that it will added one new record in my table
--~--~-~--~~~---~--~~
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: Quote marks in model names and Use of undefined constant notices

2009-01-18 Thread RichardAtHome

It's for this very reason I keep championing the case to have ALL
source code on a web page to be presented in a plain text textarea!

And don't get me started on 'smart quotes'! ;-)

On Jan 16, 8:49 pm, clarkphp clark.evere...@gmail.com wrote:
 Figured it out, with the help of a sharper pair of eyes than mine. It
 turns out that the original code did in fact come from a web page -
 the CakePHP manual (I copied, pasted, and edited the table name and
 other code). When I pasted into my text editor, I didn't notice that
 the quote marks were not the regular single quotes. All is good now.

 Thanks,
 Clark-

 On Jan 16, 7:45 am, clarkphp clark.evere...@gmail.com wrote:

  Hello Martin,
  Thanks for your reply.  My files are all UTF-8.  And, no - never touch
  MS Word - pasted in from browser.  Running Linux on dev and production
  boxes.
  I also looked at Firefox View Source.  The leading mysterious quote
  mark is the upward curving opening quote, and the trailing one is the
  downward curving closing quote mark - I'm looking for the character
  numbers.  My source file is using the regular single quote found on
  the keyboard (not the backtick).

  See how these characters are inserted inside my vanilla-flavored
  single-quoted string containing the model name, which the inflector is
  converting to a table name?  All references to the model name in my
  source files are using the regular single quote character.  It appears
  that the undesired characters are being inserted before and after the
  contents of that string by Cake.  I've traced with a debugger to find
  where the transformation is happening, but am only close to it;
  haven't nailed it yet.

  One thing I've found is that with PHP error_reporting set high enough,
  Cake generates a fair number of E_NOTICES regarding undefined
  constants - the ticket system shows these being fixed on a case-by-
  case basis. I think those errors are not necessarily related to this
  problem.

  Thanks again.  Does this generate any ideas from you or other readers?
  - Clark

  On Jan 16, 2:30 am, Martin Westin martin.westin...@gmail.com wrote:

   Hi Clark,
   Looks to me like the thing you are missing is the small problem your
   source-file has with its quotes.

   Use of undefined constant â Organizationâ
   This suggests that your modelname is not in fact enclosed by single
   quotes but some other glyph that looks like it but really has another
   ASCII code. You may have pasted the line of code from a browser or
   (god forbid) Word and got the strange character in your file that way.
   If the quotes are not real quotes then PHP will interpret this as
   you trying to use a constant.

   While you are at it make sure the charset of the php file is not
   something strange.

   /Martin

   On Jan 16, 12:35 am, clarkphp clark.evere...@gmail.com wrote:

Check out the extra quotes in the model name in the WHERE clause
below:

SELECT `Organization`.`name`, `Organization`.`description` FROM
`organizations` AS `Organization`   WHERE `‘Organization’`.`status` =
'inactive'   ORDER BY `Organization`.`name` asc

I've used SimpleTest before, but am now beginning to use it in the
context of CakePHP's testing framework.  All test cases that involving
a model are failing because the model names are getting enclosed with
single quotes, which produces table names in database queries that of
course don't exist.  For example:

App::import('Model', 'Organization');

class OrganizationTestCase extends CakeTestCase
{
    public $useTable = 'organizations';
    public $fixtures = array('app.organization');

    public function testInactive()
    {
        $this-Organization = ClassRegistry::init('Organization');

        $result = $this-Organization-inactive(array('name',
'description'));
        $expected = array(
           array('Organization' = array('name' = 'Test Company
Name', 'description'    = 'Mortgages'))
        );
        $this-assertEqual($result, $expected);
    }

}

results in a failed assertion and two E_NOTICES.

The failed assertion:
Equal expectation fails as [Boolean: false] does not match [Array: 1
items] at [/usr/local/apache2/vhosts/dev-obfuscated.com/app/tests/
cases/models/organization.test.php line 19]

The Errors:
Unexpected PHP error [Use of undefined constant â Organizationâ -
assumed 'â Organizationâ '] severity [E_NOTICE] in [/usr/local/
apache2/vhosts/dev-obfuscated.com/cake/libs/class_registry.php line
134]

Unexpected PHP error [span style = color:Red;text-align:leftbSQL
Error:/b 1054: Unknown column 'Ã¢â ¬Ë Organizationâ⠬⠢.status'
in 'where clause'/span] severity [E_USER_WARNING] in [/usr/local/
apache2/vhosts/dev-obfuscated.com/cake/libs/model/datasources/
dbo_source.php line 514]

The use (or lack of) $useTable in the app/models or tests/cases/models
code 

Re: How to avoid repetition with dynamic content

2009-01-18 Thread RichardAtHome

Here's how I break it down:

1) Anything thats on *every* page goes in the layout

2) Anything thats repeated on more than one page but not on all, goes
in an element (and imported into the view with echo $this-element
(foo))

3) Anything that's unique to a page goes in the view.

So, as an example. Take a blog article page with a header, footer,
article and a sidebar with a tag cloud that displayed on the index 
view pages:

1) Header  footer goes in the layout

2) Tag cloud goes in an element and is imported in the index and view
views.

3) The article itself goes in the view.

Hope this helps :-)


On Jan 18, 3:06 pm, Bankai hgnelso...@gmail.com wrote:
 So, I have all the html laid out.

 I want to make it so that I don't have to copy and paste  all the html
 every time I create a new page or change the layout in each and every
 page every time I make a change in the html code.

 I used to do that in the past with just plain PHP, but I want to make
 it using cakephp.

 I am having a hard time doing it with cakephp.

 Could somebody guide me in right direction? maybe some tutorial
 anywhere? I tried some Dynamic Content tutorials but it doesn't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Counting Tags. What is the find() syntax?

2009-01-17 Thread RichardAtHome

Given the following Model relations:

article -- HABTM (articles_tags) -- tag

How do I fetch back a list of Tags with the count of associated
Articles?

I've tried (in the Tag Model):

$data = $this-find(all, array(
fields=array(
Tag.id,
Tag.name,
COUNT(Article.id) AS tag_count
),
conditions=array(
Article.published = 1
),
group = Tag.id
));

But that doesn't generate the HABTM join in the SQL:

SQL Error: 1054: Unknown column 'Article.id' in 'field list'
SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count
FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY
`Tag`.`id`

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



Re: Help needed with an error

2008-09-26 Thread RichardAtHome

Just come across this when I renamed my web root folder.

I think this is to do with me using APC and isn't a CakePHP issue (now
that you have deleted the cache).

Restart Apache. This will clear the APC cache.

On Sep 26, 2:17 pm, Eemerge [EMAIL PROTECTED] wrote:
 just cleared them, same thing. still not working. I read somewhere i
 should define the CAKE_INCLUDE_PATH (or something like this)
 manually... to what should it point? what path?

 On Sep 26, 2:02 pm, grigri [EMAIL PROTECTED] wrote:

  Have you tried emptying the cache files? If the directory names have
  changed since cake's cache was built then this is what would happen.

  On Sep 26, 11:27 am, Eemerge [EMAIL PROTECTED] wrote:

   Hello,

   I would like some help with the following error:

   Warning: require(cake/bootstrap.php) [function.require]: failed to
   open stream: No such file or directory in /home/mainfram/public_html/
   shoplog/app/webroot/index.php on line 79

   Fatal error: require() [function.require]: Failed opening required
   'cake/bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/
   home/mainfram/php') in /home/mainfram/public_html/shoplog/app/webroot/
   index.php on line 79

   The strange thing about is that, 2 weeks ago it was working ,
   everything was ok, there were some problems on the hosting server, and
   now it stopped working.

   If anyone cane help, i'd really appreciate it.

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



Re: flood control?

2008-09-26 Thread RichardAtHome

or... redirect to another page (a thank you page perhaps presuming
this is a contact form) after you have sent the mail.


On Sep 26, 8:42 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Looking at some of the web-mail apps I use many seem to handle this
 using a combination of very clear visual indicators, disabling of
 submit-buttons and sending with ajax.
 Ajax also help prevent back-button accidents which is nice.

 On Sep 26, 7:45 am, rocket [EMAIL PROTECTED] wrote:

  mktime.. good idea.
  thanks

  On Sep 26, 1:23 am, Marcelius [EMAIL PROTECTED] wrote:

   You can't make sessions count down. Instead of setting 30sec in your
   session,store mktime() for the current time. Next time a user hits
   the send button you check the current time with the time you allready
   had stored in your session. Note that if a user deletes the browsers
   cookie, session get lost so they can pass that check.

   On 26 sep, 06:26, rocket [EMAIL PROTECTED] wrote:

hey guys
i implemented a simple mail system in my site and was wondering what i
ought to do for flood control. I dont' want people to keep hitting
refresh after they hit send thus spamming...

I was thinking of doing something like
$this-Session-write('Timeout', 30);

To simulate a 30 second countdown then just checking this timout
before another post is allowed... but I dont know how to make sessions
count down.

any ideas are appriciated!

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



Re: Parameter passing in URL

2008-09-26 Thread RichardAtHome

or store the id in the session?

On Sep 26, 12:17 pm, Daniel Süpke [EMAIL PROTECTED] wrote:
 Thank you very much, I'll have a look at that!

 Best Regards,
 Daniel Süpke

 [EMAIL PROTECTED] wrote:

  I haven't done exactly that but I think you could set all urls and
  links using the array notation. The array could then also be pre-
  populated with the parameter you want to keep in each request. (Pre-
  populated in some central place like AppController::beforeFilter
  before any links are generated)

  On Sep 25, 1:23 pm, Daniel Süpke [EMAIL PROTECTED] wrote:
  Hi,

  we are using CakePHP 1.2 and I was wondering how it could be achieved
  to pass a parameter along every URL. We have a parameter set to an ID
  and it needs to be included in every URL in the application.

  Now, the first solution was to create a LinkHelper which added the
  location via $_GET, but this is not working when forms are validated
  by Cake, since then the url is not going via the LinkHelper.

  So, is there any easy way to pass around a parameter in the URL in the
  entire application?

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



Re: PLease help, 3 days struggle with 'simple' authentication

2008-09-24 Thread RichardAtHome

 $this-Auth-deny('admin', 'accnt', 'faq'); // does not work

This doesn't work because the 'action' for all views in the pages
controller is 'display' not 'admin', 'accnt'

$this-Auth-deny(display) would work, but it would deny ALL views
handled by the pages controller.

Your workaround is a good compromise. Or you could make your own
dedicated MyPagesController to group all these pages together.

On Sep 24, 11:12 am, Gabriel Kolbe [EMAIL PROTECTED] wrote:
 S'ok, I created 'fake' functions in the user controller, then added
 the views to the users views, then take the Authentication process
 from the app_controller to the users_controller..

 On Wed, Sep 24, 2008 at 10:54 AM, gabriel [EMAIL PROTECTED] wrote:

  This is my current code:
  class AppController extends Controller {

         var $components = array('Auth');

   function beforeFilter() {
     $this-Auth-authorize = 'controller';
     $this-Auth-allow('*');
     $this-Auth-deny('admin', 'accnt', 'faq'); // does not work
     }

   function isAuthorized() {
     if ($this-Auth-user('role') == 'admin') {
         $this-Auth-allow('admin');
     }

   }
  }

  What I want to do is something like the following:
   function beforeFilter() {

     $this-Auth-authorize = 'controller';
     $this-Auth-allow('pages/faq', 'pages/aboutus', 'users/
  register');
     $this-Auth-deny('pages/accnt', 'pages/admin', 'categories/
  edit');
     }

   function isAuthorized() {
     if ($this-Auth-user('role') == 'admin') {
         $this-Auth-allow('pages/admin', 'categories/edit');
     }
        $this-Auth-allow('pages/accnt');
   }
  }

  NOTE: the pages does not have a model or controller..I HAVE read the
  cookbooks severaltimes, served the Cakegroup, posted several message,
  got different replies, but just can' t seem to find a answer to
  this... I would be grateful if someone can actually show me ..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bulk load data into CakePHP?

2008-09-24 Thread RichardAtHome

If this is a once only import (populate initial db), I'd stick to
using mysql's data import command line tool and move onto something
more fun.

If it's something that needs to be run repeatedly e.g. a user uploads
a file that needs to be imported then write a custom method in the
Model that uses mysql's LOAD DATA INFILE sql:

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

e.g.

function importCsv($csv_filename) {

sql$ = LOAD DATA INFILE '{$csv}' INTO TABLE {$this-alias};

$this-query($sql);

}

...code typed straight into google groups, may need tweaking ;-)

It might be advisable to wrap the query() call with a setTimeout if
its going to take a while...

You would call it from your controller with:

$this-Model-importCsv($filename);



On Sep 24, 7:25 am, Mike [EMAIL PROTECTED] wrote:
 Thanks for the tip!  In the previous, non-Cake version of the app, I
 did that exactly, so it shouldn't be too too tough to get it up and
 running again.  I was kinda avoiding SQL b/c it seemed like the Cake
 way should be to push it through the Cake layer  let CakePHP make it
 automagically happen.  Hearing that raw SQL is actually the right way
 is actually really helpful :)

 If you don't mind my asking a couple more questions -  how does one
 know where the boundary should be?  I mean, aside from exceeding
 max_execution time and/or running out of memory - how would I know
 where to draw the boundary between 'small enough for Cake' vs. 'needs
 raw SQL' when designing my app?  (And what does a normal app do if a
 user happens to show up with an unexpectedly huge data set?)

 Also, what sort of data sets is Cake intended to support?  I'm writing
 the app to support my teaching, so having 30 people in a class, with
 10-20 homeworks/exercise sets to hand in (each of which might have 2-3
 versions stored), so it's conceivable that Cake might auto-magically
 pull 600-1,200 records (even if fairly few / none of them are used in
 any given view).  One of the things I really liked about Cake was that
 I could set recursive = 2 (or 3), and have it magically pull
 everything I needed out of the DB (in my raw PHP app, I figured it was
 time to look at a framework when I started to move towards an OOP-y
 iterator approach for dealing with all my lists of data :)  )

 Thanks again for the quick reply - I appreciate the 'ok' from someone
 who knows more about this than I do! :)
 --Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakephp application templates

2008-09-23 Thread RichardAtHome

To be honest, you would be much better if you created your own.

All the components are there already in Cake, you just have to learn
how to glue them together.

If you don't, you'll come unstuck when it comes to something a little
more challenging.

Happy Baking!

On Sep 23, 11:24 am, forrestgump [EMAIL PROTECTED] wrote:
 Hey,
  I was wondering if anyones got any good sites for application
 templates for cakephp...like templates having pre-programmed login/
 logout/sessions maintainancemenu creation role based management
 etc...

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



Re: To model or not to model

2008-09-23 Thread RichardAtHome

Also worth noting: A controller can have multiple Models.

Which model would $this-find() use?

On Sep 23, 12:28 pm, dr. Hannibal Lecter [EMAIL PROTECTED]
wrote:
 Well, calling find() in a controller is not a violation, but not the
 best practice if overused.

 Of course, calling find() from a controller is the fastest way to get
 your data, but usually, the find() call has other stuff around it,
 stuff that might be common to each call. The idea is to make fat
 models, thin controllers, meaning that you put as much as you can in
 your models.

 Maybe an example is better. Let's say you have a certain criteria for
 getting an article from the Article model. You can call this from a
 controller each time you want to get an article:

 $article = $this-Article-find
         (
                 'first',
                 array
                 (
                         'conditions' = array('Article.slug' = $slug),
                         'contain' = array('ArticleCategory', 'Rating')
                 )
         );

 or you can make it cleaner and easier by declaring a function in your
 model, for example getArticle:

 function getArticle($slug)
 {
         $_slug = Sanitize::escape($slug);

         return $this-find
                 (
                         'first',
                         array
                         (
                                 'conditions' = array('Article.slug' = 
 $_slug),
                                 'contain' = array('ArticleCategory', 
 'Rating')
                         )
                 );

 }

 this makes your controller much thinner and easier to follow:

 $article = $this-Article-getSingle($slug);

 All you have to remember is that all apps work with some sort of data,
 and in Cake, models work with data, not controllers.

 I hope that helps a bit. ;)

 On Sep 23, 11:33 am, forrestgump [EMAIL PROTECTED] wrote:

  Hey guys,
   Considering the fact that CakePhp follows the MVC architecture, id
  like to know...y we dont make function calls such as $this-find(where 
  id=xyz) from function blocks typed out in Models rather

  than controllersim sure there is a logical reason to it...but
  someone asked me this question and i could not give her a good enuf
  answerdoes making function calls to queries like find(), save()
  work better in models or controllers?.and is it good practice to
  pass conditions in your function call while using it in a controller?
  eg find(where id=1) ;

  Does using $this-find() in controller violate the MVC architecture in
  any manner?

  Can someone please clarify these question for us?

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



Form type='get' and date fields

2008-09-22 Thread RichardAtHome

I'm trying to create a bookmarkable search results page. I have the
following form so I am using 'get' search form:

?php echo $form-create(Event, array(action=search,
type=get)) ?
?php echo $form-input(Event.start_date) ?
?php echo $form-end(search) ?

When the form is posted, the URL looks like this:

http://www.example.com/events/search?event_name=location_name=start_date=09start_date=22start_date=2008start_date=02start_date=33start_date=pm

Which makes it impossible to work out the date that was submitted
because the last query parameter overwrites the previous ones!

$this-params['url']:

[url] = events/search
[start_date] = pm

If I use 'post' as the form type, Cake separates the date fields
correctly, but the search result page isn't bookmarkable (the url
becomes http://www.example.com/events/search).

Is there a workaround for this? Or am I doing it completely wrong? :-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form type='get' and date fields

2008-09-22 Thread RichardAtHome

Note: this groups post:

http://groups.google.com/group/cake-php/browse_thread/thread/c05c03e397549dde/57f2e4d6b3f7fb0e?lnk=gstq=form+get+date#57f2e4d6b3f7fb0e

Sounds like the same problem, but has no replies...

On Sep 22, 2:41 pm, RichardAtHome [EMAIL PROTECTED] wrote:
 I'm trying to create a bookmarkable search results page. I have the
 following form so I am using 'get' search form:

 ?php echo $form-create(Event, array(action=search,
 type=get)) ?
 ?php echo $form-input(Event.start_date) ?
 ?php echo $form-end(search) ?

 When the form is posted, the URL looks like this:

 http://www.example.com/events/search?event_name=location_name=start...

 Which makes it impossible to work out the date that was submitted
 because the last query parameter overwrites the previous ones!

 $this-params['url']:

             [url] = events/search
             [start_date] = pm

 If I use 'post' as the form type, Cake separates the date fields
 correctly, but the search result page isn't bookmarkable (the url
 becomeshttp://www.example.com/events/search).

 Is there a workaround for this? Or am I doing it completely wrong? :-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simply aligning form-input fields and labels nicely....

2008-09-22 Thread RichardAtHome

Note:

div class=labelSomething/div
div class=inputfieldinput type=text //div
div class=labelSomething2/div
div class=inputfieldinput type=text //div

..will create an invalid form: You MUST have a label linked to every
input element.

Here's a snippet from my own cake.generic.css:

/*
 * forms
 */
#content form {
padding: 16px;
background-color: #DDD;
-moz-border-radius: 16px;
}
#content fieldset {
border: 0;
}
#content legend {
color: #06C;
font-size: 3em;
line-height: 1.2em; color : #06C;
font-weight: bold;
}
#content form div.input {
clear: both;
margin: 8px 0;
background-color: #EEE;
padding: 2px;
-moz-border-radius: 4px;
border: 1px solid #EEE;
}
#content form div.input.required {
font-weight: bold;
}
#content form div.input.error {
border-color: #900;
background-color: #FCC;
color: #900;
}
#content form div.input label {
float: left;
width: 14em;
margin-right: .5em;
}
#content form div.text input,
#content form div.password input,
#content form div.select select,
#content form div.datetime select,
#content form div.textarea textarea {
border: 1px solid #CCC;
padding: 2px;
font-size: 1.2em;
font-family: verdana, sans-serif;
}
#content form div.textarea textarea {
width: 40em;
height: 20em;
}
#content form option {
padding-right: .5em;
}
#content form div.input.error div.error-message {
margin-left: 14.5em;
padding: 2px 2px 2px 22px;
background: url(../img/icons/error.png) no-repeat 2px center;
}
#content form div.input input.form-error {
border-color: #C00;
}
#content form div.submit input {
margin-left: 7.25em;
border: 4px solid #FFF;
padding: 2px 4px;
background: #06C none no-repeat 4px center;
color: #FFF;
font-weight: bold;
font-size: 2em;
cursor: pointer;
-moz-border-radius: 8px;
}
#content form div.submit input:hover {
background-color: #9C9;
color: #333;
text-decoration: none;
}

I'm preparing an article for the Bakery about styling Cake layouts and
views as we speak...

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



Re: cakephp email component

2008-09-22 Thread RichardAtHome

I suspect you are trying to SMTP to gmail or something similar.

CakePHP doesn't support the encyption required to connect to these
types of SMTP server.

The Bakery has some useful articles for using 3rd party mail
components that support encrypted SMTP

On Sep 22, 10:35 am, Predominant [EMAIL PROTECTED] wrote:
 Hey base64,

 This message 220-We do not authorize .. is being produced by one of
 the mail servers charged with delivering your mail message.
 Try using a mail server you have authority to use.

 Cheers,
 Predom.

 On Sep 22, 3:32 am, base64 [EMAIL PROTECTED] wrote:

  Dear all,

  I'm using CakePHP Email component,  when i sent email and i set smtp_errors;

  $this-set('smtp-errors', $this-Email-smtpError);

  the variable *smtp-errors* return : *220-We do not authorize the use of this
  system to transport unsolicited, *and my email did'not sent.*

  *how to solved this problem?, and what can I do to send email using CakePHP
  email component?. I had follow this instruction step by step : 
  *http://book.cakephp.org/view/176/Email*

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



Re: Form type='get' and date fields

2008-09-22 Thread RichardAtHome

Aye, I thought of that but it feels a bit 'messy' :-(

On Sep 22, 3:23 pm, Daniel Hofstetter [EMAIL PROTECTED] wrote:
 Hi Richard,



  I'm trying to create a bookmarkable search results page. I have the
  following form so I am using 'get' search form:

  ?php echo $form-create(Event, array(action=search,
  type=get)) ?
  ?php echo $form-input(Event.start_date) ?
  ?php echo $form-end(search) ?

  When the form is posted, the URL looks like this:

 http://www.example.com/events/search?event_name=location_name=start...

  Which makes it impossible to work out the date that was submitted
  because the last query parameter overwrites the previous ones!

  $this-params['url']:

              [url] = events/search
              [start_date] = pm

  If I use 'post' as the form type, Cake separates the date fields
  correctly, but the search result page isn't bookmarkable (the url
  becomeshttp://www.example.com/events/search).

  Is there a workaround for this? Or am I doing it completely wrong? :-S

 You could post your form to an action which then uses the form data to
 create the url of the result page and redirects to it.

 Hope that helps!

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



Re: Accessing multiple databases within a single Mysql instance in a single query.

2008-09-22 Thread RichardAtHome

Have you checked out Easysoft's SQLEngine? It allows heterogeneous
joins across databases and even across different RDBMs?

As an alternative, you could always use $this-model-query(); and
enter the SQL by hand. You'll loose a lot of cakey goodness though :-(

On Sep 22, 3:19 pm, Bookrock [EMAIL PROTECTED] wrote:
 I am facing same problem

 On Sep 21, 5:56 pm, Rick [EMAIL PROTECTED] wrote:

  I tried that technique but it did not work.  It appears that you can't
  havemultipleuseDBConfigs in a single query.  This seems reasonable
  since you also can't do a raw select usingmultipleconnections which
  is what the useDBConfigs give you (I think).

  Richard

  On Sep 20, 5:56 pm, Adam Royle [EMAIL PROTECTED] wrote:

   What you need to do is set $useDBConfig for each model.

   var $useDBConfig = 'A';

   then in your DATABASE_CONFIG you would use

           var $A = array(
                   'driver' = 'mysql',
                   'persistent' = false,
                   'host' = 'localhost',
                   'login' = 'username',
                   'password' = 'password',
                   'database' = 'A',
                   'prefix' = '',
           );

   Adam

   On Sep 21, 4:24 am, Rick [EMAIL PROTECTED] wrote:

I've got an existing MySql instance that contains 4 databases (lets
call them A, B, C  D).  Each has tables as you would expect.  For
this post lets say tables are named like table1, table2 etc.. in each
   database.  My single user/password has access to all databases in the
instance.

My problem is I need to query across several databases.  This is the
way I would do this with a raw query:

select * from A.table1 as t1, B.table2 as t2
where t1.id = t2.id

I haven't been able to do this through any combination of model
attributes.  Naturally I thought that

var $useTable = A.table1

in The table1 model and

var $useTable =B.table2

in the table2 model would work - alas no it does not.

I've also tried using the prefix attribute and that doesn't do it
either.

Is there some way to do this in Cake or do I need to forget the models
and just do raw sql queries in the controllers?  It seems to me this
is just an arbitrary restriction in the model code.

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



Re: Using Views in database over a legacy database

2008-09-19 Thread RichardAtHome

You can set up your models to use any non-cake table structures and
naming styles.

See http://book.cakephp.org/view/71/Model-Attributes for more details.

On Sep 18, 9:31 am, Laurent Bois [EMAIL PROTECTED] wrote:
 Hi

 We currently have a data model with table names that don't follow
 CakePHP conventions.
 As we do with Rails, one technique to use (when application is read-
 only, and that's our case) is to create views in database over this
 legacy tables.
 First i did this.
 Then i wanted to unit test my new renamed data model.
 - i've recreated my models using renamed keys in my views.
 - i've recreated my test cases.

 After first test launched, what i see for the first model, is that the
 Testing framework create my test tables with the keys of the table,
 mapped by my view.
 And fixtures couldn't be loaded, and test is not run.

 here my legacy table :
 SL01 :
  N_NUME_CLIE varchar(6)
  L_CONN_NOM  varchar(40)
  L_CONN_PASS varchar(40)

 Here my view Users
 Create view Users as select n_nume_clie id, l_conn_nom, l_conn_pass
 from sl01;

 Here the trace in my test case (creation of the table for testing):
 CREATE TABLE `test_utilisateur_tests` ( `N_NUME_CLIE` varchar(6) NOT
 NULL, `L_CONN_NOM` varchar(40) NOT NULL, `L_CONN_PASS` varchar(40) NOT
 NULL );

 It seems to be a problem with the SimpleTest framework

 Does CakePHP support Models mapping database Views?
 Thanks

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



Re: Association question

2008-09-19 Thread RichardAtHome

In exactly the same way :-)

You join table (products_sizes) would hold the stock field

id (PK)
product_id (FK)
size_id (FK)
stock (INT)

On Sep 17, 9:27 pm, VitillO [EMAIL PROTECTED] wrote:
 Hi, i have the following structure for a tshirt online store:

 Product HABTM Size
 Size HABTM Product

 Association table:
 products_sizes

 The problem is, i need a stocks system.

 For example, say i have 50 pieces of S (size) for a particular tshirt,
 before using cake i had a column 'stock' in the association table, so
 i could retrieve the particular stock of that size, for that product,
 but now with cake i dont know how i should make the association.

 Any help?

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



Re: problem using find method in cakephp with conditions contains 'LIKE'

2008-09-17 Thread RichardAtHome

'conditions' = array('Book.title LIKE' = 'A%'),

The condition has been moved to the left hand side as a security
measure.

On Sep 17, 8:14 am, jittos [EMAIL PROTECTED] wrote:
 i am a new comer in cakephp.. i am going through some tutorials in
 cakephp.. i found one problem i want to write find method for the
 following query

 SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
 FROM `books` AS `Book`
 WHERE `Book`.`title` LIKE 'A%'
 ORDER BY `Book`.`isbn` DESC
 LIMIT 2;

 i wrote

 find(
 'all',
 array(
 'conditions' = array('Book.title' = 'LIKE A%'),
 'fields' = array(
 'Book.isbn',
 'Book.title',
 'Book.author_name'
 ),
 'order' = 'Book.isbn DESC',
 'limit'=2
 )
 );

 but it create a query like this..

 SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
 FROM `books` AS `Book`
 WHERE `Book`.`title` = 'LIKE A%
 ORDER BY `Book`.`isbn` DESC
 LIMIT 2;

 i.e, LIKE keyword is not working properly... did i do anything
 wrong?...
 plz help me if anybody have any idea about it...
 thanks,
 jittos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $html-link default titles

2008-09-12 Thread RichardAtHome

Which accessibilty checkpoint requires you to have a title attribute
on every hyperlink?

The nearest I can find is checkpoint 13.1:
http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-meaningful-links

13.1 Clearly identify the target of each link. [Priority 2]
Link text should be meaningful enough to make sense when read out of
context -- either on its own or as part of a sequence of links. Link
text should also be terse.
For example, in HTML, write Information about version 4.3 instead of
click here. In addition to clear link text, content developers may
further clarify the target of a link with an informative link title
(e.g., in HTML, the title attribute).

'may' does not mean 'must' ;-)

On Sep 12, 3:10 am, AussieFreelancer [EMAIL PROTECTED]
wrote:
 I can see your point about repeating it twice, I don't understand how
 different accessibility applications work, but I know that it is part
 of the WAI and Section 508 accessibility standards that all href
 elements should have the title attribute, and all images should have
 an alt tag, even if it is empty. This is what has made me think of
 this, as I am a website developer, and to pass these accessibility
 tests, I need to include the title in every link - which is not too
 much of a problem, just that I figure having it as a default would
 reduce the amount of code I need to write :D

 Also, most links will have the same title text as the link text
 anyway, wouldn't they? Certainly with navigation, Home is Home, About
 Us is About us... As I say, I don't understand how the applications
 work exactly, I just want to be able to do what I can to ensure that
 my websites are accessible to as many people as possible.

 Thanks

 Patrick

 On Sep 12, 9:52 am, Adam Royle [EMAIL PROTECTED] wrote:

  You can override cakephp's defualt functionality in your AppHelper if
  you want to do this.

  I don't think it should be the standard, as there are situations where
  you might not want this. Additionally, why do you need to repeat the
  link text in the link title? Won't this effectively cause the
  screenreader to speak the link text twice?

  Cheers,
  Adam

  On Sep 12, 11:38 am, AussieFreelancer

  [EMAIL PROTECTED] wrote:
   I have just done a quick google search, and can't seem to see anything
   about this, but I have been thinking for some time now, that for
   accessibility reasons, wouldn't it make sense for the links to have a
   default title, and even images have an empty alt tag by default? The
   link title could default to the link text, unless a title was
   specified in the options.

   Any thoughts on this, or reasons as to why cakephp doesn't currently
   work like this?

   Thanks

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



Re: Yorkshire cakers

2008-09-11 Thread RichardAtHome

I'm relatively close by in Sheffield.

On Sep 10, 11:55 pm, simonb [EMAIL PROTECTED] wrote:
 Anyone in the dewsbury, England, West Yorkshire area who has used cake?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with MySQL query

2008-09-11 Thread RichardAtHome

Probably in your OptionsController?. Check out the function that
matches the name of your action,
ie,

http://www.example.com/options/
or
http://www.example.com/options/index

can be found in your OptionsController (/app/controllers/
options_controller.php)

and look for the function index()

Also, post the code in your model too (/app/models/option.php);

On Sep 11, 9:56 am, krzysztofor [EMAIL PROTECTED] wrote:
 but i don't know where it is genereted :/

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



Re: CakePHP 1.2: Layout and views design issue

2008-09-10 Thread RichardAtHome

I'll answer b)

/app/views/layouts/default.ctp:

html
head
title?php echo $title_for_layout; ?/title
/head
body
div id='header'
header markup goes here
/div
div id='menu'
menu markup goes here
/div
div class='content'
?php echo $content_for_layout; ?
/div
div id='footer'
markup for footer
/div
/body
/html

 if(session) print hello $user
 else show login link.

That's correct :-) Why do you not think this should go in the layout?
You could paste the code into an element (note, i'm using your
pseudocode here, check out the manual on the Auth component for some
real code):

/app/views/element/session_links.ctp:

if(session) print hello $user
else show login link.

and in your layout:

?php echo $this-render(session_links); ?


On Sep 10, 10:19 am, jkritikos [EMAIL PROTECTED] wrote:
 Hi there,

 I would like to ask 2 questions, both regarding the layout and views.

 a) After installing cake 1.2 and accessing my localhost domain, I get
 to see the cake info page and everything works fine. If i access a url
 that is lacking the underlying controller or view, I get to see cake's
 error message about the corresponding view file missing etc. When I
 create my own template under /app/views/layout/default.ctp, it all
 works fine but whenever I hit invalid urls (as above) nothing happens
 (i.e. i still get to see my default template but without the error
 messages). I read somewhere that by overriding the default.ctp layout
 file, you are effectively changing every page that cake would render,
 so perhaps I'm missing some variables in my layout? (e.g
 $content_for_layout, $title_for_layout etc?)

 b) I have been given all the templates for an application by a web
 designer. Let's say that the default layout consists of a header, a
 menu, the 'main body' and a footer. What is the correct approach for
 breaking this down in cake ? I assume that my default layout should
 contain the common elements that are always present (i.e header, menu,
 footer), and all other views will be rendered within the 'main body'
 section of the layout. However if this is the case, it would mean that
 the actual layout, in the header section should also contain code
 like:

 if(session) print hello $user
 else show login link.

 This somehow feels wrong. Should i have code like that in my layout ?
 What is the best practice for using a default template and some views?

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



Re: Need help on Install

2008-09-10 Thread RichardAtHome

 First off read this: http://en.wikipedia.org/wiki/Example.com

Example.com is a test domain that you cannot use ;-)

On Sep 10, 4:09 am, Jerry Ross [EMAIL PROTECTED] wrote:
 Ooopps!  It was a false positive.  What I actually accidentally got up and
 running washttp://myexample.com

 http://www.example.com

 and

 http://www.example.com/cake_1.1.19.6305/

 are still not working.  However, on the positive side,

 http://localhost/cake_1.1.19.6305/

 is working and I have a CAKE RAPID DEVELOPMENT screen telling me It found my
 database config file and that cake is able to connect to my database.

 But can someone tell me what I am supposed to see 
 whenhttp://www.example.comstarts to work?

 All I get is this:

 You have reached this web page by typing example.com, example.net, or
 example.org into your web browser.
 These domain names are reserved for use in documentation and are not
 available for registration. See RFC 2606, Section 3.

 I am supposing that was NOT what I was suposed to get.

 Any suggestions?

 Pittore

 - Original Message -
 From: Jerry Ross [EMAIL PROTECTED]
 To: cake-php@googlegroups.com
 Sent: Tuesday, September 09, 2008 7:57 PM
 Subject: Re: Need help on Install

  Thanks for all your help...I now have example.com up and running and it
  looks good. Now onto programming.

  Pittore
  - Original Message -
  From: Donkeybob [EMAIL PROTECTED]
  To: CakePHP cake-php@googlegroups.com
  Sent: Tuesday, September 09, 2008 6:48 AM
  Subject: Re: Need help on Install

  one word . . . .xampp.

  for xp, it is the beez kneez . . .

  set up is easy and everything is done for you. apache, mysql,
  php . . . .then edit the httpd.conf to add a virtual host.

  i run many development sites from this configuration

  On Sep 8, 8:09 pm, Pittore [EMAIL PROTECTED] wrote:
  I have apache2 up and running on my Windows XP Pro laptop

  I have established the following directory structure:

  Apache2
  htdocs
  cake

  When I typehttp://www.example.com/cakeorhttp://www.example.com/
  I get Page not found

  some kind soul sent me these suggestions:

  1. Create a simple static VirtualHost under Apache based on the
  simplehost
  example configuration file
  C:\www\Apache22\conf\extra\vhosts\_static\simplehost.com.conf
  a. Resave file as mydomain.com.conf, in the same folder, to duplicate
  it.
  b. Update all occurrences of 'simplehost.com' to 'mydomain.com'
  within.
  c. Create folder C:\www\Apache22\conf\extra\vhosts\_static\mydomain.com
  \
  d. Create folder C:\www\vhosts\_static\mydomain.com\ to be used as
  the
  container for this VirtualHost.
  e. Create log folder C:\Apache22\logs\mydomain.com\

  2. Unpack cakephp as folder C:\www\vhosts\_static\mydomain.com\cake\

  3. Modify this VirtualHost's configuration [mydomain.com.conf] and
  change
  DocumentRoot from...
  DocumentRoot C:/www/vhosts/_static/mydomain.com
  To...
  DocumentRoot C:/www/vhosts/_static/mydomain.com/cake/app/webroot

  4. Restart Apache.

  However, I am stuck on step 1a and b...I don't know where to find the
  file:

  'simplehost.com'

  any suggestions? Help...I have been trying to configure cake now for
  4 days am getting frustrated.

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



Re: Problem with MySQL query

2008-09-10 Thread RichardAtHome

Post your query code :-)

On Sep 10, 3:17 pm, krzysztofor [EMAIL PROTECTED] wrote:
 Hello everybody. I'm begginer with CakePHP. The MySQL query is
 genereting in a wrong way:

 Query:
 SELECT `Option`.`id`, `Option`.`menu_id`, `Option`.`parent_id`,
 `Option`.`page_id`, `Option`.`order`, `Option`.`extension_name`,
 `Option`.`extension_args`, `Option`.`menu` FROM `fk3_options` AS
 `Option` WHERE `Option`.`pageid` = 41 LIMIT 1

 The problem is in the 'WHERE clause'. The record 'pageid' doesn't
 exist, instead of it should be 'page_id'.

 Warning (512): SQL Error: 1054: Unknown column 'Option.pageid' in
 'where clause' [ROOT/system/cake/libs/model/datasources/
 dbo_source.php, line 440]

 There is no problem on localhost, but it is on the external server :(.
 Please help me if you can.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best profiler for cake php?

2008-09-09 Thread RichardAtHome

I'd also like this info. XDebug crashes my apache (on windows) too :-(

On Sep 9, 5:42 am, Dianne  van Dulken [EMAIL PROTECTED] wrote:
 Hi,

 I was just wondering what profiler everyone else was using.  I'm
 having trouble finding one that will work with my cakephp setup.

 Xdebug causes my apache to crash, and I'm having similar issues with
 some other ones.

 My setup is

 Cake version: 1.2.0.5427
 Apache 2.2.4
 PHP: 5.2.4

 If anyone could tell me what they are using, I'd really appreciate it

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



Re: Find: conditions and fields

2008-09-09 Thread RichardAtHome

What David said.

You have to add your conditions to the paginate call.

Check out the google groups FAQ: http://groups.google.com/group/cake-php/web/faq

Scroll down to: How to add paginate support for custom queries?

On Sep 9, 9:13 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 See:http://groups.google.com/group/cake-php/msg/7d17a42d764ccce4?hl=en

 Your problem is not in your conditions, it's right here:

  $this-set('textmasters', $this-paginate());

 Yes, this in fact does give you *everything*.

 On 9 Sep 2008, at 17:04, Liebermann, Anja Carolin wrote:



  Hello,

  I still have some problems with the parameters for find

  I have two different sets of parameters but I have the impression the
  result doesn't react on them, but simply gives me a list with nearly  
  all
  of my datasets:

  Version 1:
  $params = array(
  'conditions' = array('Textmaster.katalogobjekt_id' = 1,
  'Textmaster.sprache_id' = 1,
   'Textmaster.textinhalt LIKE' =
  '%'.trim($this-data['Textmaster']['textinhalt']).'%',
   'Textmaster.suchkriterium LIKE' =
  '%'.trim($this-data['Textmaster']['suchkriterium']).'%'),
  'fields' =
  array
  ('Textmaster.id','Textmaster.suchkriterium','Textmaster.textinhalt'
  ),
  'order' = 'Textmaster.suchkriterium ASC',
  'recursive' = -1
  );

  Version 2:
  $params = array(
  'conditions' = array('Textmaster.katalogobjekt_id' = 1,
  'Textmaster.sprache_id' = 1),
  'fields' =
  array
  ('Textmaster.id','Textmaster.suchkriterium','Textmaster.textinhalt'
  ),
  'order' = 'suchkriterium ASC',
  'recursive' = -1
  );

  $textmasters = $this-Textmaster-find('all',$params);
  $this-set('textmasters', $this-paginate());        

  Question 1: What does 'fields' do? I thought it would load only those
  fields, but my dataset seems to load completely because in the view
  every column is populated

  Question 2: the 'order' criteria is being ignored. Do I have the wrong
  syntax? The result is still sorted by 'id'.

  Question 3: the like condition is also ignored, although it arraives
  in the parameter array:
  E.g.:
  Array
  (
     [conditions] = Array
         (
             [Textmaster.katalogobjekt_id] = 1
             [Textmaster.sprache_id] = 1
             [Textmaster.textinhalt LIKE] = %Modern%
             [Textmaster.suchkriterium LIKE] = %ACE109%
         )

     [fields] = Array
         (
             [0] = Textmaster.id
             [1] = Textmaster.suchkriterium
             [2] = Textmaster.textinhalt
         )

     [order] = Textmaster.suchkriterium ASC
     [recursive] = -1
  )

  Any hints on what is going wrong are appreciated.

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



Re: Can't seem to do an update when calling save() on model

2008-09-09 Thread RichardAtHome

 First value for auto_increment id in mysql == 1

Unless you tell it differently. You can have an autoincrementing field
that starts at 21 and increments in 6's if you like :-)


On Sep 9, 12:20 pm, Adam Royle [EMAIL PROTECTED] wrote:
 It is intended functionality. First value for auto_increment id in
 mysql == 1

 Not sure about all other dbs, but on others I have worked with it is
 the same.

 On Sep 9, 9:06 pm, John Jackson [EMAIL PROTECTED] wrote:

  Thanks for the reply, but I now know that is the correct way to
  perform an update as I have just figured out what the problem was.
  Apparently, I can not use an id of 0. Changing the user's id to
  another value greater than 0 fixed the problem.

  Is this a bug or intended functionality?

  On Sep 9, 11:58 am, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:
   Hi John,
   When calling save the id should be part of the data. Setting it on the
   Model before saving does not work as you expect it to.
   Are you sure the id is in the data array?

   /Martin

   On Sep 9, 12:34 pm, John Jackson [EMAIL PROTECTED] wrote:

Pretty sure the code I'm using should be causing the save() function
to do a MySQL update instead of insert:

$this-User-id = 0; // static here for this example
$this-User-save($this-data);

But this is resulting in an insert, according to the output from debug
level 2. What I'm trying to do is update a user's details for their
account, including name, email and password.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RE sometimes I wonder if cakeph is worth all the trouble - seems like very steep learning curve.

2008-09-08 Thread RichardAtHome

 if every employee have to spend months learning this new platform then , must 
 as well code directly in PHP !

If you don't want to learn a (new) framework, don't.

A couple of months learning CakePHP will pay itself back in no time
due to increased productivity ;-)

On Sep 8, 6:29 am, James Chua [EMAIL PROTECTED] wrote:
 if every employee have to spend months learning this new platform then , must 
 as well code directly in PHP !

 Date: Mon, 8 Sep 2008 02:02:41 +0530
 From: [EMAIL PROTECTED]
 To: cake-php@googlegroups.com
 Subject: Re: dropdown with country,state,city

 I know that , iwant drop down with pach country,state,city.

 On Mon, Sep 8, 2008 at 1:58 AM, Bernhard J. M. Gr黱 [EMAIL PROTECTED] wrote:

 Yes it is possible.
 Look into the manual (FormHelper - input (select box)). There are many 
 examples you can look at.

 2008/9/7 Ranju [EMAIL PROTECTED]

 I want implement dropdown with country ,state,city.It is possible on

 cakephp .pls help me.

 _
 Manage multiple email accounts with Windows Live Mail 
 effortlessly.http://www.get.live.com/wl/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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Scaffolding doesn't work with themes?

2008-09-06 Thread RichardAtHome

Using CakePHP 1.2.0.7296 RC2

I've been having a dabble with the built in support for themes
( http://book.cakephp.org/view/488/Themes )

I've set up a theme using the instructions in the CakePHP docs above
and updated AppModel to use themes:

class AppController extends Controller {

var $view = Theme;

var $theme = my_theme;

}

I have a simple controller set up to produce scaffolding views:

function EventsController extends AppController {

  var $scaffold;

}

but when I visit the events index page I get the following error:

Missing View
Error: The view for EventsController::index() was not found.

Error: Confirm you have created the file: D:\webroot\projects\cake_css
\app\views\themed\my_theme\events\index.ctp

Why is it looking for an events index view and not scaffolding one as
expected?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how can I see all the postings I ever posted in this user group ?

2008-09-06 Thread RichardAtHome

You can find a complete posting history on your google groups profile:
http://groups.google.com/groups/profile?myprofile


On Sep 6, 11:40 pm, xfh [EMAIL PROTECTED] wrote:
 how can I see all the postings I ever posted in this user group ? If I
 search this group with my user name only 2 of some more postings will
 show up multiply, but I wanted to see all my postings, so I can see if
 someone has replied to them.

 Also, when finished posting, I didn't see where I get a link to my
 posting so I could copy paste that for docu.

 Haven't found a help or manual etc. function for this user group yet.

 Does someone know how these things work ?

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



Re: using javascript with form element

2008-09-01 Thread RichardAtHome

More info please :-)

On Aug 31, 3:50 pm, assaggaf [EMAIL PROTECTED] wrote:
 i wanna to know how to make event for  simple input

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



Re: $this-element() and Model:$_schema

2008-09-01 Thread RichardAtHome

bump?

On Aug 24, 1:52 pm, RichardAtHome [EMAIL PROTECTED] wrote:
 Also (may be related), in the element, why doesn't the following work?

 ?php
 echo $html-css(array(
         element.site_search
 ), null, array(), false);
 ?

 (the CSS file isn't being linked in the head)

 It works if the last param is true, but the code is embeded in the
 page and not the head.

 On Aug 24, 11:27 am, RichardAtHome [EMAIL PROTECTED] wrote:

  I have a simple element:

  site_search.ctp:
  ?php echo $form-create(Search) ?
  ?php echo $form-inputs() ?
  ?php echo $form-end(Search) ?

  Model Search is a tableless model which I manually create the schema
  for:

  search.php:
  class Search extends AppModel {

          var $useTable = false;

          var $_schema = array(
                  search_for=array(
                          type=string,
                          length=128
                  )
          );

  }

  Problem: The inputs() call in the element is coming back blank. It
  works fine if I point the form at a model (ie. it generates the
  inputs) with a real database table behind it, but not for one with a
  $_schema.

  I tried adding:

  App:Imort(model, Search);

  to the element, but that didn't help.

  How do I get an element to 'see' a model in this way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: it would be helpfull if you could post the solution

2008-08-31 Thread RichardAtHome

CakePHP is very clever, but it doesn't have a mind reading module
(yet).

Give us some details please :-)

On Aug 30, 12:04 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I read the manual and the ibm code and they are the same. How did you
 solve the problem ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP on IIS 6 - open_basedir restriction in effect

2008-08-28 Thread RichardAtHome

After more digging, I've managed to get rid of the open base dir error
(comment out open_basedir setting in php.ini)

Now I have another issue...

Under Apache, the following code:
?php echo Router::url(/user_muses/foo.jpg/

produces the following output:

/app/webroot/user_muses/foo.jpg

Under IIS, it breaks because the output is:

/index.php/app/webroot/user_muses/foo.jpg

And the images are broken.

Note: This only happens when I use Router::url(). If I use the built
in $html-image() to display images the urls are correct.

Obviously, I can't use $html-image() in this case as the images are
stored in a different location.

I get a similar problem when I try an embed a flash application too.

How do I remove index.php from the urls on IIS?

On Aug 26, 5:23 pm, RichardAtHome [EMAIL PROTECTED] wrote:
 After a bit of struggling, I've managed to get a CakePHP app running
 on IIS.

 I've running it without mod_rewrite so I followed the instructions in
 core.php and removed .htaccess files and uncommented the line:

         Configure::write('App.baseUrl', env('SCRIPT_NAME'));

 I've installed my cake app into:

 c:\Inetpub\php_test\

 I'm getting an error in a couple of places in my code, along the lines
 of:

 Warning (2): file_exists() [function.file-exists]: open_basedir
 restriction in effect. File(/index.php/app/webroot/user_backgrounds/
 1.xml) is not within the allowed path(s): (c:\Inetpub) [APP\views
 \elements\painter.ctp, line 133]

 Reading a bit further I've made the changes to /app/webroot/index.php

 /**
  * The full path to the directory which holds app, WITHOUT a
 trailing DS.
  *
  */
         if (!defined('ROOT')) {
                 define('ROOT', \\Inetpub\\php_test);
         }
 /**
  * The actual directory name for the app.
  *
  */
         if (!defined('APP_DIR')) {
                 define('APP_DIR', \\Inetpub\\php_test\\app\\);
         }
 /**
  * The absolute path to the cake directory, WITHOUT a trailing DS.
  *
  */
         if (!defined('CAKE_CORE_INCLUDE_PATH')) {
                 define('CAKE_CORE_INCLUDE_PATH', \\Inetpub\\php_test);
         }

 What am I missing/doing wrong?

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread RichardAtHome

A CakePHP Model is just a PHP class. You can still use all of PHP's
class abilities.

for example:

class MyModel extends AppModel {

   var $myCustomPropery = w00t!;

}

in controller:

echo $this-MyModel-myCustomProperty;


On Aug 28, 2:19 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 I don't get what you mean with custom properties. Maybe it's just me
 but, can you elaborate a bit more please?

 On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby [EMAIL PROTECTED] wrote:

  How do you specify custom properties in a CakePHP model?
  I'm trying to do this, but there is no sample code any where that
  shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread RichardAtHome

Just my two cents: CakePHP is fast enough for me :-)

That's not to say you shouldn't optimize for speed at some point in
the future. I just mean, it shouldn't be a priority.

Keep doing what your doing Cake dev's. Cake hasn't become one of the
most popular PHP frameworks because of its speed ;-)

On Aug 28, 4:11 pm, kiang [EMAIL PROTECTED] wrote:
 Maybe there could be one page like 'Read first before benchmarking' in
 home page since there exists many mis-understandings around the
 world. :)

 ---
 kiang

 On Aug 28, 10:41 pm, Gwoo [EMAIL PROTECTED] wrote:

  One thing we know for sure is that we can always work to improve the
  speed. However, we will not do it in earnest until the time is right.
  We have been here before, seen similar things, and come up with the
  answers.

  While the hello world is pretty silly, a couple of things strike me
  right off the bat. For one, var $helpers = array() will still load 3
  files, while setting it to null will stop all loading. So, in a lot of
  ways Cake shows up slower because it does more from the start. The
  other major place is the session handling. We have no idea what his
  settings were in this regard.

  In any case, now that we are deeper into the RC cycle you will see in
  the timeline many efforts to improve and optimize the responsiveness
  of the framework. If you would like the historical perspective have a
  look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
  We have a history of squeezing speed out of this language and
  framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?

2008-08-27 Thread RichardAtHome

The automagic fields should be called created and modified (not
updated). You don't need to do anything else.

On Aug 27, 8:29 am, MarcS [EMAIL PROTECTED] wrote:
 Hi,

 I just noticed that my 'updated' field won't update when I update
 data.
 I tried around for a while and then noticed that it won't update when
 the 'update' field is included in the Model's data array.
 But when I load data using Model::read(null,$id) the date fields are
 obviously always included in the Model's data. Do I then need to
 always manually unset them before saving?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: radio buttons with form helper - lots of problems?

2008-08-27 Thread RichardAtHome

What tram said... change the field to an Int. Mysql tinyint datatype
has traditionally been used to store boolean data as MySQL doesn't
have a boolean datatype.

Alternatively, use a 1 byte char field.

Or change your options to be
null = Pending (the database default)
0 = Disapprove
1 = Approve

Or use an enum. Note: enums are mysql specific and are not directly
supported by cake. This doesn't mean you can't use them though (cake
treats them as a standard varchar field). There are some behaviours
out there that can help with enums.

As to the white screen of death, check out the httpd error logs and
the cake error logs (app/tmp/logs/error.log)

On Aug 26, 11:45 pm, [EMAIL PROTECTED] wrote:
 oh cmon you dont expect good anwers when you're bashing the fw like that ?

 cake interprets int(1) as bool , its a design choice. you are welcome
 to update the book.cakephp.org to reflect that.

 white screen of death - sorry im not getting it with your code, you
 sure the radio call is causing it ?

 On 8/27/08, Mark (Germany) [EMAIL PROTECTED] wrote:





  oh my gosh
  cake again.. typical

  by using TINYINT(1) it is assumed that you have a checkbox toggle with
  0 and 1 as values i guess.
  anyway, after changing it to TINYINT(2), this automagic correction is
  no longer active
  and my value now is -1 in the Database
  Where in the documentation did i miss that?

  Are there more of these automatic corrections where a normal cake user
  would not assume it?

  PS: about the white screen of death - anyway - are there any solutions
  to it?
  other than having to use a dummy default?

  thx mark

  On 26 Aug., 23:37, Mark (Germany) [EMAIL PROTECTED]
  wrote:
  Well - CakePHP and Rapid Development can be two things that dont get
  along with each other sometimes.. :)
  i try for hours now...

  first of all if you do not set a default value cake crashes completely
  - white screen of death all of the sudden:
  $form-input('status',array('type'='radio','options'=array(1=Disapprove',

  1='Approve'),'legend'=false));

  so i was forced (i really hate that - if i am forced to workaround
  something) to add a dummy pending one:
  $form-input('status',array('type'='radio','options'=array(0='Pending',-1=Disapprove',

  1='Approve'),'legend'=false));

  ok, so far so good, but

  in the second code sample (i tried with both integer -1 0 1  and '-1'
  '0' '-1'), the -1 always gets changed to 1 when saved to the database
  - i debugged it and found out, that it is (inside of $this-data)
  still -1 after validation and - i did not believe it - after having
  saved the fields. so cake transformes it wrongly or something when
  saving it.

  the DB table setting is:
  `status` tinyint(1) NOT NULL default '0' COMMENT '-1 dissap. 1
  approved',
  so neg. values should be no problem...

  and the query clearly shows that it is cake's fault:
  UPDATE `role_applications` SET `id` = 2, `status` = 1, `check_text` =
  'somehting', `adminonly_text` = 'whatever', `checked_by` = 1,
  `check_date` = '2008-08-26 23:34:29' WHERE `role_applications`.`id` =
  2

  anyone an idea what is going on?
  how can i use negative values for radio buttons then?

  if this goes on, i wont have any project done by the end of next
  year..
  mark

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



Re: How to test the database connection?

2008-08-27 Thread RichardAtHome

This is how Cake does it in the scaffold home page:

?php
if (isset($filePresent)):
uses('model' . DS . 'connection_manager');
$db = ConnectionManager::getInstance();
$connected = $db-getDataSource('default');
?
p
?php
if ($connected-isConnected()):
echo 'span class=notice success';
__('Cake is able to connect to the database.');
echo '/span';
else:
echo 'span class=notice';
__('Cake is NOT able to connect to the 
database.');
echo '/span';
endif;
?
/p
?php endif;?


On Aug 26, 8:33 pm, aranworld [EMAIL PROTECTED] wrote:
 I wonder if we have the same web host ... Hostway perhaps?

 I am just in the middle of figuring this out as well and I came across
 the following code that I believe still works, however, I must warn
 you that I have not tested this out fully, but maybe this will at
 least put you in the right direction?

 $db = ConnectionManager::getDataSource('default');
 if(empty($db-connection)){
     // you don't have a connection

 }

 On Aug 26, 10:55 am, Samuel DeVore [EMAIL PROTECTED] wrote:

  I use the php functions for connecting to the database and then
  redirect if it fails to a static page, usually from bootstrap.php if I
  find that it becomes a problem on a host.

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

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

 http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-m...

  On Tue, Aug 26, 2008 at 10:51 AM, bbf [EMAIL PROTECTED] wrote:

   My flaky webhost's MySQL process goes down randomly every few weeks.

   Cake doesn't throw an error, but instead gives a Missing Table error
   and displays a weird page (the layout nested 4 times).

   How and where would I test the db connection myself?

   (I want to show my own pretty Temporarily down for maintenance msg
   -- I know how to throw and show the error, I just don't know where to
   put the code that tests the connection)

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



Re: Forms not associated to models - alternative to the Form core helper?

2008-08-27 Thread RichardAtHome

You may not think it now but your form IS related to a model ;-)

See Jonathan snooks example of a contact form:
http://snook.ca/archives/cakephp/contact_form_cakephp/

Jonathan creates a tableless model and defines the schema by hand.
That way you get all the benefit of cake's helpers (validation etc.)

On Aug 26, 5:29 pm, Enrique Delgado [EMAIL PROTECTED] wrote:
 Thanks Samuel and validkeys.

 Samuel, very true, I do like extending the functionality of CakePHP,
 that is probably one of the best ways to go when we need something
 more custom.

 This time, I had totally overlooked the regular Form helper methods
 like text(), password(), etc. Thanks validkeys for pointing this out.
 I was getting too caught up and spoiled by the input() automagic
 method, my bad.

 Using the regular methods works just fine.

 Thanks!

 On Aug 26, 11:15 am, validkeys [EMAIL PROTECTED]
 wrote:

  Hey Enrique,

  You could still use the regular forms:

  ?php echo $form-create('Search',array('url' = '/search','type' =
  'get')) ?

  ?php echo $form-text('query',array('type' = 'textarea')) ?

  ?php echo $form-end('Search!') ?

  On Aug 26, 11:45 am, Enrique Delgado [EMAIL PROTECTED]
  wrote:

   Hi All,

   The core Form helper works great as long as you have a model behind
   it, but what about forms that are not related to a model?

   Is there any helpers that I can use in the view? Or do I just code
   plain HTML?

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



Re: three level deep belongsTo

2008-08-27 Thread RichardAtHome

@wisecounselor

 never mind, sorry to bother you, knew this was a waste of time

Um, AD7six answered your question later on in his post. That is why he
asked you if you'd continued reading...

On Aug 25, 7:49 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 never mind, sorry to bother you, knew this was a waste of time.

 On Aug 25, 1:18 pm, AD7six [EMAIL PROTECTED] wrote:

  On Aug 25, 8:13 pm, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:
   sorry, I think I follow, maybe more specific objects will help, I have

   Patient - Diet Plans - Diet Calendar Day

   So Patient hasMany diet plans with each Diet Plan having many Diet
   Calendar Days

   I need to draw a screen of all patients and loop through 2 weeks of
   the calendar, filling in details of each day for each patient, but I
   need to be able to filter this at times by Patient last name,
   sometimes by a field in Diet Calendar Days and other times in a field
   in the Diet Plan.  So they way I have it, I can't do Patient-

   find('all',array('condition' = 'DietPlan.active' = 1));

   or

   Patient-find('all',array('condition' = 'DietPlanDay.exception' =
   1));

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



Re: Auth Component on Zeus Hosting

2008-08-27 Thread RichardAtHome

I had exactly this issue before but setting the security setting from
High to Medium fixed it for me.

Check your httpd error logs for any warnings about missing files/
images etc.

On Aug 27, 11:23 am, AussieFreelancer
[EMAIL PROTECTED] wrote:
 ok, so no whitespace, but still not sure what is causing it.. still
 the same issue, doesn't seem to like the sessions very much and kicks
 me out randomly... has no-one had this before?

 On Aug 7, 9:46 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:

  Also check for whitespace:http://bin.cakephp.org/view/1837474952

  On Thu, Aug 7, 2008 at 4:35 AM, AussieFreelancer

  [EMAIL PROTECTED] wrote:

   Hmm, I changed it from High to Medium with no effect, and also to Low
   without having any effect either... I will double check the links for
   non-existent files, this could be something to do with it, as if i
   press refresh a couple of times quickly it logs me out, not sure this
   is what is happening every time, but I know that refreshing twice fast
   certainly does it...

   So no known issues with sessions and Zeus or anything like that?

   Thanks

   Patrick

   On Aug 6, 6:46 pm, acoustic_overdrive [EMAIL PROTECTED]
   wrote:
   This is probably not server-specific, but on one application I was
   building it took me ages to realise why sometimes I was getting logged
   out and other times not. I eventually realised that I had a CSS link
   that was pointing at a non-existent file, and this caused the page to
   continue trying to load it in the background. If I cancelled the page
   loading prematurely by clicking on a link and visiting another page, I
   would stay logged in. But if I allowed the page to complete its
   loading, it would log me out. When I corrected the broken link it
   behaved fine again.

   That was not using the latest release so perhaps newer versions are
   OK.

   On Aug 6, 3:21 am, AussieFreelancer [EMAIL PROTECTED]
   wrote:

Hello, I have a client who's website is hosted on a server powered by
zeus instead of apache. I have already run into issues with the
rewrite which are now resolved, but there seems to also be an issue
with the Auth components...

I have an administration panel as a plugin, which works on other
sites, but for some reason, on this particular site, it randomly kicks
the user out. Sometimes I can't even get to one page without it
kicking me out, other times i can update 5 things and then it will
kick me out... does anyone know why this is? I have security set to
low, I thought that maybe it was to do with that but doesn't seem to
have made a difference...

Would love to hear any suggestions on how to resolve this as the admin
panel isnt really usable until it is fixed..

Thanks

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



Re: auth-loginError

2008-08-27 Thread RichardAtHome

Have you added the code to your view to display the error?

http://book.cakephp.org/view/564/displaying-auth-error-messages



On Aug 27, 10:22 am, luigi7up [EMAIL PROTECTED] wrote:
 My
 $this-Auth-loginError ='Invalid username or password';
 won't show on login.ctp view

 This is what I have in app_controller:
         var $components = array('Acl','Auth');

                 function beforeFilter(){
                         //Mijenja hash funkciju auth komponente iz defaultne 
 u md5
                         Security::setHash('md5');
                         $this-Auth-fields = array('username' = 'username', 
 'password' =
 'password');
                         $this-Auth-loginAction = array('controller' = 
 'users', 'action'
 = 'login');
                         //$this-Auth-loginRedirect = array('controller' = 
 'users',
 'action' = 'index');
                         $this-Auth-loginError ='Invalid username or 
 password';
                         $this-Auth-logoutRedirect = '/';
                         $this-Auth-authorize = 'controller';

                 }

                 /*When authorize is set to 'controller',
                 you'll need to add a method called isAuthorized() to your
 controller.
                 This method allows you to do some more
                 authentication checks and then return either true or false.*/

                 function isAuthorized() {
                         return true;
                 }
 In users_controller my login() is empty because Auth component
 automagic

 and when I debug my session with debug($_SESSION); I see that error is
 sent, but it si always set - even when I call users/login action for
 the first time (I mean without submiting wrong data)?!?!:
 Array
 (
     [Config] = Array
         (
             [userAgent] = 0f8a6ac2e2c891dce1f3f114fdaad715
             [time] = 1219830026
             [rand] = 32701
             [timeout] = 10
         )

     [Message] = Array
         (
             [auth] = Array
                 (
                     [message] = Invalid username or password
                     [layout] = default
                     [params] = Array
                         (
                         )

                 )

         )

 How can I get this login error working?

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



Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?

2008-08-27 Thread RichardAtHome

Quote:
One thing I came across was the fact that the columns for created 
updated should be of the type datetime and Null should be set to
'null' and not 'not null'

Oops, forgot to mention that :-(

On Aug 27, 4:21 pm, teknoid [EMAIL PROTECTED] wrote:
 Makes sense that it works like that...

 how/where are you modifying the data if you are just doing a read()?

 On Aug 27, 5:02 am, Marc Schuetze [EMAIL PROTECTED] wrote:

  According to the docs 'modified' and 'updated' are both ok.
  I tried this with 'modified' as well and it was the same result

  When I do $this-create(array(.)) and that array doesn't contain
  an update field then everything is fine and cake sets the update field
  properly.
  However, when I do
  $this-read(null,$id) the model's data array will contain the update
  field and it seems like I'll then have to manually unset it if I want
  to update the time in the field.
  If I don't do that cake will not fill the update field with a new
  value but will use the value that is is the model's data array

  On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome [EMAIL PROTECTED] wrote:

   The automagic fields should be called created and modified (not
   updated). You don't need to do anything else.

   On Aug 27, 8:29 am, MarcS [EMAIL PROTECTED] wrote:
   Hi,

   I just noticed that my 'updated' field won't update when I update
   data.
   I tried around for a while and then noticed that it won't update when
   the 'update' field is included in the Model's data array.
   But when I load data using Model::read(null,$id) the date fields are
   obviously always included in the Model's data. Do I then need to
   always manually unset them before saving?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component - I'm going crazy

2008-08-26 Thread RichardAtHome

Sounds like the Auth component is redirecting you away from a
protected page, to another protected page - hence the loop.

In your Users controller do you have a login action?

On Aug 26, 9:19 am, luigi7up [EMAIL PROTECTED] wrote:
 I'll try this. I read about this but I thought they were talking about
 other databases and not MySql.
 thx...

 On Aug 26, 8:57 am, aranworld [EMAIL PROTECTED] wrote:

  I have had situations in which I was unable to use a column named
  password and had to instead use something like passwd.  I believe
  it is a reserved keyword issue with MySQL?  Not sure if it was just
  related to an older version, but you might at least try changing the
  column name.

  -Aran

  On Aug 25, 12:32 pm, luigi7up [EMAIL PROTECTED] wrote:

   Ola, everyone...

   //Using RC2 version of CakePHP

   I'm building simple application that allows users to write articles.
   So there are their corresponding models and controllers.

   Few days ago I made custom Login/register part of application that
   writes username to session etc. but now I decided to use Auth
   component for this purpose.
   As soon as I define:
   var $components = array('Auth');
   in my users_controller or app_controller, application stops working.
   Firefox gives following error: Firefox has detected that the server
   is redirecting the request for this address in a way that will never
   complete. So, some infinite loop occured definitely and I'm quite
   sure that I didn't cause it :)

   I found few posts about this problem but none of them resolves my
   problem.

   The weirdest thing,to me, is that error occurs as soon as I include
   Auth component; I don't even use one method of that class ?!?
   Also another confusing part with this problem is that my other
   controllers also stop working with same output eventhough component
   Auth is included only in users_controller. User model is in
   association with articles model but I think that articles_controller
   shoud with or without component Auth included in users_controller. Am
   I wrong?

   My database is USERS and has fields username and password and also
   there is a model for users table.

   Thanks in advance

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



CakePHP on IIS 6 - open_basedir restriction in effect

2008-08-26 Thread RichardAtHome

After a bit of struggling, I've managed to get a CakePHP app running
on IIS.

I've running it without mod_rewrite so I followed the instructions in
core.php and removed .htaccess files and uncommented the line:

Configure::write('App.baseUrl', env('SCRIPT_NAME'));


I've installed my cake app into:

c:\Inetpub\php_test\

I'm getting an error in a couple of places in my code, along the lines
of:

Warning (2): file_exists() [function.file-exists]: open_basedir
restriction in effect. File(/index.php/app/webroot/user_backgrounds/
1.xml) is not within the allowed path(s): (c:\Inetpub) [APP\views
\elements\painter.ctp, line 133]

Reading a bit further I've made the changes to /app/webroot/index.php

/**
 * The full path to the directory which holds app, WITHOUT a
trailing DS.
 *
 */
if (!defined('ROOT')) {
define('ROOT', \\Inetpub\\php_test);
}
/**
 * The actual directory name for the app.
 *
 */
if (!defined('APP_DIR')) {
define('APP_DIR', \\Inetpub\\php_test\\app\\);
}
/**
 * The absolute path to the cake directory, WITHOUT a trailing DS.
 *
 */
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', \\Inetpub\\php_test);
}




What am I missing/doing wrong?

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



Re: Allowing entire controllers with Auth component

2008-08-24 Thread RichardAtHome

I'd do it this way round:

parent::beforeFilter();
$this-Auth-allow(array('display'));

So the controllers can override settings in AppController

On Aug 24, 8:44 am, tekomp [EMAIL PROTECTED] wrote:
 Thanks Sam.  Got it to work after realizing that display is a built-
 in action to the built-in pages controller.

 On Aug 23, 8:22 pm, Sam Sherlock [EMAIL PROTECTED] wrote:

  try
          $this-Auth-allow(array('display'));
          parent::beforeFilter();

  2008/8/23 tekomp [EMAIL PROTECTED]

   I'm using the Auth Component in my app_controller.php in the
   beforeFilter function, which is great for making people login, but I'm
   having a hard time allowing certain pages.  I want all pages in my
   Pages controller to not require authorization, so I added $this-
   Auth-allow('*')  in my beforeFilter in pages_controller.php.
   Problem with that is that it overrides the beforeFilter in
   app_controller.php and I cannot access $this-Auth.  I tried adding
   parent::beforeFilter in pages_controller.php, but it then does not
   recognize my $this-Auth-allow('*').

   I've tried a number of things and read all the tutorials I could find,
   but still can't find a way to allow an entire controller while
   maintaining this-Auth.  It doesn't seem right that I'd have to add
   the Auth code to each individual controller.

   Any ideas?

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



Re: Database relationships etc

2008-08-24 Thread RichardAtHome

Nothing to add apart from props to Rafael for an excellent answer.

On Aug 23, 2:05 am, Rafael Bandeira aka rafaelbandeira3
[EMAIL PROTECTED] wrote:
 Oh, I almost slept, you should try to more clear and less verborragic,
 so many explanation just messed up things more and more...
 And you should do 2 things when you can't speak a language : 1) look
 for groups with the same language of yours and 2) say your
 nacionality, so members from the same country can get sensible with
 you and try to help you more

 stop the bullshit and answer me...

 OK, answers :

  1) Do I have to manually set up Foreign keys for tables?

 it depends, did you sitcked to conventions?
 Your CarAd Model has the following scheme and linking convention:

 id                                      - primaryKey
 car_type_id                        - className = CarType, uses table - 
 car_types

 car_brand_id                      - className = CarBrand, uses table -  
 car_brands

 car_fuel_id                         - className = CarFuel, uses table
 -  car_fuels
 car_transmission_id            - className = CarTransmission, uses
 table -  car_transmissions
 year
 ad_county_id                      - className = AdCountry, uses table
 -  ad_countries
 ad_borough_id                    - className = AdBorough, uses table - 
 ad_boroughs (?)

 info
 price
 car_ad_type_id                   - className = CarAdType, uses tabl - 
 car_ad_types

 added                      - tip : is this field meant to hold the
 datetime of row creation? if yes, rename it to created and cakePHP
 will handle it for you

 Said that all this foreign keys says : this CarAd belongs to this
 CarType, and to this CarBrand, and to that CarFuel... so you should
 have in your model class:

 class CarAd extends AppModel {
    var $belongsTo = array (
         'CarType', 'CarBrand', 'CarFuel', 'CarType',
         'CarTransmission', 'AdCountry', 'AdBorough',
    )

 }

 now CakePHP will map all your model's foreign keys and you will be
 able to access this relateds models as a property of your CarAd
 model :
 // inside your model
 $this-CarType-find([...]);
 inside your controller
 $this-CarAd-CarType-find([...]);

 answered? moving on...

  2) Do I have to build model for each table I need to get id's
  from..even if the table itself will stay static ? (model for
  car_transmissions, car_fuels_id... tables)

 No, actually CakePHP map table names for you too. 
 http://www.littlehart.net/atthekeyboard/2008/08/05/dynamic-models-in-...

    By static I mean that I don't need to add or delete data from it
  because probably there will not be any new transmission types
  coming. I only need to read info from it.

  I know 100% that I have to build model for tables which will have
  dynamic content...like table car_brand. (new car brand comes.. for ex.
  BMW-Jaguar..and I need to add it to table from site...not manually)

 you should avoid this kind of thinking...

  So my main table at this time is car_ads and I have controller for
  it... and it also gives me it's table contents with simple index():
     function index() {
             $this-set('carads',$this-CarAd-find('all'));
     }

  But I want to see text in the list..not that number which I have on
  car_transmission_id field. (Instead of number 1 I would like to see
  text: Automatic)
  Currently line looks like this: Brand: 5  Year: 2000 Transmission: 1
  Gas: 2
  But it should look like this:   Brand: Chevrolet Astro Year: 2000
  Transmission: Automatic  Gas: Benzine

 No actually it shouldn't, what is happening is the normal and expected
 behavior.

 I'll explain what is already in the manual about cakePHP's data
 scheme, I'll wont reproduce arrays here because it would be very ugly
 and painfull for me so take this as example 
 :http://book.cakephp.org/view/448/findall
 - the grey box at the bottom of the content...

 that's how your data will return but with the your model names...
 back to your CarAdsController::index() :

     function index() {
             $this-set('carads',$this-CarAd-find('all'));
     }

 in your view you will have a var named 'carads', and you'll be able to
 access data as the array in the link shows :
 // first entry's CarTransmission.transmission wil be accessed like
 this
 echo $carads[0]['CarTransmission']['transmission'];

 // the nth entry/row CarBrand.name will be accessed like this
 echo $carads[$num]['CarBrand']['name'];

 for a dynamic list or table generation, you would do something like
 this:
 foreach($carads as $entryNum = $entryData)
 {
    echo 'Transmission: ' . $entryData['CarTransmission']
 ['transmission'];
    echo 'Brand : ' . $entryData['CarBrand']['name'];
    echo 'Country : a href=/view/country/' . $entryData['CarCountry']
 ['id']  . ' title=view country:' . $entryData['CarCountry']
 ['name'] . ' ' . $entryData['CarCountry']['name'] . '/a';

 }
  I'll try to explain it once more..maybe it helps to clear things out:

    you actually didn't explain 

$this-element() and Model:$_schema

2008-08-24 Thread RichardAtHome

I have a simple element:

site_search.ctp:
?php echo $form-create(Search) ?
?php echo $form-inputs() ?
?php echo $form-end(Search) ?

Model Search is a tableless model which I manually create the schema
for:

search.php:
class Search extends AppModel {

var $useTable = false;

var $_schema = array(
search_for=array(
type=string,
length=128
)
);

}

Problem: The inputs() call in the element is coming back blank. It
works fine if I point the form at a model (ie. it generates the
inputs) with a real database table behind it, but not for one with a
$_schema.

I tried adding:

App:Imort(model, Search);

to the element, but that didn't help.

How do I get an element to 'see' a model in this way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this-element() and Model:$_schema

2008-08-24 Thread RichardAtHome

Also (may be related), in the element, why doesn't the following work?

?php
echo $html-css(array(
element.site_search
), null, array(), false);
?

(the CSS file isn't being linked in the head)

It works if the last param is true, but the code is embeded in the
page and not the head.

On Aug 24, 11:27 am, RichardAtHome [EMAIL PROTECTED] wrote:
 I have a simple element:

 site_search.ctp:
 ?php echo $form-create(Search) ?
 ?php echo $form-inputs() ?
 ?php echo $form-end(Search) ?

 Model Search is a tableless model which I manually create the schema
 for:

 search.php:
 class Search extends AppModel {

         var $useTable = false;

         var $_schema = array(
                 search_for=array(
                         type=string,
                         length=128
                 )
         );

 }

 Problem: The inputs() call in the element is coming back blank. It
 works fine if I point the form at a model (ie. it generates the
 inputs) with a real database table behind it, but not for one with a
 $_schema.

 I tried adding:

 App:Imort(model, Search);

 to the element, but that didn't help.

 How do I get an element to 'see' a model in this way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Focus On cake Validation

2008-08-24 Thread RichardAtHome

A quick bit of jQuery:

$(#content form:first div.error:first input:first).focus();

Will focus the first errored input field on the first form in the
#content div.

It will fail silently if the first input element on the forum is not a
input control (a textarea for example).

[EMAIL PROTECTED] wrote:
 hello guys

 in my cakephp project i uses the cake validation witch uses server
 side validation , i need it to focus on the error field after
 detecting it so how can i do something like this  ?? since the focus
 can be done with a client side  validation , so im wondiring if there
 is any way in cake to do that in the same validation process .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Focus On cake Validation

2008-08-24 Thread RichardAtHome

Typo:

It will fail silently if the first errored input element on the form
is not a
input control (a textarea for example).

Might be possible to expand the rule to include other input element
types...

On Aug 24, 10:14 pm, RichardAtHome [EMAIL PROTECTED] wrote:
 A quick bit of jQuery:

 $(#content form:first div.error:first input:first).focus();

 Will focus the first errored input field on the first form in the
 #content div.

 It will fail silently if the first input element on the forum is not a
 input control (a textarea for example).

 [EMAIL PROTECTED] wrote:
  hello guys

  in my cakephp project i uses the cake validation witch uses server
  side validation , i need it to focus on the error field after
  detecting it so how can i do something like this  ?? since the focus
  can be done with a client side  validation , so im wondiring if there
  is any way in cake to do that in the same validation process .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Should I be using a custom query?

2008-08-22 Thread RichardAtHome

$contacts = $this-Contact-find('first',
array(
'conditions' =
array('Contact.jobType' = 'main)
)
);


Note the 'first' parameter.

On Aug 22, 12:40 am, eagle [EMAIL PROTECTED] wrote:
 Hi,
 First of I'm new to Cake and tryign it out for the first time - I've
 searched here and on Google to solve what I suspect will be an
 idiotically simple question 

 Two tables:
 VENUES hasmany CONTACTS
 all linked in the models correctly

 On my default view of the venues table I want to filter the contacts
 to display only one of the potentially many based on a field value of
 'main'.

 venues_controller::index() is
 $this-Venue-recursive = 1;
 $this-set('venues',$this-paginate('Venue'));
 $venues = $this-Venue-find('all');

 and contacts_controller::index() is
 $this-Contact-recursive = 1;
 $contacts = $this-Contact-find('all',
                         array(
                                 'conditions' = array('Contact.jobType' = 
 'main)
                                 )
                         );
 $this-set('contacts', $contacts);

 I can retrieve all contacts for a venue on the index view for venues,
 but I only want the 'main' one.

 Should I set up a custom query in the venues_controller to do this? Or
 am I missing somehting more obvious?

 Thanks for any guidance.

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



Re: how to do multiple hasmany

2008-08-22 Thread RichardAtHome

You need to combine them both into 1 hasMany array:

var $hasMany = array(
  'Childclass1'  = array(
'className' = 'Childclass1'
  ),
  'Childclass2'  = array(
'className' = 'Childclass2'
  )
);

On Aug 22, 12:43 am, robert123 [EMAIL PROTECTED] wrote:
 i have parent model, it has two hasmany child model,

 in the model class, I tried to model this relation by writing two time
 in the parent model class

  var $hasMany = array('Childclass1'  =
array('className' =
 'Childclass1');

  var $hasMany = array('Childclass2'  =
array('className' =
 'Childclass2');

 but it giving me the below error
 Cannot redeclare Childclass2::$hasMany

 anyone can let me know, how to solve this, thank you

 http://www.generics.ws/jpn/レビトラ(塩酸バルデナフィルHCL_)に20_MGについて-p-115.htmlhttp://www.generics.ws/jpn/プロペシア(フィナステライド)-p-4.htmlhttp://www.generics.ws/jpn/バイアグラ(クエン酸シルデナフィル)-p-2.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: User Authentication Methods

2008-08-21 Thread RichardAtHome

In a nutshell:

Auth tells you who they are

ACL tells you what they can do once you know who they are

On Aug 21, 10:01 am, Penfold [EMAIL PROTECTED] wrote:
 Hi cem,

 have a look at

 http://bakery.cakephp.org/articles/view/authext-a-small-auth-extensio...

 this is a good out the box acl/auth component. it will get you up and
 running and is easy to follow.

 On 21 Aug, 09:23, cem [EMAIL PROTECTED] wrote:

  Thank you very much . But I have an example which really confuses me .
  Auth component is used for user login authentication and logout.  And
  adding the auth components beforefilter method to the AppController
  which runs all the authentication proces . So where do we need the
  ACL ? Thats why I am confused . I am reading articles about the ACL
  and in the articlesthey never use Auth component for permission
  authentication .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need help with passing into Element

2008-08-21 Thread RichardAtHome

What Fahmi said.

with

echo $this-renderElement('post_element', $post);

You are creating a variable in the element called $post_element (with
the value of $post)

The only reason its working for you at the moment is that you have
already created a variable in the view called $post:

foreach($posts as $post)

As all the variables share the same namespace, I would recommend:

echo $this-renderElement('post_element', $post);

and in the element, use $post_element to avoid confusion/overwriting
the $post in the view.


On Aug 21, 8:59 am, Fahmi Adib [EMAIL PROTECTED] wrote:
 i think you should use an array,

 array('post' = $post)

 On Aug 21, 2008, at 2:56 PM, rocket wrote:



  hey guys im passing this:

     foreach($posts as $post)
             echo $this-renderElement('post_element', $post);
     }

  but in my post_element i try to use

  $post['title']

  and it throws me this problem  Notice:  Undefined variable:

  Am i missing something? i'm real confused and have spent like 1 hour
  trying to debug this...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Inserts without a loop

2008-08-21 Thread RichardAtHome

I think the 1000 was for illustration only.

I'd run a few quick benchmarks to see what the real difference between
1 insert with 1000 values() and 1000 queries would be. I'm betting it
wont be much...

On Aug 20, 11:04 pm, teknoid [EMAIL PROTECTED] wrote:
 AFAIK, the syntax you are proposing is MySQL (or at least DB vendor)
 specific.
 So, it won't be supported by cake.

 And do you really insert 1001 rows?

 On Aug 20, 5:51 pm, seth [EMAIL PROTECTED] wrote:

Right, but how many inserts does this perform?

   - As many inserts as required

  Yes, but my whole point is that if you are inserting 1000 questions,
  this could be done in 2 interests or 1001... Is cake currently smart
  enough to do it in 2?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Clean urls in search form

2008-08-21 Thread RichardAtHome

Dunno about 'best', but this works:

In your view (search.ctp)

?php echo $form-create(Model, array(action=search,
type=get) ?
?php echo $form-input(search_for) ?
?php echo $form-end(Search) ?

?php foreach($results as $result) : ?
... output your result here
?php endif; ?

In your controller:

function search() {

if (isset($this-params['url']['search_for'])) {

$scope = array(@[EMAIL PROTECTED] LIKE 
'.$this-params['url']
['search_for'].%');

}
else {

$scope = array();

}

$results = $this-Paginate(@Model, $scope);

$this-set(results, $results);

}

Replace @Model and @field with the name of the model and field you
want to search on.


On Aug 21, 1:10 pm, bitkidoku [EMAIL PROTECTED] wrote:
 Hello everyone,

 I am implementing a search form. But I want to make search results
 linkable like: http://somehost/products/search/keyword; (keyword is
 the word that is being searched).

 What is the best practise to achieve this? And what if the user could
 search defining many parameters like title, content, ingredients etc.?

 I googled this but I couldn't find any meaningful results.

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



Re: Problem with Cake and Vista

2008-08-19 Thread RichardAtHome

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

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

On Aug 19, 7:49 am, giulio [EMAIL PROTECTED] wrote:
 Hi,

 I'm new of cake php.

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

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

 I've only some problems:

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

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

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

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



Re: configure cake 1.2

2008-07-17 Thread RichardAtHome

Assuming you are using Apache 2.2:

In apache.conf

uncomment this line:
LoadModule rewrite_module modules/mod_rewrite.so

This will enable mod_rewrite

You then need to allow cakephp .htaccess file to take over control of
your webroot:

In your Directory section for your webroot folder (mine is c:
\htdocs):

Directory C:/htdocs
#
# Possible values for the Options directive are None, All,
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
MultiViews
#
# Note that MultiViews must be named *explicitly* --- Options
All
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please
see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed
in .htaccess files.
# It can be All, None, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

/Directory

Hope this helps :-)

On Jul 17, 8:53 am, Russell [EMAIL PROTECTED] wrote:
 Hello,
 I m very new  struggling with cake 1.2. Now I've 2 problems.

 1)  I m using wamp server in local host. After install cake1.2 in
 localhost, I m not getting cake default page (I mean with some color 
 css etc), but I can get my page after routing from route.php file.
 Perhaps mod_rewrite is not enable in my httpd.conf file, In there on
 ly lines exist:

 LoadModule rewrite_module modules/mod_rewrite.so
 #AddModule mod_rewrite.c
 But, how can I enable mod_rewrite?

 2)  I m working with my own index page, where I started a simple blog.
 I create a link nameed add  create   add.thtml page. but, I m
 getting the page can not found error 404 after clicking the link!!!

 But it's working with cake 1.19...
 So, wheres the problem with cake1.2???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this-Auth-user not refreshing after edit

2008-07-17 Thread RichardAtHome

The $this-Auth-reload() solution looks like a winner to me.

No unnecessary database reads, and you can keep the Auth user up to
date in responce to changes made by the user.

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



Re: table name directories created problems

2008-07-17 Thread RichardAtHome

Folder?


On Jul 17, 2:53 pm, Jonathan Snook [EMAIL PROTECTED] wrote:
 This wasn't easy to track down but apparently there are 5 reserved
 class names in PHP:

 __PHP_Incomplete_Class, stdClass, exception, php_user_filter and.
 Directory!!

 http://ca3.php.net/manual/en/reserved.classes.php

 So, use another name.

 On Thu, Jul 17, 2008 at 7:11 AM, web [EMAIL PROTECTED] wrote:

  It is not the code that i was written, just write for this copy
  anyone please try to create a table named 'directories' and try to
  access it by  accessing the controller and model according to the cake
  rules and conventions ... am sure you can not access .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: redirect and header error but no white space

2008-07-17 Thread RichardAtHome

You can save yourself a *lot* of heartache with this issue by leaving
off the closing ? in your php files :-)

--- snip ---
?php
class TestController extends AppController {

function index() {
}

}
---end snip---

is enough, the closing ? is optional

On Jul 17, 2:20 pm, haj [EMAIL PROTECTED] wrote:
 I'm using this editor on windows:

 http://www.emeditor.com/

 There is a checkbox in config menu if to add BOM or not for UTF-8.
 Some editor may not have this feature.

 On Jul 16, 1:07 pm, Stinkbug [EMAIL PROTECTED] wrote:

  Excuse my stupidity on this topic, but I don't really understand
  encoding at all.  So how exactly do I save a a file without the BOM?

  Does it require special software, or what?  I'm on windows.

  On Jul 14, 11:39 pm, haj [EMAIL PROTECTED] wrote:

   So, I basically saved all UTF-8 files without BOM and now things works
   beautifully.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake bake does not recognize relationships?

2008-07-16 Thread RichardAtHome

Try putting some data in your groups table. Cake will change the
textbox to a drop down select list.

On Jul 15, 10:35 pm, Renan Gonçalves [EMAIL PROTECTED] wrote:
 Recognize relationships based on InnoDB relationships is planned to CakePHP
 2.0.https://trac.cakephp.org/wiki/Proposals/2.0ToDoList

 []'s



 On Tue, Jul 15, 2008 at 4:07 PM, Mech7 [EMAIL PROTECTED] wrote:

  Does anybody know what could be wrong.. if I would bake my model /
  controllers / views for users
  it will just put a input text box for usergroup_id and in the model it
  just says:

  ?php
  class Users extends AppModel {
         var $name = 'Users';
  }
  ?

  Here is the table setup..

  ---
  CREATE TABLE `usergroups` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(120) NOT NULL,
   `created` datetime NOT NULL,
   `modified` datetime NOT NULL,
   PRIMARY KEY  (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

  CREATE TABLE `users` (
   `id` int(11) NOT NULL auto_increment,
   `username` varchar(120) NOT NULL,
   `password` varchar(120) NOT NULL,
   `usergroup_id` int(11) NOT NULL,
   `created` datetime NOT NULL,
   `modified` datetime NOT NULL,
   PRIMARY KEY  (`id`),
   KEY `fk_usergroup_id` (`usergroup_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  ---

  Does anybody know why it would not recognize the other table?

 --
 Renan Gonçalves - Software Engineer
 Cell Phone: +55 11 8633 6018
 MSN: [EMAIL PROTECTED]
 São Paulo - SP/Brazil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the output of Form Helpers

2008-07-15 Thread RichardAtHome

Also, you can manually add the html tags and not rely on the helper.

That said, the helper is *very* flexible and can accommodate a lot of
customisations :-)

On Jul 15, 12:33 pm, Dardo Sordi Bogado [EMAIL PROTECTED]
wrote:
 HtmlHelper::tags could be a posibility.

 On Tue, Jul 15, 2008 at 12:20 AM, Jonathan Snook

 [EMAIL PROTECTED] wrote:

  Probably your best bet is to create your own helper that uses the base
  elements like $form-text and $form-error. Wrap your own HTML around
  those. Take a look at how $form-input does it and model yours around
  it.

  -Jonathan

  On 7/14/08, Tallbrick [EMAIL PROTECTED] wrote:
   I have been hitting Google hard for any tutorials on customizing the
   output of Cake's form helpers.  Namely adjusting the output of radio
   and checkbox arrays using the 'automagic' form helpers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this-Auth-user not refreshing after edit

2008-07-14 Thread RichardAtHome

How can this be the preferred behaviour?

What do you do if you get a 'bad' user? Even if you delete his user
record you are helpless to stop him until he voluntarily logs out!

Or, what if you have a regular user who needs his 'role' changing?

Granted, profile edits and changes in roles are required less often,
but the security issue alone is enough to warant a refresh on every
page. A quick read of the database is hardly going to kill the system.

On Jul 14, 2:50 am, Jonathan Snook [EMAIL PROTECTED] wrote:
 On 7/13/08, RichardAtHome [EMAIL PROTECTED] wrote:

   It looks like the Users model is only being read once at login and the
   details stored in a session (not checked the cake code, but that would
   match the behaviour I am experiencing).

   Basically, the edit is working (ie, database gets updated), but the
   $this-Auth-user() isn't.

 I contend that this is the preferred behaviour. Refreshing the user
 object stored in the session is unnecessary on 99% of the page views
 (I suspect most users don't edit their profiles on a regular basis).

 I suspect that it's just a simple storing of the current user in the
 session (in Session-read('User')) but it'd be nice to have an
 Auth-refreshSession() method that would refresh the current user in
 the session. Maybe submit a ticket for that...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this-Auth-user not refreshing after edit

2008-07-14 Thread RichardAtHome

Yes, but that 1% where it IS needed is critical ;-)

I agree that a refresh method would be useful, and if present would
allow me to add it to the App Controller to get the effect I'm after.
That way everyone is happy :-)

Anyone know how to refresh the user record? Is it simply a case of
setting the Auth Session User var?

On Jul 14, 9:58 am, AD7six [EMAIL PROTECTED] wrote:
 On Jul 14, 10:24 am, RichardAtHome [EMAIL PROTECTED] wrote:

  How can this be the preferred behaviour?

  What do you do if you get a 'bad' user? Even if you delete his user
  record you are helpless to stop him until he voluntarily logs out!

  Or, what if you have a regular user who needs his 'role' changing?

  Granted, profile edits and changes in roles are required less often,
  but the security issue alone is enough to warant a refresh on every
  page. A quick read of the database is hardly going to kill the system.

 And is, as Jonathan Snook pointed out, needless 99% of the 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   3   >