Re: Mod Rewrite problem

2009-02-09 Thread Webweave

Here's a good writeup from the bakery:
http://bakery.cakephp.org/articles/view/mod-rewrite-on-godaddy-shared-hosting

On Feb 9, 5:53 am, thankyou gregbo...@gmail.com wrote:
 I'm not very familiar with modrewrite -- do I just add the text
 RewriteBase to the .htaccess file?

 On Feb 9, 12:17 am, Webweave webwe...@gmail.com wrote:

  You need to add the RewriteBase to the .htaccess files in the folder
  where you blog is.

  Assuming that blog.mywebsite.com is set up to serve the files from
  the /blog folder, you just need to make sure you have the .htaccess
  files as described 
  here:http://book.cakephp.org/view/37/Apache-and-mod_rewrite

  On Feb 8, 8:17 am, thankyou gregbo...@gmail.com wrote:

   Hello,
   I have the .htaccess file setup so that it makes cakephp work fine at
   mywebsite.com.
   The problem is that I also want to add a blog to the website at the
   folder /blog,
   so I can make blog.mywebsite.com work.  The folder is in /blog.

   My .htaccess file info is below, what do I need to do to make the
   blog.mywebsite.com work?

   IfModule mod_rewrite.c
      RewriteEngine on

      RewriteCond    $1 !^favicon.ico
      RewriteCond    $1 !^sitemap.xml

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

   Thank you.


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



Re: Mod Rewrite problem

2009-02-08 Thread Webweave

You need to add the RewriteBase to the .htaccess files in the folder
where you blog is.

Assuming that blog.mywebsite.com is set up to serve the files from
the /blog folder, you just need to make sure you have the .htaccess
files as described here: http://book.cakephp.org/view/37/Apache-and-mod_rewrite


On Feb 8, 8:17 am, thankyou gregbo...@gmail.com wrote:
 Hello,
 I have the .htaccess file setup so that it makes cakephp work fine at
 mywebsite.com.
 The problem is that I also want to add a blog to the website at the
 folder /blog,
 so I can make blog.mywebsite.com work.  The folder is in /blog.

 My .htaccess file info is below, what do I need to do to make the
 blog.mywebsite.com work?

 IfModule mod_rewrite.c
    RewriteEngine on

    RewriteCond    $1 !^favicon.ico
    RewriteCond    $1 !^sitemap.xml

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

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



Re: Can a variable defined in one view file be used in another ?

2009-02-07 Thread Webweave

Personally, I like the ability to pass variables to elements, it
allows me to reuse them on the same view.

For instance I have a page that displays two tables of the same type
of data: one is volunteer time slots that people can still sign up
for, and the other is to show the time slots that the logged in user
has signed up for.

In the view, I just call the same element twice, passing the data that
is to be displayed in each case.

I reuse the same element to display different slices of the same data
on other pages, and you could even do a drill down that way.

Personally I like keeping the element abstract and treating it like a
separate object and relying on the passed data as much as possible.

On Feb 7, 4:02 am, WebbedIT p...@webbedit.co.uk wrote:
 Should you be using $this-set in a view?  Set is used in the
 controller to pass a variable to the view then you pass on those
 variables to the element within the element call ...

 $this-element('view', array('var1' = $var1, 'var2' = $var2));

 My previous query still remains unanswered though as any variables you
 place in the $this-data array are automatically available in all
 views and elements, but is it ok/proper to pass variables 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-07 Thread Webweave

Just means that there is a child table that has at most one row that
is related to the parent, but also could have none.

On Feb 7, 1:53 am, WebbedIT p...@webbedit.co.uk wrote:
 Forgive me for asking what seems a dumb question .. but what is a zero
 to one relationship (don't snigger too loudly ... but I'll never learn
 by being too embarrassed to ask!)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Customized View for each User

2009-02-06 Thread Webweave

You get the currently authenticated user information from the Auth
object, so in your controller, you reference:

$userId = $this-Auth-user('id');

You can then use the value in your find to restrict the data.

On Feb 3, 7:47 pm, psa developer@gmail.com wrote:
 Hello.

 I'm new to cakePHP.
 I have this problem in my project application that I'm having
 difficulty determining the authenticated user information so that I
 can only display a list of designated accounts of him. I believe I
 have to filter the controller data at the view process but I don't
 where to get
 the user's information.
 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: trouble when i try to use OOP with Cake

2009-02-05 Thread Webweave

There is no requirement to have a one-to-one relationship between
models and controllers. Chris Hartjes talks about this in his blog:
http://www.littlehart.net/atthekeyboard/2009/01/04/cakephp-mythbusters/

You can run your entire application with a single controller if that
makes sense for you.

I have a controller that uses a nested set of tables with all sorts of
HABTM relationships for the bulk of the work on my app, and it works
very well.


On Feb 5, 8:33 am, persivo_cunha ricky...@gmail.com wrote:
 If necessary, i can post my code.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Cake PHP and XAMPP (windows)

2009-02-05 Thread Webweave

That error is usually seen when your .htaccess files are not in the
right places.

Look at http://book.cakephp.org/view/37/Apache-and-mod_rewrite



On Feb 4, 8:43 am, Celso cels...@gmail.com wrote:
 I thanks! I did! However, I have this error:

   Error: NotesController Create the class below in file: app \
 controllers \ notes_controller.php

 I created the file and put the class! But it does not work ...
 I think I will give up the XAMPP

 On 16 jan, 05:01, ezekfred ezekf...@wanadoo.fr wrote:

  when i began with cake I use this 
  websitehttp://www.formation-cakephp.com/1/environnement-travail-cakephp-windows

  or if you don't understand 
  french:http://translate.google.fr/translate?u=http%3A%2F%2Fwww.formation-cak...

  it worked for me! even on vista (I install xampp in c:\xampp)

  On 15 jan, 17:31, Celso cels...@gmail.com wrote:

   Hello! I am new in cakephp, I am with a proposal to replace the asp by
   php here in my work. 
   Tenteihttp://www.sitepoint.com/article/application-development-cakephp/2/,
   but does not work in XAMPP ...

   Celso


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: utf-8 encoding problem

2009-02-03 Thread Webweave

Must be something wrong with your copy of Firefox: I don't get any mis-
encoding of the URL in mine.

I have version 3.0.5 and tested it both on Windows XP and Mac OS X
with no problems.

The URL that gets displayed in the browser by pressing enter in the
address bar is the one with the Arabic characters in it that I posted
before.

The URL that I see if I click the Google search button after that does
get encoded, but it properly encodes as 
http://www.google.com/search?hl=enrls=igq=مقالbtnG=Search

Now when I paste the URL into the Google groups editor, I do get
http://www.google.com/search?hl=enrls=igq=%D9%85%D9%82%D8%A7%D9%84btnG=Search,
but even that does the correct search.
On Feb 3, 3:50 am, mohammad al-ani alani.moham...@gmail.com wrote:
 Webweave i didn't know how to explain my problem well because of my poor
 English but to know what i mean with my problem just open your tiny url

 http://tinyurl.com/b8fl58

 and with that the firefox request will be in the utf-8 encoding but if you
 click on the firefox address bar and press enter to re-request the page the
 firefox will encode the مقال word to the %E3%DE%C7%E1 which is encoded with
 the windows-1256 encoding . so is there anyway to know the encoding of the
 comming data from the firefox, any function any script for that.

 and thank you again .

 On Tue, Feb 3, 2009 at 12:02 AM, Webweave webwe...@gmail.com wrote:

  Well, that to me would seem to mean that you are indeed trying to
  access the page from a page that is not defined as UTF-8.

  From Firefox, if I type مقال into the Google search box, I get a
  return search of
 http://www.google.com/search?q=مقالie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-ahttp://www.google.com/search?q=%D9%85%D9%82%D8%A7%D9%84ie=utf-8oe=u...

  So wherever you are inputting the string, it is getting translated
  incorrectly (which to me means it's not UTF-8).

  See:http://tinyurl.com/b8fl58

  If you load up Firebug, you should be able to look at the Response
  headers and see the Content-Type of text/html; charset=UTF-8

  On Feb 2, 11:21 am, mohammad al-ani alani.moham...@gmail.com wrote:
   thank you Dr. Loboto but i find the real problem.

   i develop the site under firefox so if i use the internet explorer i can
  get
   the arabic word like it it but when i use the firefox and search for word
   like مقال the address of firefox will be

   /search?keyword=مقال

   and when i just confirm this link by press enter on it the firefox
  converted
   the link to

  http://www.localhost.com/alsameriae/search?keyword=%E3%DE%C7%E1

   which will cuase the problem so is there any way to check form the
  encoding
   type

   On Mon, Feb 2, 2009 at 6:38 AM, Dr. Loboto drlob...@gmail.com wrote:

Your problem is caused by wrong page encoding. Follow Marcelo Andrade
checklist to eliminate wrong encoding on all steps. Everywhere should
be UTF-8 and URL will be in UTF-8 too. Or you use some unknown really
stupid browser that can't handle UTF-8 at all - but I can't imagine
such a browser in present time.

On Feb 1, 3:02 pm, mohammad al-ani alani.moham...@gmail.com wrote:
 thank you all for your time and help

 but my problem actually is caused by the browser . he send the url
  query
to
 the cakephp in the form of ANSI and i configure the cake and the
  header
of
 generated page to use the utf-8 so the quastion is how to change the
recived
 ansi data to the utf-8 data it's not about notpad++ it's about
  dynamic
read
 write data

 On Fri, Jan 30, 2009 at 6:54 PM, Marcelo Andrade 
  mfandr...@gmail.com
wrote:

  On Thu, Jan 29, 2009 at 7:18 PM, medo alani.moham...@gmail.com
wrote:
   (..)

  This is a very common issue.  Just follow this checklist:

  1. Using a smart editor (for Windows: Notepad++, Textpad, ...; for
  Gnu/Linux: Gedit,
  Kedit, Geany, Kate, Vim...), be sure that all of your .php and .ctp
  files are saved
  with the UTF-8 (without BOM) encoding;

  2. Be sure that your webserver is configured to serve the pages in
  UTF-8 encoding
  (in Apache, the line 'AddDefaultCharset UTF-8' in your httpd.conf);

  3. Be sure that your database tables are configured with the UTF-8
encoding
  (in
  MySql, create your tables with the proper collation option);

  4. In the very last case, if the problem still persists and your
  are a
  really paranoid,
  change the PHP interpreter encoding in your php.ini.

  Best regards.

  --
  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 Lost
 http://www.petitiononline.com/libby423/petition.html


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post

Re: Auth not hashing passwd with scaffolded controller?

2009-02-03 Thread Webweave

Once you turn on Auth, the passwords will get hashed automagically by
Cake (assuming you have 'Auth' in your $components, and your
beforeFilter logic is right).

If you have existing rows that were added before you turned Auth on,
you will likely need to update them so that they get stored in the DB
as hashed values.

On Feb 2, 11:54 pm, Heryudi Ganesha hery...@hangtuah.or.id wrote:
 Hi all,

 Just curious. Currently i'm trying auth component following this 
 tutorial:http://www.studiocanaria.com/articles/cakephp_auth_component_users_gr...

 When I create a new user and submit it (scaffold mode), the password is
 not hashed - it display clear text user password. Is it actually auth
 behave like that on scaffold mode or it shouldn't?

 Thanks

 -- heryudi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: utf-8 encoding problem

2009-02-03 Thread Webweave

The ci flavors are for case-insensitive versions, so if you want
John to be equal to john with no case conversion, you use one of
them.

The utf8_bin is the normal collation.

On Feb 3, 10:28 am, BrendonKoz brendon...@hotmail.com wrote:
 While on this subject, which MySQL table encoding is the normal,
 default utf-8 encoding?  utf8_bin, or utf8_general_ci, or
 utf8_unicode_ci?

 On Feb 3, 8:48 am, Marcelo Andrade mfandr...@gmail.com wrote:

  On Tue, Feb 3, 2009 at 8:55 AM, mohammad al-ani

  alani.moham...@gmail.com wrote:
   Dr. Loboto all of my pages encoded with utf-8 and the problem is not in my
   page the problem is with the firefox and everything go perfect with IE

  It works on IE because the CP-1252 encoding is a Windows-specific encoding
  that works primarily on the Microsoft products.  Unless you intend to make 
  your
  pages working only on IE, don't use it.

  To solve your problem, open all of your files in a smart text editor and 
  resave
  all of them with the UTF-8 (without BOM) encoding.  Check your editor about
  doing this.

  Best regards.

  --
  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 select queries within find()

2009-02-03 Thread Webweave

The only change you need to make is to add the model name in front of
the star, and to make sure the count syntax results in a usable field
name:

find('all', array('fields' = array('Post.*', '(SELECT COUNT(1) FROM
comments Comment WHERE Comment.post_id = Post.id) AS
comment_count')));

On Feb 3, 5:16 pm, Miles J mileswjohn...@gmail.com wrote:
 Ive seen some people do this, but forgot exactly how it should be
 written. Im looking to grab a total/count for items within a query.
 For instance, if Im grabbing a list of blog entries, I also want to
 get a total of how many comments each entry has. Instead of doing a
 loop and doing more queries, Ive seen it written within the find it
 self.

 find('all', array('fields' = array('*', 'SELECT COUNT(id) AS count
 FROM comments WHERE id = $)));

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



Re: utf-8 encoding problem

2009-02-02 Thread Webweave

Well, that to me would seem to mean that you are indeed trying to
access the page from a page that is not defined as UTF-8.

From Firefox, if I type مقال into the Google search box, I get a
return search of 
http://www.google.com/search?q=مقالie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a

So wherever you are inputting the string, it is getting translated
incorrectly (which to me means it's not UTF-8).

See: http://tinyurl.com/b8fl58

If you load up Firebug, you should be able to look at the Response
headers and see the Content-Type of text/html; charset=UTF-8


On Feb 2, 11:21 am, mohammad al-ani alani.moham...@gmail.com wrote:
 thank you Dr. Loboto but i find the real problem.

 i develop the site under firefox so if i use the internet explorer i can get
 the arabic word like it it but when i use the firefox and search for word
 like مقال the address of firefox will be

 /search?keyword=مقال

 and when i just confirm this link by press enter on it the firefox converted
 the link to

 http://www.localhost.com/alsameriae/search?keyword=%E3%DE%C7%E1

 which will cuase the problem so is there any way to check form the encoding
 type

 On Mon, Feb 2, 2009 at 6:38 AM, Dr. Loboto drlob...@gmail.com wrote:

  Your problem is caused by wrong page encoding. Follow Marcelo Andrade
  checklist to eliminate wrong encoding on all steps. Everywhere should
  be UTF-8 and URL will be in UTF-8 too. Or you use some unknown really
  stupid browser that can't handle UTF-8 at all - but I can't imagine
  such a browser in present time.

  On Feb 1, 3:02 pm, mohammad al-ani alani.moham...@gmail.com wrote:
   thank you all for your time and help

   but my problem actually is caused by the browser . he send the url query
  to
   the cakephp in the form of ANSI and i configure the cake and the header
  of
   generated page to use the utf-8 so the quastion is how to change the
  recived
   ansi data to the utf-8 data it's not about notpad++ it's about dynamic
  read
   write data

   On Fri, Jan 30, 2009 at 6:54 PM, Marcelo Andrade mfandr...@gmail.com
  wrote:

On Thu, Jan 29, 2009 at 7:18 PM, medo alani.moham...@gmail.com
  wrote:
 (..)

This is a very common issue.  Just follow this checklist:

1. Using a smart editor (for Windows: Notepad++, Textpad, ...; for
Gnu/Linux: Gedit,
Kedit, Geany, Kate, Vim...), be sure that all of your .php and .ctp
files are saved
with the UTF-8 (without BOM) encoding;

2. Be sure that your webserver is configured to serve the pages in
UTF-8 encoding
(in Apache, the line 'AddDefaultCharset UTF-8' in your httpd.conf);

3. Be sure that your database tables are configured with the UTF-8
  encoding
(in
MySql, create your tables with the proper collation option);

4. In the very last case, if the problem still persists and your are a
really paranoid,
change the PHP interpreter encoding in your php.ini.

Best regards.

--
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 Lost
   http://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: how to config my habtm?

2009-02-02 Thread Webweave

You simply tell the model what the name of the table is as described
here: http://book.cakephp.org/view/436/useTable

You can always use existing table structure, it's just a little easier
with things that follow the Cake convention.

I do something similar with the primary key fields in my DB, since my
convention is to name the ID with the entity name (e.g. - users table
primary key is user_id), and all I have to do is add the $primaryKey
to the model.

On Feb 2, 9:06 am, persivo_cunha ricky...@gmail.com wrote:
 Hello,

 i'm using HABTM but, how i didn't know it, my db doesn't follow the
 cake's convention. I have two tables called 'objetos_aprendizagens'
 and 'usuarios', but my join table is 'objeto_aprendizagem_autores' .
 How can i use it without change my db?

 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: Hello to all !!! How to code for Cakephp

2009-01-30 Thread Webweave

Best place to start is http://www.cakephp.org, and read the Cookbook
at http://book.cakephp.org/view/4/Beginning-With-CakePHP ...

On Jan 30, 1:07 am, maulik@gmail.com maulik@gmail.com
wrote:
 hi to all frnds !!! i m just a beginner for cakephp. i want to learn
 so many things in cakephp. can u plz tell me from where i could find
 the good help for cakephp or link me the website 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakeAmfphp

2009-01-30 Thread Webweave

A quick search gives a Bakery article about it: http://tinyurl.com/c838jz

The first result is the CakeAMFPHP site, and the second is the Bakery
article on using it.

On Jan 29, 11:10 pm, laaptu sani...@gmail.com wrote:
 I am new to the cakephp framework. I am an actionscript programmer and
 I need to have extensive knowledge about cakeamfphp to communicate
 between flash and php. So,is there any tutorials regarding this.
 Please help me on 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: AJAX in CakePHP

2009-01-30 Thread Webweave

The AjaxHelper utilizes the ever-popular Prototype and script.aculo.us
libraries for Ajax operations and client side effects (see:
http://book.cakephp.org/view/208/AJAX)

You can use any JS libraries you want, and most of them have articles
in the Bakery about how to do so.

Try http://tinyurl.com/bp54my - Seem to be a lot of blog entries about
extJS ...

On Jan 29, 7:01 pm, Aurelius aurel...@temporaryinbox.com wrote:
 Hi!

 Is there an Integration/Plug-in for easily Integration JS-Functions
 from an more easy-to-use - Framework than JQuery?

 For example I think extJS provides much more easily integrated
 functions for an not-JS-Expert than JQuery...

 Is there some kind an help in CakePHP which make AJAX easy for JS-
 n00bs like me?

 thx
 Aurelius
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Vote for add Cakephp into Netbeans

2009-01-30 Thread Webweave

Well, if you are using NetBeans as an IDE, it does all the real magic
of code-completion and syntax checking already. And it is possible to
set up debugging for very generic PHP apps (although I personally
haven't figured out how to get it to work for Cake).

To me what would be cool would be having the integration to do the
basic console stuff, saving me time in the long run (think: ModelBaker
with the end result being your normal Cake classes).

Anybody developing Cake support for an IDE would be foolish not to
take advantage of the console apps, since that's one of the more
powerful aspects of the framework (CRUD in seconds).

Plus, by making the framework to use, the adoption of that framework
expands.

On Jan 30, 6:41 am, Smelly_Eddie ollit...@gmail.com wrote:
 I don't see the big thrill here...

 It already supports php I would assume. Which should provide all you
 need for debugging cake since it is properly structured classes,
 methods etc. It is just a super-sized php application.

 So it would seem the only perk is interface design, which I tend to
 avoid in IDEs since they usually add alot of extraneous code.

 Just my opinion though.

 On Jan 29, 11:45 am, Webweave webwe...@gmail.com wrote:

  C'mon people, there are only 84 votes out there - If NetBeans adds
  Cake support I'm guessing not only would it do the cool IDE stuff it
  does now, but we'd be able to debug, and some level of front end for
  baking (like ModelBaker)

  On Jan 28, 9:11 am, matt m...@madesecure.com wrote:

   Great idea! Netbeans is an awesome IDE. I noticed some people went
   ahead and left comments without actually casting a vote. Make sure to
   click the Vote for this issue link at the bottom of the issue's
   summary.

   On Jan 27, 9:27 pm, Diego Caro A. diegoc...@gmail.com wrote:

Please, vote for cakephp in Netbeans's Framework Support 
inhttp://www.netbeans.org/issues/show_bug.cgi?id=140918

Register and vote, please :).

--
Diego Caro A.
Estudiante Ing. Civil Informática

diegocaro |http://diego.bloog.cl

No tengo talentos especiales, pero sí soy
 profundamente curioso, Albert Einstein.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: utf-8 encoding problem

2009-01-30 Thread Webweave

How did you save your files? Are you working on Windows (using
character set windows-1256) ?

Windoze by default saves files on the file system with the default
ANSI character set. In order to get it to save as UTF-8, you have to
explicitly tell it to (e.g. in Notepad change the dropdown for
encoding from ANSI to UTF-8).

On Jan 29, 11:48 pm, mohammad al-ani alani.moham...@gmail.com wrote:
 and when i choose the windows-1256 i see the real world which is مقال

 On Fri, Jan 30, 2009 at 10:23 AM, mohammad al-ani
 alani.moham...@gmail.comwrote:

  params show me the value of the key 'keyword' is yes like this symbols

  On Fri, Jan 30, 2009 at 2:48 AM, brian bally.z...@gmail.com wrote:

  What does $this-params show you?

  On Thu, Jan 29, 2009 at 5:18 PM, medo alani.moham...@gmail.com wrote:

   hi group,

   i have problem with my search feature in my site the problem is when i
   use the search page to search for an Arabic word with the form get
   method. and i faced that problem in the prototype below

   search_controller.php  

   ?php

   class SearchController extends AppController {
    var $name='Search';
    var $uses=array('Article');

    function index(){
      $this-layout='page';
      if (isset($_GET['keyword'])) {
        $this-set('articles',$this-Article-find('all',array
   ('conditions'=array('Article.body like'='%'.base64_decode($_GET
   ['keyword']).'%';
        $this-set('keyword',$_GET['keyword']);
        $this-data['Search']['keyword']=urlencode(base64_decode($_GET
   ['keyword']));
      }
    }
   }

   ?

   index.ctp  

   ?php e($form-create(null,array('type'='get','url'='/search'))); ?
   ?php e($form-input('Search.keyword',array('label'='الكلمة المراد
   البحث عنها'))); ?
   ?php e($form-end('ابحث'));?
   hr /
   نتائج البحث عن ?php e($keyword); ?

   ?php var_dump($articles); ?

   and i use utf-8 for the layout.

   the problem is that the result of echoing $keyword is '' why that and
   how to solve 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Any one looking for a freelance work

2009-01-30 Thread Webweave

Post your req at http://withcake.com/

On Jan 25, 12:55 am, Novice Programmer novice.prog...@gmail.com
wrote:
 Hello,

 Please get in touch with me if you are looking for a freelance work. I have
 a site based on cakephp and want to add a few features to it.

 --
 Thanks  Regards,
 Novice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: my html can't be show very good.

2009-01-30 Thread Webweave

Most of the IDE's and editors will let you do a global search and
replace like that.

I use NetBeans, and would just do a shift-command-H to bring up the
Replace in projects dialog (another argument for using a modern
IDE).

On Jan 24, 2:03 am, Rimoe meiyo...@gmail.com wrote:
 Thanks,it's the reason.

 but the truth is I must  change my params for every link and the
 $form-input(select).

 Do you  have a good way to let it automated changed?

 Thanks.

 2009/1/24 brian bally.z...@gmail.com



  Are you using HtmlHelper? You probably need to tell it not to escape your
  text:

  echo $html-link(
   'shiftjis code',
   array('controller' = '...', 'action' = '...'),
   array('title' = '...'),
   false,
   false    // -- this param
  );

  See escapeTitle param:

 http://api.cakephp.org/class_html_helper.html#71ff7f331b08318bc867a4d...

  On Sat, Jan 24, 2009 at 2:50 AM, Rimoe meiyo...@gmail.com wrote:
   hi,
   everyone.
   Do you have this question?
   my html can't be show very good.
   for example.
   a href='link'shiftjis code/a
   when in my mobile browser, It has been shown like this:  shiftjis
   code/a,this kind of link.
   If you know why is it, please tell me, thank you.
   rimoe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: for create home.ctp page

2009-01-30 Thread Webweave

Read the cookbook, and then run 'cake bake' to build your skeleton
views is the easiest thing: http://book.cakephp.org/view/108/The-CakePHP-Console


On Jan 29, 11:18 pm, sagu sarvaiya.sag...@gmail.com wrote:
 Hey group  I am just beginner with cake php framework..
 So how to create .ctp  file
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: __mergeHasMany causing EXTREMELY slow data retrieval

2009-01-30 Thread Webweave

The exponential number would happen if your join isn't right.

Are you saying that it's fetching 8 million rows, or that you think
there's a looping bug in the code?

On Jan 19, 7:48 am, Dan grip...@gmail.com wrote:
 On Jan 16, 4:57 pm, Miles J mileswjohn...@gmail.com wrote:

  Why do you even need to grab 2800?

 I need to load them to generate order statistics. Another reason would
 be for a CSV export. 2800 is very small. We're in the process of
 developing an app that could have hundreds of thousands of rows in
 multiple tables with a has many relationship.

  Also whats the speed like for a low amount of results. And what
  happens when you limit what fields are returned.

 I'm already limiting the fields to exactly what I need. I just
 simplified it for this post.

 I did some additional testing and it seems to loop (Order rows)^
 (OrderLineItem rows) times! That's almost 8 million loops to process
 2800 rows of data. It seems to loop through every Order row for every
 OrderLineItem row. Anyone know why it would do 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: CakePHP Model Advice

2009-01-29 Thread Webweave

What are you seeing in the debug data for your Recipe find?

Post the controller code where you do the find, and what the data
output is, and it will be easier for someone to answer your question.

On Jan 28, 1:29 pm, matth matt...@gmail.com wrote:
 Thanks for that tidbit about the Ingredient model.

 I gave recursive a shot earlier in the day but that didn't help. At
 the moment, this is exactly what I'm working with:

 class Recipe extends AppModel
 {
         var $name = 'Recipe';
         var $primaryKey = 'id';
         var $recursive = 2;

         var $hasAndBelongsToMany = array(
                 'Ingredient' = array(
                         'className' = 'Ingredient',
                         'joinTable' = 'ingredients_recipes',
                         'foreignKey' = 'recipe_id',
                         'associationForeignKey' = 'ingredient_id',
                         'unique' = true,
                 )
         );

 }

 On Jan 28, 3:15 pm, yusuf widi wmo...@gmail.com wrote:

  no, it is ok if your ingredient model is empty...
  try to give recursive parameter with '2' when you use find method. by
  default recursive parameter is null.

  read more about recursive is on the 
  api.cakephp.orghttp://api.cakephp.org/class/model#method-Modelfind

  On Thu, Jan 29, 2009 at 4:46 AM, matth matt...@gmail.com wrote:

   Howdy,
   I'm having trouble fully wrapping my head around Cake's models. They
   seem great and I'm really working to figure out how to take advantage
   of all the benefits.

   However, I can't quite figure out how to set up my models
   appropriately. For example, I have two models (Recipe and Ingredient)
   and I have defined they following relationship in my Recipe model:

   var $hasAndBelongsToMany = array(
          'Ingredient' = array(
                  'className' = 'Ingredient',
                  'joinTable' = 'ingredients_recipes',
                  'foreignKey' = 'recipe_id',
                  'associationForeignKey' = 'ingredient_id',
                  'unique' = true,
          )
   );

   But I'm not able to retrieve my ingredients. So what's the deal? Is
   something wrong with my table setup? Do I need to modify my Ingredient
   model (because it's empty)?

  --http://www.wmonou.com


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



Re: Vote for add Cakephp into Netbeans

2009-01-29 Thread Webweave

C'mon people, there are only 84 votes out there - If NetBeans adds
Cake support I'm guessing not only would it do the cool IDE stuff it
does now, but we'd be able to debug, and some level of front end for
baking (like ModelBaker)

On Jan 28, 9:11 am, matt m...@madesecure.com wrote:
 Great idea! Netbeans is an awesome IDE. I noticed some people went
 ahead and left comments without actually casting a vote. Make sure to
 click the Vote for this issue link at the bottom of the issue's
 summary.

 On Jan 27, 9:27 pm, Diego Caro A. diegoc...@gmail.com wrote:

  Please, vote for cakephp in Netbeans's Framework Support 
  inhttp://www.netbeans.org/issues/show_bug.cgi?id=140918

  Register and vote, please :).

  --
  Diego Caro A.
  Estudiante Ing. Civil Informática

  diegocaro |http://diego.bloog.cl

  No tengo talentos especiales, pero sí soy
   profundamente curioso, Albert Einstein.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Creating a tagging system for uploaded images

2009-01-29 Thread Webweave

I'm not sure that I understand your question. What is the error you
are getting?

How are you doing the update of the related data (save, saveAll) ?


On Jan 28, 9:18 am, foldiman vi...@vinceallen.com wrote:
 Can anyone give general strategy advice on building a tagging system?
 I'm creating an app where users simply upload pics. I've successfully
 established an HABTM relationship bw my 'pic' model and my 'tag' model
 and have a table w two foreign keys called 'pics_tags'. Adding new
 'tags' updates this table just fine.

 However, I'm stuck when it comes to assigning already existing tags to
 already existing pics. I can currently click on a pic and view its
 associated tags and generate a list of available tags in a select
 form. However, I get a slew of errors if I try to submit a tag in the
 list. Currently, cake thinks I'm trying to add a new pic instead of
 updating my 'pics_tags' table.

 Do I need a custom function in my pics_controller to handle updating
 my 'pics_tags' table?

 Can anyone point me to a tutorial for building a tagging system?

 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: Get count of related model

2009-01-29 Thread Webweave

You could just add a count to the fields that you are fetching like:

$this-Foo-find('all', array('fields' = array('Foo.*', '(select count
(1) from bars Bar where Bar.foo_id = Foo.id) as bar_count')));

I use this approach both with fields and it can also be used with
conditions when you need to limit the results to rows that have (or
don't have) related items.

On Jan 28, 7:18 am, Günther Theilen thei...@eqi.de wrote:
 Hi,

 I've got two models Foo hasMany Bar.
 What would be the best way to get all entries of Foo and the number of
 according entries in Bar.
 I thought about a find-('all') and a count() in the view but that
 doesn't seem to be very elegant.
 Any hints?

 Regards
 Guenther
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Which editor for Mac OS X?

2009-01-29 Thread Webweave

I use NetBeans with Cake and haven't seen any serious shortcomings on
code completion, can you elaborate ? My only complaint with the PHP
support in NB has been that it feels a bit like a bolt-on, but as the
past has shown I'm sure the NB team will continue to rapidly improve
that.

There's also a request (that I think people should vote for) to have
Cake added to NetBeans, which would make things even easier.

On Jan 24, 4:31 am, rogwei rog...@comcast.net wrote:
 Emacs is the bomb. Free, cross-platform, extendable, and butters your
 toast. I have been pleasantly surprised to find that several other Mac
 applications respond to the same cursor movement keyboard shortcuts.
 It's like...a

 I too tried Eclipse and NetBeans and found them seriously flawed (on
 the Mac platform at least) and I am using state of the art quad core
 intel hardware. My beefs were not so much with performance, duh, but
 with the heavy handed project paradigm in Eclipse and the bugginess of
 NetBeans code completion. Both were show stoppers for me.

 Emacs is included in Leopard through the Terminal application, but you
 might want to set up MacPorts and install the X version. There is a
 PHP mode for Emacs, also available through MacPorts, that provides
 some useful features for PHP development.

 On Jan 23, 6:01 am, leo ponton@gmail.com wrote:

  Having spent months trying to find an adequate editor for Windows, I
  eventually settled on Komodo. Now I'm working on a Mac and Komodo is
  available, but version 5 is so slow it's unusable. I reverted to v4,
  but while it is a little quicker it is also a little unstable. It is
  still slow enough  to be irritating - 2 seconds to switch tabs;
  sometimes it doesn't load the plugins, sometimes it will not maximise
  properly.

  Okay, I'm not using a cutting edge Intel Mac, I'm on a G4 / Leopard,
  but it's still a reasonably powerful machine (it'll run Photoshop and
  Illustrator simultaneously without grinding to a halt).

  Can anybody suggest a non-java based editor (I do not like Eclipse or
  NetBeans or anything Java come to that)? I've tried Xcode, but it
  seems really clunky and not at all geared to PHP. It needs to have
  project handling like Komodo, code intelligence and above all, it must
  be free.

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



Re: Which editor for Mac OS X?

2009-01-29 Thread Webweave



On Jan 25, 10:49 am, leo ponton@gmail.com wrote:
 Sorry to be slow getting back - we've had a thirty hour power outage
 following a storm that ripped off roofs and uprooted trees. A little
 unusual here in Spain.
 @everybody and nobody, I dislike Eclipse and Netbeans because
 1. (without redoing the sums) I don't understand why an editor should
 use in excess of 250MB runtime (including java) - even Photoshop uses
 less than that, and it works.

NetBeans runs in way less than 250MB (mine is running right now at
128K with all of the plugins, the embedded web server and several
projects open).


 2. I hate Java. Why is it there? Leave it in AI toasters where it
 belongs. And stop reinventing uses for it. (java servlets and sh*t
 like that)

Java is a powerful language and just because you don't like it doesn't
mean it should go away. It was written for distributed computing, and
it's reputation as a toaster language came mostly from flaming logos
in the early days of the web.

You might as well say that nobody should have written Cake since there
were already MVC frameworks around. Or hate PHP because it grew out of
Perl so why would we need another language.

BTW, James Gosling wrote the early Unix version of Emacs (http://
en.wikipedia.org/wiki/James_Gosling) and even he says to use a real
IDE: http://www.computerworld.com.au/index.php/id;170166942;fp;16;fpid;1

 3. They both stopped my PC in its tracks (brand new out the box fully
 loaded) although NetBeans was a little better.

Which version of NB did you load up?

 4. One didn't have drag and drop and the other didn't have something
 else really basic that I don't remember.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Model Advice

2009-01-29 Thread Webweave

OK, just an observation, but first your ID is 0, which doesn't make
sense for an ID value.

But assuming that's OK for a moment, what is the result if you query
the ingredients_recipes table directly for recipe_id of 0.


On Jan 29, 10:11 am, matth matt...@gmail.com wrote:
 Sure thing.

 My recipes controller view function:
 function view($id = null)
 {
         $this-set('recipe', $this-Recipe-findById($id));

 }

 My recipes/view.ctp debug output:
 Array
 (
     [Recipe] = Array
         (
             [id] = 0
             [created] = 2009-01-21 22:49:23
             [name] = Hot Salad
             [author] = Tristero
             [description] =
             [picture] =
             [origin] =
             [aka] =
             [servings] =
             [shelf_life] =
             [prep_time] =
             [cook_time] =
             [ready_in] =
         )

     [Ingredient] = Array
         (
         )

 )

 On Jan 29, 11:37 am, Webweave webwe...@gmail.com wrote:

  What are you seeing in the debug data for your Recipe find?

  Post the controller code where you do the find, and what the data
  output is, and it will be easier for someone to answer your question.

  On Jan 28, 1:29 pm, matth matt...@gmail.com wrote:

   Thanks for that tidbit about the Ingredient model.

   I gave recursive a shot earlier in the day but that didn't help. At
   the moment, this is exactly what I'm working with:

   class Recipe extends AppModel
   {
           var $name = 'Recipe';
           var $primaryKey = 'id';
           var $recursive = 2;

           var $hasAndBelongsToMany = array(
                   'Ingredient' = array(
                           'className' = 'Ingredient',
                           'joinTable' = 'ingredients_recipes',
                           'foreignKey' = 'recipe_id',
                           'associationForeignKey' = 'ingredient_id',
                           'unique' = true,
                   )
           );

   }

   On Jan 28, 3:15 pm, yusuf widi wmo...@gmail.com wrote:

no, it is ok if your ingredient model is empty...
try to give recursive parameter with '2' when you use find method. by
default recursive parameter is null.

read more about recursive is on the 
api.cakephp.orghttp://api.cakephp.org/class/model#method-Modelfind

On Thu, Jan 29, 2009 at 4:46 AM, matth matt...@gmail.com wrote:

 Howdy,
 I'm having trouble fully wrapping my head around Cake's models. They
 seem great and I'm really working to figure out how to take advantage
 of all the benefits.

 However, I can't quite figure out how to set up my models
 appropriately. For example, I have two models (Recipe and Ingredient)
 and I have defined they following relationship in my Recipe model:

 var $hasAndBelongsToMany = array(
        'Ingredient' = array(
                'className' = 'Ingredient',
                'joinTable' = 'ingredients_recipes',
                'foreignKey' = 'recipe_id',
                'associationForeignKey' = 'ingredient_id',
                'unique' = true,
        )
 );

 But I'm not able to retrieve my ingredients. So what's the deal? Is
 something wrong with my table setup? Do I need to modify my Ingredient
 model (because it's empty)?

--http://www.wmonou.com


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



Re: Fatal error: CakePHP core could not be found

2009-01-23 Thread Webweave

It looks like you must have a typo in one of your config files.

The word PATH_SEPARATOR is being placed in your PATH instead of the
path separator charater (:), so there has to be a typo where you are
setting up the include path.

On Jan 23, 5:42 am, 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: Which editor for Mac OS X?

2009-01-23 Thread Webweave

What's your objection to NetBeans? If you're using it as a PHP editor
and it has all the code sense stuff like Komodo but seems to be more
stable to me.

On Jan 23, 6:01 am, leo ponton@gmail.com wrote:
 Having spent months trying to find an adequate editor for Windows, I
 eventually settled on Komodo. Now I'm working on a Mac and Komodo is
 available, but version 5 is so slow it's unusable. I reverted to v4,
 but while it is a little quicker it is also a little unstable. It is
 still slow enough  to be irritating - 2 seconds to switch tabs;
 sometimes it doesn't load the plugins, sometimes it will not maximise
 properly.

 Okay, I'm not using a cutting edge Intel Mac, I'm on a G4 / Leopard,
 but it's still a reasonably powerful machine (it'll run Photoshop and
 Illustrator simultaneously without grinding to a halt).

 Can anybody suggest a non-java based editor (I do not like Eclipse or
 NetBeans or anything Java come to that)? I've tried Xcode, but it
 seems really clunky and not at all geared to PHP. It needs to have
 project handling like Komodo, code intelligence and above all, it must
 be free.

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



Re: XML help

2009-01-21 Thread Webweave


Of course it depends on what you're trying to do, but ...

It's pretty much built in to Cake, all you need to do is set up the
routing and add code if you need it.

I wrote a bit about it here: 
http://blog.accuweaver.com/2008/12/04/cakephp-and-restful-web-services/


On Jan 21, 1:57 am, tjr88 t...@timothyreynolds.co.uk wrote:
 HI,

 I am looking use the XML to update and pass information from my
 database. I have looked over the cake docs and googled abit but does
 anyone know of any good reasources to point me in the right
 direction??

 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: HABTM - fields in jointable

2009-01-21 Thread Webweave

Well, again, I'm not sure what you're asking, have you looked at the
Cookbook ? http://book.cakephp.org/view/439/recursive


On Jan 20, 4:52 am, Ernesto e.fanz...@gmail.com wrote:
 i'm working on that bug :)

 can someone please explain me how cake loads related data? is there
 any doc i can read? i haven't find :(

 On 19 Gen, 17:03, Webweave webwe...@gmail.com wrote:

  What do you mean it doesn't work? Is it not firing, or are you getting
  an error ?

  On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote:

   uhm... i -partially- found the solution...

   if i load data from Customers_Controller the order_customer::afterFind
   doesn't work...

   On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote:

ok i found the solution

?php
class Recipe extends AppModel {
    var $name = 'Recipe';
    var $hasAndBelongsToMany = array(
        'Tag' =
            array(
                 'className'              = 'Tag',
                 'joinTable'              = 'recipes_tags',
                 'with'                   =
'',                          //-- here it is
                'foreignKey'             = 'recipe_id',
                'associationForeignKey'  = 'tag_id',
                'unique'                 = true,
                'conditions'             = '',
                'fields'                 = '',
                'order'                  = '',
                'limit'                  = '',
                'offset'                 = '',
                'finderQuery'            = '',
                'deleteQuery'            = '',
                'insertQuery'            = ''
            )
    );}

?

From the cookbook:
- with: Defines the name of the model for the join table. By default
CakePHP will auto-create a model for you. Using the example above it
would be called RecipesTag. By using this key you can override this
default name. The join table model can be used just like any regular
model to access the join table directly.

On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote:

 Hello.

 i have 2 models: Customer and Order, linked together by a HABTM
 relationship that's working fine.
 the Join table (orders_customers) has the following structure:

 order_customer_id
 customer_id
 order_id
 field_A
 field_B

 field_A and field_B must be *100 everytime the data is loaded.
 How can i achieve 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: Relationships - HABTM

2009-01-21 Thread Webweave
http://book.cakephp.org/view/439/recursive

On Jan 19, 7:57 am, rhythmicde...@gmail.com
rhythmicde...@gmail.com wrote:
 I have been making some pretty good headway on defining the
 relationships for my models. However I am not getting some data that I
 expect to get. This may be due to my relationship definitions or a
 misunderstanding of what CakePHP will do for me. I am hoping one you
 can point me in the right direction.

 So am I missing something here? Wrong relationship definition? Wrong
 expectation?

 Thanks in advance.
 Steve

 I have the following models and relationship definitions:

 Recipe
 var $hasAndBelongsToMany = array(
         'Ingredient' =
             array(
                 'className'              = 'Ingredient',
                 'joinTable'              = 'ingredient_lists',
                 'foreignKey'             = 'recipe_id',
                 'associationForeignKey'  = 'ingredient_id',
                 'unique'                 = true
                 ),
            'MeasurementType' =
             array(
                 'className'              = 'MeasurementType',
                 'joinTable'              = 'ingredient_lists',
                 'foreignKey'             = 'recipe_id',
                 'associationForeignKey'  = 'measurement_type_id',
                 'unique'                 = true
                 )
     );

 IngredientList
 var $belongsTo = array('Recipe', 'MeasurementType');

 Ingredient
 var $belongsTo = 'IngredientType';

 I set the recipe for the view var in the controller like so:
 $this-set('recipe', $this-Recipe-read());

 I expect that when I view the recipe array in the view I should see a
 multi-array. Each Ingredient array should have a sub array that
 contains the ingredient, ingredient_type and measurement_type. But
 this is not the case.

 When I do a debug of the $this-viewVars in the view view I get the
 following output. As you can see the MeasurementType array is not
 under the Ingredient array.

 app\views\recipes\view.ctp (line 37)

 Array
 (
     [Recipe] = Array
         (
             [id] = 02
             [recipe] = Cranberry Orange Bake
             [description] = A classic casserole with a festive flair.
             [instructions] = Preheat the oven to 400 degrees.
 Prepare stuffing mixture as directed on box substituting orange juice
 and water for broth. Stir the cranberries and pecans in with the
 stuffing mix.

 Combine the soup, Quorn and vegetables. Spoon into an 13x9 baking dish
 and top with the stuffing mixture.

 Bake for 30min or until cooked through.
             [servings] = 6
             [recipe_type_id] = 06
             [created] = 2009-01-16 10:35:19
             [modified] = 2009-01-16 10:43:15
         )

     [Ingredient] = Array
         (
             [0] = Array
                 (
                     [id] = 31
                     [ingredient] = stuffing mix
                     [ingredient_type_id] = 19
                     [description] =
                     [created] = 2009-01-09 20:10:44
                     [modified] = 2009-01-09 20:13:14
                     [IngredientList] = Array
                         (
                             [id] = 05
                             [recipe_id] = 02
                             [ingredient] = stuffing mix
                             [fractional_amount] =
                             [whole_amount] = 6
                             [measurement_type_id] = 01
                             [description] =
                             [created] = 2009-01-16 10:35:19
                             [modified] = 2009-01-16 10:43:15
                             [ingredient_id] = 31
                         )

                 )

             [1] = Array
                 (
                     [id] = 32
                     [ingredient] = orange juice
                     [ingredient_type_id] = 21
                     [description] =
                     [created] = 2009-01-09 20:13:31
                     [modified] = 2009-01-09 20:13:31
                     [IngredientList] = Array
                         (
                             [id] = 06
                             [recipe_id] = 02
                             [ingredient] = orange juice
                             [fractional_amount] =
                             [whole_amount] = 1
                             [measurement_type_id] = 02
                             [description] =
                             [created] = 2009-01-16 10:35:19
                             [modified] = 2009-01-16 10:43:15
                             [ingredient_id] = 32
                         )

                 )

             [2] = Array
                 (
                     [id] = 13
                     [ingredient] = water
                     [ingredient_type_id] = 12
                 

Re: MVC Desing tips

2009-01-21 Thread Webweave

I would suggest going through the Cookbook and doing a bake to get
started.

My typical dev cycle for Cake is:

  1. Build some tables
  2. Bake the app
  3. Bake the models, views and controllers
  4. Modify as needed.

See: http://book.cakephp.org/view/113/Code-Generation-with-Bake



On Jan 19, 1:11 pm, Mirthis mirt...@gmail.com wrote:
 Hi guys!
 I'm pretty new to Cake PHP and what I find really hard, being used to
 develop PHP without following any rule or schema, is to get used to
 the MVC design.model. In this moment I'm creating stuff without any
 particular purpose in mind, but just to get confident with the
 framework and to build something I''ll be able to reuse later
 What I have in mind is pretty simple. I want a site where different
 kind of contents can be published: news, pics, videos, etc. I think
 each of them can be displayed in a different section of the site and
 so easily implemented through a controller (NewsController,
 VideosController, etc.), its model and a set of views to access
 standard operations: browse, add, edit and delete contents.
 Now I want to add a feature shared among all this controllers to let
 user add comments to a conent. All comments will have the sane info
 (username, date, text, etc.) and should be displayed and managed in
 the same way regardless of the section where they're posted. It sounds
 simple but I have no idea on how to design it following MVC
 principles.

 Model
 I was thinking of having a unique table for all the comments and a set
 of associatives tables, one for each type of contents, to store
 association between a comment and a content item. Is not the best
 approach if we think about performance, so an alternative could be to
 have separate commments tables to speed up filtering. Anyway is not my
 first concern now.

 Controller
 I have two idea on how to implement the basic actions, but none of
 them looks right to me. The first is to have a comments controller
 class implementing the actions and then to create a set of subclasses,
 one for each type of contents, so I would have NewsCommentsController,
 VideosCommentsController, etc. In the subclasses I'd declare the right
 instance of the Model and call the superclass actions. The other idea
 is to have a component implementing the shared functionalities, but
 I've no idea if it's the right way to use a component and on how to do
 it.

 View
 I figure out I should have at least a view (or maybe an element?) to
 add a comment and one to show them, and that's all.

 A part from this what I can't understand well is how to put together
 all the pieces to obtain the final result. For instance having a main
 controller and its view, for example showing news, how can I add the
 action for posting/showing comments (that are in a different
 controller or component) and it's related view in the same page?
 U hope someone can give me some wise tips.And if someone is not clear,
 pleas ask me, I'm not a native english speaker and so I do lot of
 confusion some times.
 Thanks;)

 Andrea
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: getLastInsertId or something similar

2009-01-21 Thread Webweave

It will only return a value after you do an insert (a save of the new
Event).

Post the action you are having trouble with, and perhaps we can spot
the issue.

On Jan 19, 3:41 pm, mike mwu...@gmail.com wrote:
 eeerrr, this is not working.

 I have this in the User model:
 var $hasMany = array ('Event');

 this in the event model:
     var $belongsTo = array (
                 'User' = array(
             'className'    = 'User',
             'foreignKey'    = 'creator_id',
                 )
         );

 $this-User-Event-getLastInsertId() in the users controller returns
 nothing!

 what am I missing??

 On Jan 19, 3:01 am, Jon Bennett jmbenn...@gmail.com wrote:

   where do I grab the lastInsertId()?  in the event_controller?  and
    then how do I pass it to the user view?

  provided you've correctly set up your model associations, which I think are:

  User hasMany Event
  Event belongsTo User

  From your Users controller you can do:

  $event_id = $this-User-Event-getLastInsertId();

  hth

  jon

  --

  jon bennett
  w:http://www.jben.net/
  iChat (AIM): jbendotnet Skype: jon-bennett


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: getLastInsertId or something similar

2009-01-21 Thread Webweave

You would only need to use the getLastInsertId() if you had inserted
something and then immediately needed to add related data.

If your forms walk you through some process which goes to another
controller, you'd either need to pass the data along, or fetch it
again.

Like I said before, I have a similar thing where I create a new user
and register them for a slot. So, what I do is have an action in my
User controller that first creates the User, then does the
getLastInsertId, then adds the related row.

The getLastInsertId call comes after the save for each data bit and is
used in the foreign key field for the related data before that is
saved.

So, lets say you want to add a new user and a few events. You would do
the following:

1. Insert the user data using a $this-User-save($this-data)
2. Save the user ID into a field by calling $this-User-
getLastInsertId()
   $user_id = $this-User-getLastInsertId();
3. Loop through the event data and update the foreign key field with
the saved user ID
   $this-data['Event']['user_id'] = $user_id;
4. Save the event data ($this-User-Event-save($this-data
['Event'];)
5. drop through to your next view as normal depending on success or
failure of the above.



On Jan 21, 4:13 pm, mike mwu...@gmail.com wrote:
 does this mean I can't use getLastInsertId() if I inserted the event
 in another controller? (this was one of my original questions)

 In the events controller, I save the event, then redirect to the user
 view.  In the user controller is where I'm trying to get the event_id
 I just inserted.

 On Jan 21, 4:49 pm, Webweave webwe...@gmail.com wrote:

  It will only return a value after you do an insert (a save of the new
  Event).

  Post the action you are having trouble with, and perhaps we can spot
  the issue.

  On Jan 19, 3:41 pm, mike mwu...@gmail.com wrote:

   eeerrr, this is not working.

   I have this in the User model:
   var $hasMany = array ('Event');

   this in the event model:
       var $belongsTo = array (
                   'User' = array(
               'className'    = 'User',
               'foreignKey'    = 'creator_id',
                   )
           );

   $this-User-Event-getLastInsertId() in the users controller returns
   nothing!

   what am I missing??

   On Jan 19, 3:01 am, Jon Bennett jmbenn...@gmail.com wrote:

 where do I grab the lastInsertId()?  in the event_controller?  and
  then how do I pass it to the user view?

provided you've correctly set up your model associations, which I think 
are:

User hasMany Event
Event belongsTo User

From your Users controller you can do:

$event_id = $this-User-Event-getLastInsertId();

hth

jon

--

jon bennett
w:http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett- Hide quoted text -

  - Show quoted text -


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



Re: MVC Desing tips

2009-01-21 Thread Webweave

Yes, there is a learning curve for Cake, it took me a couple of weeks
to even figure out that bake was the right way to get started.

On Jan 21, 2:03 pm, Andrea Cardinale mirt...@gmail.com wrote:
 On Wed, Jan 21, 2009 at 9:39 PM, Webweave webwe...@gmail.com wrote:
  I would suggest going through the Cookbook and doing a bake to get
  started.

  My typical dev cycle for Cake is:

   1. Build some tables
   2. Bake the app
   3. Bake the models, views and controllers
   4. Modify as needed.

  See:http://book.cakephp.org/view/113/Code-Generation-with-Bake

 I've already read a big part of the Cookbook, and doing to the huge
 amount of info forget an half of it, but now I know where the things I
 need are and I'm using it as a reference. I think is good to get
 started and to deal with basic task, but for example I can't find a
 solution to my problem, just some suggestion and none of them so
 sound.
 Anyway thanks for the reply;)

 Andrea
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Dynamic Model Call

2009-01-21 Thread Webweave

OK, I'm not sure why you are trying to do the late binding and use a
variable model name, but my guess would be that there is something
that hasn't been set up in the normal Cake magic of loading the code
that has caused something not to be initialized.

What is the rest of the stack for the error you are seeing (that
should show you where in the cake base classes the actual error is
happening)?

On Jan 21, 8:22 pm, Yusuf Widiyatmono wmo...@yahoo.com wrote:
 sorry it just a mark for the code line.

 Fatal error: Cannot access empty property in 
 {some_directories_path}\app\controllers\areas_controller.php on line **

 i mean that i got that message from this line

 $model_data = $this-AreaInfo-$model_name-find('list');    **

 
 From: brian bally.z...@gmail.com
 To: cake-php@googlegroups.com
 Sent: Thursday, January 22, 2009 1:06:39 PM
 Subject: Re: Dynamic Model Call

 What is on line** (from the error msg)?

 On Wed, Jan 21, 2009 at 10:37 PM, Yusuf Widiyatmono wmo...@yahoo.com wrote:
  the model is loaded...
  see the print_r result, the model can retrieve some data,
  but in the end the error still appear and make the further logic die

  
  From: brian bally.z...@gmail.com
  To: cake-php@googlegroups.com
  Sent: Thursday, January 22, 2009 12:30:22 PM
  Subject: Re: Dynamic Model Call

  Are these models loaded?

  On Wed, Jan 21, 2009 at 6:10 PM, Yusuf Widiyatmono wmo...@yahoo.com wrote:
  i did and it still shows me same errors...

  
  From: brian bally.z...@gmail.com
  To: cake-php@googlegroups.com
  Sent: Thursday, January 22, 2009 2:49:31 AM
  Subject: Re: Dynamic Model Call

  Try $this-AreaInfo-{$model_name}-find(...)

  On Wed, Jan 21, 2009 at 12:33 AM, wmonou wmo...@gmail.com wrote:

  Helo there i am trying to call model from a variable

  let say that i have a code is like this:

         // $model_name is a string
         // bind necessary model
         if(!empty($model_name)){
                 $this-AreaInfo-bindModel(
                         array(
                                 'belongsTo'=array(
                                         $model_name = array(
                                                 'className' =
  $model_name,
                                                 'foreignKey' =
  'reference_id'
                                                 )
                                         )
                                 )
                         );
                 }

         $model_data = $this-AreaInfo-$model_name-find('list');    // **
  this is my question
         print_r($model_data);

  the $model_data variable now is not empty, but i got something like
  this :

  Array
  (
     [1] = 1
     [2] = 2
     [3] = 3
     [4] = 4
     [5] = 5
     [6] = 6
     [7] = 7
     [8] = 8
     [9] = 9
     [10] = 10
     [11] = 11
     [12] = 12
     [13] = 13
     [14] = 14
     [15] = 15
     [16] = 16
     [17] = 17
     [18] = 18
     [19] = 19
     [20] = 20
  )

  Fatal error: Cannot access empty property in {some_directories_path}
  \app\controllers\areas_controller.php on line **

  is it possible to do such a thing like above? if yes or no please let
  me know with your sugesstion :) ...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: HABTM - fields in jointable

2009-01-19 Thread Webweave

What do you mean it doesn't work? Is it not firing, or are you getting
an error ?

On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote:
 uhm... i -partially- found the solution...

 if i load data from Customers_Controller the order_customer::afterFind
 doesn't work...

 On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote:

  ok i found the solution

  ?php
  class Recipe extends AppModel {
      var $name = 'Recipe';
      var $hasAndBelongsToMany = array(
          'Tag' =
              array(
                   'className'              = 'Tag',
                   'joinTable'              = 'recipes_tags',
                   'with'                   =
  '',                          //-- here it is
                  'foreignKey'             = 'recipe_id',
                  'associationForeignKey'  = 'tag_id',
                  'unique'                 = true,
                  'conditions'             = '',
                  'fields'                 = '',
                  'order'                  = '',
                  'limit'                  = '',
                  'offset'                 = '',
                  'finderQuery'            = '',
                  'deleteQuery'            = '',
                  'insertQuery'            = ''
              )
      );}

  ?

  From the cookbook:
  - with: Defines the name of the model for the join table. By default
  CakePHP will auto-create a model for you. Using the example above it
  would be called RecipesTag. By using this key you can override this
  default name. The join table model can be used just like any regular
  model to access the join table directly.

  On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote:

   Hello.

   i have 2 models: Customer and Order, linked together by a HABTM
   relationship that's working fine.
   the Join table (orders_customers) has the following structure:

   order_customer_id
   customer_id
   order_id
   field_A
   field_B

   field_A and field_B must be *100 everytime the data is loaded.
   How can i achieve 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: edit function is not working

2009-01-18 Thread Webweave

OK, I've responded about this exact code before. Just rewrite the
function with Cake conventions, and remove the direct MySQL updates
and you should be fine.

Your code is updating the record after the save, when you could simply
do the save with the query value from the count query, which should
look like:

$max_counter = $this-Entry-find('list', array('fields' = array('(max
(Entries.counter)) as max_counter')' )));

Take the value from $max_counter, and update your $this-data['Entry']
['counter'], then do your save and Cake will do the update according
to the data that is returned from the form.

I also would move the finds inside your check for empty($this-data),
since you don't need to repeat the find after the form is posted.

On Jan 16, 8:37 am, 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: Counting Tags. What is the find() syntax?

2009-01-18 Thread Webweave

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: getLastInsertId or something similar

2009-01-18 Thread Webweave

You don't have to have two forms, you just have to save things in the
right order.

I do this on one of my volunteer signup (http://volunteercake.sf.net).
Before the user is logged in, I display a list of jobs they can sign
up for, if they click on the 'signup' link, I take them to a page that
does both a user add, and creates the data to signify that new user is
associated with the job slot they chose.

I take the data from the form, insert a new user as normal, grab the
user id with getLastInsertedId, and then do a save for the UserSlot
that creates the association with the new user.

I do this with the following code (note that the _register function is
shared code that is used by the register and signup views):

/**
 * This method handle the user registration process.
 * It will first of all, get the user basic information.
 * After user submit the information, a hash key will be generated
and
 * stored in the database. An email will then send to user and
pending
 * for user activation
 */
function _register()
{
$valid = false;
$this-User-setValidation('register');

if ( !empty( $this-data ) ){
if ( $this-data['User']['user_password']
== $this-Auth-password( $this-data['User']
['user_pass_confirm'])) {

// This function does the creation of the user and
initial setup
// of the ACOs for them.
$this-User-create();
if ( $this-User-save($this-data) ){
$this-data['User']['user_id'] = $this-User-
getLastInsertId();
$this-data['UserSlot']['user_id'] = $this-data
['User']['user_id'];
$this-save_aro($this-data);
$this-Auth-login($this-data);

// do other stuff here like send activation email
to user
// or/and redirect to other page
$this-Session-setFlash(__('The User has been
saved', true));
$valid = true;
}
} else {
$this-Session-setFlash('password mismatch');
}
}
// Return whether we successfully completed the registration
or not
return $valid;
}


/**
 * Sign up - this method creates a User, and then signs them up
for the
 * slot they picked. Used by links in the page that pass a
slot_id.
 */
function sign_up() {
$this-User-setValidation('register');
if (!empty($this-data)) {
// Try to register (assumes we set up the User data in the
form
if ($this-_register())
{
$this-User-UserSlot-create();

if ($this-User-UserSlot-save($this-data
['UserSlot'])) {
$user_slot_id = $this-User-UserSlot-
getLastInsertId();
$this-data['UserSlot']['user_slot_id'] =
$user_slot_id;
$slot_id =$this-data['UserSlot']['slot_id'];
$job_id = $this-User-UserSlot-Slot-field
('job_id','Slot.slot_id = '.$slot_id);
$this-Session-setFlash(__('Slot Signup and
Registration complete', true));
$this-redirect('/jobs/view/'.$job_id, null,
true);
} else {
$this-Session-setFlash(__('Signup Signup
incomplete', true));
}
} // Falls through if the registration failed ...
} else {
// No POST data - check if we passed params ...
if ($this-passedArgs['user_id']  0)
{
// Try to save the UserSlot for the User ...
if ($this-User-UserSlot-save(array('UserSlot' =
array( 'slot_id' = $this-passedArgs['slot_id'], 'user_id' = $this-
passedArgs['user_id'] {
$this-Session-setFlash(__('Signup complete',
true));
} else {
$this-Session-setFlash(__('Signup incomplete',
true));
}
$this-redirect($this-referer(),null, true);
}
// If we got passed a slot_id, then we save it in the
UserSlot array
if (isset($this-passedArgs['slot_id']))
{
// Set the slot to the one we got passed ...
$this-data['UserSlot']['slot_id'] = $this-passedArgs
['slot_id'];
}
}

}


On Jan 18, 1:16 am, Jon Bennett jmbenn...@gmail.com wrote:
   You can't have an Event.user_id if there's no User. You're doing this 
  backwards.

 yep, so the order of things (doing it event first would be)

 * show new event form
 * on submit, save data to create a new Event record
 * grab the 'lastInsertId()' of the event record
 * pass this to the view to use in your User form, eg User.event_id
 * on submit, grab the event id out of the data array, then save the
 user data to create a new form
 * if all ok, grab the 'lastInsertId()' of the user record
 * update the 'user_id' field 

Re: Installation on a shared server (Hostmysite.com)

2009-01-18 Thread Webweave

You may need to update your .htaccess with the RewriteBase directive:

   RewriteBase /

This one change has always fixed my problems with shared hosting
servers.

On Jan 16, 5:34 pm, PHPScriptKiddy curl.rob...@gmail.com wrote:
 Hi guys,

 I am new to cakePHP, and am trying to set up a dev installation on my
 Hostmysite.com account. However, I keep getting the following error...

 Internal Server Error
 The server encountered an internal error or misconfiguration and was
 unable to complete your request.

 Please contact the server administrator, r...@trusteesofcolor.org and
 inform them of the time the error occurred, and anything you might
 have done that may have caused the error.

 More information about this error may be available in the server error
 log.

 I have tried searching google for people's experience with cakephp and
 hostmysite, but haven't found anything usefull

 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: Model Loading the Wrong Model

2009-01-18 Thread Webweave

Your belongsTo for 'Friend' is set up to use the 'User' model. If you
want the Friend model loaded, you need to tell it to load that class
instead.

On Jan 16, 8:57 am, Chad Casselman ccassel...@gmail.com wrote:
 I am building a social network and work on the users, requests, friends
 portion.

 users: id
 requests: id, user_id, friend_id
 friends: id, user_id, friend_id

 I had setup the requests and friends tables to have user_id and friend_id
 but they both point back to the users table.  When working on the request
 all is good.  However, now I am trying to approve a request (delete from the
 request table and put it into friend table) and have huge problems.

 In the request controller on approve, I want to insert a new row into the
 friends table, but because of the way the model is setup, it loads the User
 model and not the Friend model.  I am loading Friend on the fly but it is
 still using the wrong table.  Not sure how to make cakephp insert into that
 row.

 Code in the controller:
             $friend = ClassRegistry::init('Friend');
                 $data = array();
                 //assign friend
                 array_push($data, array('user_id' =
 $this-Auth-user('id'), 'friend_id' = $id));
                 $this-Friend-save($data);

 This calls save on the User model/table.

 I have also tried unbinding Friend and loading a different one but now
 luck.  Any ideas on how to fix this, or a better way to handle the
 requests/friends scenario?

 Chad

 Here are my models:
 class Request extends AppModel {

     var $name = 'Request';
     var $validate = array(
         'user_id' = array('numeric'),
         'friend_id' = array('numeric')
     );

     //The Associations below have been created with all possible keys, those
 that are not needed can be removed
     var $belongsTo = array(
             'User' = array('className' = 'User',
                                 'foreignKey' = 'user_id',
                                 'conditions' = '',
                                 'fields' = '',
                                 'order' = ''
             ),
             'Friend' = array('className' = 'User',
                                 'foreignKey' = 'friend_id',
                                 'conditions' = '',
                                 'fields' = '',
                                 'order' = ''
             )
     );

 }

 class Friend extends AppModel {

     var $name = 'Friend';
     var $validate = array(
         'user_id' = array('numeric'),
         'friend_id' = array('numeric')
     );

     //The Associations below have been created with all possible keys, those
 that are not needed can be removed
     var $belongsTo = array(
             'User' = array('className' = 'User',
                                 'foreignKey' = 'user_id',
                                 'conditions' = '',
                                 'fields' = '',
                                 'order' = ''
             ),
             'Friend' = array('className' = 'User',
                                 'foreignKey' = 'friend_id',
                                 'conditions' = '',
                                 'fields' = '',
                                 'order' = ''
             )
     );

 }

 The user model is pretty much blank.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 use cake console for baking

2009-01-18 Thread Webweave

It's in the manual (http://book.cakephp.org/view/113/Code-Generation-
with-Bake), what is the problem you are having ?

On Jan 16, 8:41 am, mona poojapinj...@gmail.com wrote:
 Can anybody tell me how to use bake.php for baking in cakephp1.2 i
 know how to use this in cakephp1.1 but i don't know in 1.2 i read the
 manual and tried but it was not working
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Distant Association Issue

2009-01-18 Thread Webweave

Just change your query to:

$this-EventDeadline-PayGroup-User-find('all', array(
  'conditions'=array('User.id'=$user['User']['id']),
  'order'='EventDeadline.due_start_date'
  'recursive' = 2));

That should fetch the related data for you (http://book.cakephp.org/
view/439/recursive)

On Jan 16, 2:34 am, overture phil.mccl...@gmail.com wrote:
 I'm having real problems when performing finds in CakePHP.  I can't
 seem to get my head around it.  Here's my problem.

 Association Structure
 users--users_pay_groups--pay_groups--event_deadlines

 How do I get all event_deadlines for a given user and order by a field
 in event_deadlines ?

 If I do:
 $this-EventDeadline-PayGroup-User-find('all', array(
       'conditions'=array('User.id'=$user['User']['id']),
       'order'='EventDeadline.due_start_date'));

 I get an error:
 SQL Error: 1054: Unknown column 'EventDeadline.due_start_date' in
 'order clause'

 Anyone got any ideas?

 Thanks! Phil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: unwanted user_id increase

2009-01-18 Thread Webweave

Looks like a documentation bug, you need to get the inserted ID before
you can save the related data, so the code really should be:

   $this-data['Profile']['user_id'] = $user['User']['id'];

Alternatively, you could use:

   $this-data['Profile']['user_id'] = $this-User-getLastInsertId();

Which is the way I usually do this.



On Jan 15, 8:14 pm, Delirium tremens pedbe...@gmail.com wrote:
 I removed the line, but it still does not work, because user_id is
 empty.

 On 16 jan, 00:51, stefano ssalvat...@gmail.com wrote:

  why are you doing the save into User's model? remove this line
  $usersaved = $this-User-save($this-data);

  function add() {
         if (!empty ($this-data)) {
                 $this-data['Post']['user_id'] = $this-User-id;
                 $postsaved = $this-User-Post-save($this-data);
                 if($postsaved) {
                         $this-flash('The post has been saved.', '/posts');
                 }
         }

  }
  On Thu, Jan 15, 2009 at 11:45 PM, Delirium tremens pedbe...@gmail.com 
  wrote:

   I have a User hasMany Post and a Post belongs to User. The function to
   add a post with an user id is inserting a user with null email and
   null password into the users table and a post with an user id
   increased by one into the posts table. Take a look...

   function add() {
          if (!empty ($this-data)) {
                  $usersaved = $this-User-save($this-data);
                  $this-data['Post']['user_id'] = $this-User-id;
                  $postsaved = $this-User-Post-save($this-data);
                  if($postsaved  $usersaved) {
                          $this-flash('The post has been saved.', '/posts');
                  }
          }
   }

   How to solve this problem?

  --
  Stefano Salvatori M.http://stefano.salvatori.cl/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: multiple httpd.conf files

2009-01-18 Thread Webweave

Did you stop and start Apache after making your changes ?

Why do you reference /Library/WebServer/Documents when your document
root is at /opt/local/apache2/htdocs ?

On Jan 15, 10:02 am, neridaj neri...@gmail.com wrote:
 I installed from the svn trunk and I have the .htaccess file in my
 1.2.x.x folder under the DocumentRoot - /Library/WebServer/
 Documents, are you saying that I need to copy this file to my apache
 directory? I tried copying that file to /opt/local/apache2/htdocs but
 it made no difference.

 On Jan 14, 4:24 pm, Bob Albert b...@superstan.com wrote:

  It looks like your httpd.conf file is correct. You just want the  
  AllowOverride set to All. I had a very similar problem with my Mac.  
  I'm using MAMP install, but i think your problem could be  
  the .htaccess file. In the 1.2 generic folder that you use as the  
  basis of your app has a .htaccess file that needs to be present in  
  your htdocs or webroot of the app folder in your Apache folder.  
  Sometimes this does not get copied correctly if you copied the  
  expanded folder.

  Either ls -la the folder in the terminal or show your hidden files and  
  make sure that .htaccess file was copied correctly to the root of your  
  cake app folder.

  On Jan 14, 2009, at 3:44 PM, Webweave wrote:

   Looks like you are running on Mac.

   If you're using the built in web server, then it is located at /
   private/etc/apache2/httpd.conf

   The 'which' command doesn't find files, it just tells you where the
   executable is in your path.

   On Jan 13, 3:54 pm,neridajneri...@gmail.com wrote:
   Hello,

   I just installed cake version 1.2.0.7962 and was going through the
   blog tutorial when I got the generic index page because there is a
   problem with my httpd.conf. I ran locate and found quite a few
   different httpd.conf files:

   $ locate httpd.conf
   /Applications/TextMate.app/Contents/SharedSupport/Bundles/
   Apache.tmbundle/Commands/Open httpd.conf.plist
   /opt/local/apache2/conf/httpd.conf
   /opt/local/apache2/conf/original/httpd.conf
   /opt/local/var/macports/software/apache2/2.2.11_0/opt/local/apache2/
   conf/original/httpd.conf
   /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
   apache2/files/patch-httpd.conf.in-sensitive-files.diff
   /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
   htdig/files/httpd.conf
   /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
   lighttpd/files/patch-doc-lighttpd.conf
   /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
   lighttpd-devel/files/patch-doc-lighttpd.conf
   /private/etc/httpd/httpd.conf
   /private/etc/httpd/httpd.conf.bak
   /private/etc/httpd/httpd.conf.default
   /private/etc/httpd/httpd.conf.entropy.backup
   /usr/local/apache2/conf/httpd.conf
   /usr/local/apache2/conf/original/httpd.conf

   I'm assuming I need to edit the /opt/local/apache2/conf/httpd.conf
   file as instructed 
   underhttp://book.cakephp.org/view/333/A-Note-on-mod_rewrite
   but it doesn't fix the problem. Here is what I have in the
   aforementioned httpd.conf file:

   DocumentRoot /opt/local/apache2/htdocs

   Directory /opt/local/apache2/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

   I thought maybe I needed to add this httpd.conf to my .bash_profile
   which I did with:

   PATH=/opt/local/bin:/opt/local/sbin:$PATH
   export DISPLAY=:0.0

   export PATH=${PATH}:/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/

   export EDITOR='mate -w'

   # Setting PATH for MacPython 2.5
   # The orginal version is saved in .bash_profile.pysave
   PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$
   {PATH}
   export PATH

   #export PATH=${PATH}:/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/
   PATH=/opt/local/apache2/conf:${PATH}
   export PATH

   ...but when I run which httpd.conf I get this:

   $ which httpd.conf
   no httpd.conf in /opt/local/apache2/conf /Library/Frameworks/
   Python.framework/Versions/Current/bin /opt/local/bin /opt/local/
   sbin /
   opt/local/apache2/conf /Library/Frameworks/Python.framework/Versions

Re: Questions about forms / validation

2009-01-18 Thread Webweave

The only reason your data would be getting reset, would be that you've
done a find again before the form is redisplayed.

Could you post the code for your edit so we can see what you're
doing ?

On Jan 14, 11:45 pm, Miles J mileswjohn...@gmail.com wrote:
 So Im working on this area where users can edit their profile, etc.
 All the validation works, its just on the email field it always errors
 because I am using the isUnique rule.

 It keeps erroring because the email in the input is THEIR email, and
 it does exist in the database. So it keeps throwing the isUnique error
 This email is already in use.. Is there a way I can get this
 working, while keeping the input email field populated?

 ---

 Also my form is prepopulated doing: array('value' = $user['User']
 ['value']). But when I make changes and hit submit, and an error
 occurs, the fields go back to the $user value and not the value they
 just did. A way around this as well?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: there is something missing

2009-01-18 Thread Webweave

The automated tool is just a convenience, so no you don't need to
understand it. You can manage ACOs completely with bake if you want
to.

I don't understand the rest of your post, looks like a reply to
something.

On Jan 13, 3:56 pm, Delirium tremens pedbe...@gmail.com wrote:
 We'll be doing that soon enough. You should now have models,
 controllers, and baked views for your users, groups, posts and
 widgets.

 in actions mode, this authenticates our ARO - groups and users -
 against the ACO objects - controllers  actions.

 After posts and widgets and before in actions mode, there is
 something missing.

 athttp://book.cakephp.org/view/642/Preparing-our-Application

 It looks like it is a lot missing, because all of a sudden We now
 have a functioning CRUD application.

 athttp://book.cakephp.org/view/643/Preparing-to-Add-Auth

 What do you think is missing?

 By the way, do I have to understand the automated tool for creating
 ACOs code to create a CakePHP site with user authentication?

 -http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Updating a User Record

2009-01-18 Thread Webweave

Then you just need to set the model and tell it what the primary key
is:

$primaryKey = email;

Then $this-Administrator-id would be the the email.

You might also need to set the Auth fields to match (I do this in my
App controller's beforeFilter):

$this-Auth-fields = array('username' = 'user_name',
'password' = 'user_password');


On Jan 13, 1:09 pm, Rob Wilkerson r...@robwilkerson.org wrote:
 On Tue, Jan 13, 2009 at 3:28 PM, Miles J mileswjohn...@gmail.com wrote:
  You have to set the id first, in your case it might be:

  $this-Administrator-id = $this-Auth-user('id');
  $this-Administrator-save($data);

 Therein, as they say, lies the rub. I don't have an id field in my
 administrators table. I use email for the Auth username and that's
 also the primary key on the table. I've already tried setting
 $this-Administrator-email, but Cake didn't handle it as a primary
 key and tried to insert the record. I tried telling the model that the
 email field was it's $primaryKey, but that screwed up authentication.

 Am I trying to push the envelope too far? Sounds like I can make all
 of this work out by adding a traditional primary key so is that the
 right way to go (read: the way I should've gone in the first place)?

 Thanks again.

 --
 Rob Wilkersonhttp://robwilkerson.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: get method validation

2009-01-18 Thread Webweave

Not clear on what your question means, are you asking about validation
rules?

On Jan 18, 7:30 am, Delirium tremens pedbe...@gmail.com wrote:
 How to validate an id passed not by post, but by get? I do not have to
 output an error message to hackers and crackers, do I? I tested using /
 ^[0-9]{1,10}$/ as rule, nothing as message and passing an a, but it
 did not output an error message.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: baking cakephp on MAC OS

2009-01-18 Thread Webweave

Looks to me like you ran into the same problem as I did here:
http://blog.accuweaver.com/2008/12/20/moving-my-volunteercake-to-my-mac/

Basically your MySQL and PHP are not configured the same way, so you
need to change one of them so that PHP can talk to MySQL.

This is a pure PHP problem, the first line in your errors shows you
that PHP isn't connecting:

Warning: mysql_connect(): Can't connect to local MySQL server through
socket '/var/mysql/mysql.sock'

On Jan 18, 11:59 am, bookme rarockthewo...@gmail.com wrote:
 Hi,

 I am trying to bake cake application on MAC OS but can not get
 success.

 I have tried two solution but not working.

 1 when I run cake bake command in app folder
  xampp/htdocs/cakephp/app cake bake
 it's showing cake : command not found on terminal

 2 In parent directory when I run
 xampp/htdocs/cakephp  ./cake/console/cake bake
 App : app
 Path: /Application/xampp/xampfiles/htdocs/cakephp/app
 ---
 Interactive Bake Shell
 ---
 [D]atabase Configuration
 [M]odel
 [V]iew
 [C]ontroller
 [P]roject
 [Q]uit
 What would you like to Bake? (D/M/V/C/P/Q)

  M

 ---
 Model Bake:
 ---
 Database Connection:
 [default] 
 Warning: mysql_connect(): Can't connect to local MySQL server through
 socket '/var/mysql/mysql.sock' (2) in /Applications/xampp/xamppfiles/
 htdocs/cake/cake/libs/model/datasources/dbo/dbo_mysql.php on line 370

 Warning: mysql_select_db(): supplied argument is not a valid MySQL-
 Link resource in /Applications/xampp/xamppfiles/htdocs/cake/cake/libs/
 model/datasources/dbo/dbo_mysql.php on line 375

 Warning: mysql_get_server_info(): supplied argument is not a valid
 MySQL-Link resource in /Applications/xampp/xamppfiles/htdocs/cake/cake/
 libs/model/datasources/dbo/dbo_mysql.php on line 383

 Warning: mysql_query(): supplied argument is not a valid MySQL-Link
 resource in /Applications/xampp/xamppfiles/htdocs/cake/cake/libs/model/
 datasources/dbo/dbo_mysql.php on line 407
 Error: Your database does not have any tables.

 But My database have one table..then what's wrong here?
 can any body tell me what's wrong I am doing here?

 or please tell what's tseps to run cake bake on MAC OS.

 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: get method validation

2009-01-18 Thread Webweave

Not sure I do, looks like you got a partial post. The validate
'numeric' for id, will validate the data for your id column as
numeric.

You don't even need that if the field is numeric as there wouldn't be
allowed automatically.

IF on the other hand you are asking how do I detect if a value was
passed by GET or POST, that's an entirely different thing.

POST data is passed in $this-data, GET data is passed in $this-
passedArgs or $this-params['url'].

See http://book.cakephp.org/view/55/The-Parameters-Attribute-params


On Jan 18, 11:43 am, Delirium tremens pedbe...@gmail.com wrote:
 Are you still not understanding the question?

 On 18 jan, 15:38, Delirium tremens pedbe...@gmail.com wrote:

  How come nobody knows???

  On 18 jan, 13:30, Delirium tremens pedbe...@gmail.com wrote:

   How to validate an id passed not by post, but by get? I do not have to
   output an error message to hackers and crackers, do I? I tested using /
   ^[0-9]{1,10}$/ as rule, nothing as message and passing an a, but it
   did not output an error message.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Writing to a database from a view

2009-01-14 Thread Webweave

I would suggest you run through baking a small app to see how the MVC
bits fit together (http://book.cakephp.org/view/113/Code-Generation-
with-Bake)

The Model is where your data and business logic goes. The Controller
handles getting the data from the Model and preparing it for the View.
The View handles displaying the data, and interacting with the user.

Your process_members.ctp (View) would have a form on it that would
submit to the Controller, which would then deal with updating the
Model.

On Jan 14, 12:40 pm, xybersoftw...@gmail.com
xybersoftw...@gmail.com wrote:
 Do it in the controller? I guess that is where I am not
 understanding...
 How do I get my data from the php code in the thtml file into the
 controller? An array_push?
 Do I use the save or savefields? Do I need to pass the record id or
 index to the controller?
 Does my thtml view php interate through the database building up data
 for the fields I want changed and then I process the build up in the
 the controller save?
 I am reading the cake php manual 
 athttp://book.cakephp.org/view/75/Saving-Your-Data
 but still don't quite understand...
 Thx for your help

 On Jan 14, 11:04 am, Miles J mileswjohn...@gmail.com wrote:

  Do it in the controller.

  On Jan 14, 10:39 am, xybersoftw...@gmail.com

  xybersoftw...@gmail.com wrote:
   I have a cake view called process_members.thtml.
   In the view I have setup some filtering and check boxes. If one of the
   check boxes is marked I want to write the current date to a field in
   the database.

   So I start Iterating through the database looking at records and so I
   may be writing to more than one record during this process...

   for ()
   {
      if ($chkMark=='1')
      {
         // Mark selected months
         if($chkMonth1=='on')
            $subscription['Subscription']['month1_mailinginfo_sent']=date
   ('Y-m-d');
      }

      //Then the field is displayed:
      td? echo $subscription['Subscription']
   ['month1_mailinginfo_sent']; ?/td
      //The date shows up here but when I go look at the database it has
   not been written to...

   //end for

   }

   How can I get this date written to the database?- Hide quoted text -

  - Show quoted text -


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



Re: Bake scripts without shell access

2009-01-14 Thread Webweave

What I do is to do the bake locally (on my Mac or PC) and then upload
it to the server.

Normally then all you need to do is modify your config files
and .htaccess to be correct for the server you are hosting on.

On Jan 14, 11:06 am, Bob Albert b...@superstan.com wrote:
 I'm new to this group and CakePHP so please excuse these questions if  
 they've been covered on the list. I have been working through David  
 Golding's Beginning CakePHP book from Apress. I just got through the  
 chapter were he describes the Bake scripts.

 My question is how others use this in the real world given that most  
 hosting companies don't allow shell access. Do most use these scripts  
 in a dev environment such as a local box to build out the application  
 and then just move the files to the prod environment when done, thus  
 shell is not needed cuz all the bake scripts are done in Dev?

 Also it looks like there might be some tools for Bake that one can  
 install on these hosting companies that allow you to use Bake scripts  
 via the browser like webbaker?

 Thanks,
 Bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 load HABTM Joining model in a plugin?

2009-01-14 Thread Webweave

Can you post your HABTM from your models ?

It looks like you have the model file in the right place, so my guess
is that the problem is in there.

On Jan 14, 4:59 am, Martin Westin martin.westin...@gmail.com wrote:
 Hi everyone,

 This is the first time I have tried to make a real model for a joining
 table and I got really stuck on this seemingly simple thing. I just
 cant get it to work. Does anyone know how this file should be named?

 I have a HABTM association between two models in a plugin. I have now
 created a joining model to be able to capture some callbacks and write
 custom behaviours. Problem is Cake does not load the model but
 resorts to creating its magic empty model based on AppModel. It does
 not even seem to find the model's file.

 The facts:

 News.NewsMessage habtm News.NewsSubscriber

 --- among other things in NewsMessage
 'with' = 'News.NewsMessagesNewsSubscriber',
 ---

 --- NewsMessagesNewsSubscriber
 debug('NewsMessagesNewsSubscriber file was loaded');
 class NewsMessagesNewsSubscriber extends NewsAppModel {
     var $name = 'NewsMessagesNewsSubscriber';
     function afterFind() {
         debug('NewsMessagesNewsSubscriber class was used in a find');
     }}

 ---

 I have but debug lines straight into the model file to see if it loads
 at all and nothing. So I guess I have to name it something special I
 can't figure out.

 I have tried the following files placed in app/plugins/news/models/
 news_messages_news_subscriber.php -- should be this one, right?
 news_message_news_subscriber.php
 news_messages_news_subscribers.php

 If you know what I should call this file, please reply while I have a
 few hairs left on my head ;)
 thanks

 Martin Westin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Writing to a database from a view

2009-01-14 Thread Webweave

You will find the data you need in $this-data after the form has
submitted (assuming your form is built correctly and posting to the
right action).

On Jan 14, 1:39 pm, xybersoftw...@gmail.com
xybersoftw...@gmail.com wrote:
 Ok got it to write to the database from the controller by hard coding:
 $this-Subscription-saveField('month1_mailinginfo_sent', date('Y-m-
 d'));
 But it added a new blank record with the month filled in...not really
 what I wanted but a baby step forward...
 How do I post from the php code of the view?  Also I will probably
 need to POST the id of the record I need to update so when I loop
 through in the controller I know what records to update.  I have the
 record id handy in the code so how to post is what I am not
 understanding...

 view/process_member.thtml
 for ()
 {
    if ($chkMark=='1')
    {
       // Mark selected months
       if($chkMonth1=='on')
          $subscription['Subscription']['month1_mailinginfo_sent']=date
 ('Y-m-d');
          THIS IS WHERE I NEED TO POST BUT NOT SURE HOW TO DO THAT??
 ***
    }

 On Jan 14, 12:49 pm, Miles J mileswjohn...@gmail.com wrote:

  Are you POSTing the data (checked checkboxes) to anywhere? If so loop
  the $this-data array in the controller.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: multiple httpd.conf files

2009-01-14 Thread Webweave

Looks like you are running on Mac.

If you're using the built in web server, then it is located at /
private/etc/apache2/httpd.conf

The 'which' command doesn't find files, it just tells you where the
executable is in your path.



On Jan 13, 3:54 pm, neridaj neri...@gmail.com wrote:
 Hello,

 I just installed cake version 1.2.0.7962 and was going through the
 blog tutorial when I got the generic index page because there is a
 problem with my httpd.conf. I ran locate and found quite a few
 different httpd.conf files:

 $ locate httpd.conf
 /Applications/TextMate.app/Contents/SharedSupport/Bundles/
 Apache.tmbundle/Commands/Open httpd.conf.plist
 /opt/local/apache2/conf/httpd.conf
 /opt/local/apache2/conf/original/httpd.conf
 /opt/local/var/macports/software/apache2/2.2.11_0/opt/local/apache2/
 conf/original/httpd.conf
 /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
 apache2/files/patch-httpd.conf.in-sensitive-files.diff
 /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
 htdig/files/httpd.conf
 /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
 lighttpd/files/patch-doc-lighttpd.conf
 /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
 lighttpd-devel/files/patch-doc-lighttpd.conf
 /private/etc/httpd/httpd.conf
 /private/etc/httpd/httpd.conf.bak
 /private/etc/httpd/httpd.conf.default
 /private/etc/httpd/httpd.conf.entropy.backup
 /usr/local/apache2/conf/httpd.conf
 /usr/local/apache2/conf/original/httpd.conf

 I'm assuming I need to edit the /opt/local/apache2/conf/httpd.conf
 file as instructed underhttp://book.cakephp.org/view/333/A-Note-on-mod_rewrite
 but it doesn't fix the problem. Here is what I have in the
 aforementioned httpd.conf file:

 DocumentRoot /opt/local/apache2/htdocs

 Directory /opt/local/apache2/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

 I thought maybe I needed to add this httpd.conf to my .bash_profile
 which I did with:

 PATH=/opt/local/bin:/opt/local/sbin:$PATH
 export DISPLAY=:0.0

 export PATH=${PATH}:/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/

 export EDITOR='mate -w'

 # Setting PATH for MacPython 2.5
 # The orginal version is saved in .bash_profile.pysave
 PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$
 {PATH}
 export PATH

 #export PATH=${PATH}:/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/
 PATH=/opt/local/apache2/conf:${PATH}
 export PATH

 ...but when I run which httpd.conf I get this:

 $ which httpd.conf
 no httpd.conf in /opt/local/apache2/conf /Library/Frameworks/
 Python.framework/Versions/Current/bin /opt/local/bin /opt/local/sbin /
 opt/local/apache2/conf /Library/Frameworks/Python.framework/Versions/
 Current/bin /opt/local/bin /opt/local/sbin /bin /sbin /usr/bin /usr/
 sbin /usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/ /usr/local/
 mysql-5.0.51a-osx10.4-powerpc/bin/
 $

 If anyone can help me out I would appreciate it,

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



Re: validation message are not coming

2009-01-13 Thread Webweave

Like grigri says, read the manual and use Cake functionality.

Below is your add function rewritten (completely untested of course)
to use Cake conventions:

function add(){
$this-set('sections', $this-Entry-Section-find('list',array
 
('fields'='Section.section','Section.id')));
if (!empty($this-data)){
 $this-Entry-create();
 if ($this-Entry-save($this-data)) {
 $this-Entry-id = $this-Entry-getLastInsertId();
 $max_counter = $this-Entry-find('list',
array('fields' = array(
 
'(max(Entries.counter)) as max_counter')'
   )
 )

  );
$this-Entry-counter = $max_counter['Entry'][0]
['max_counter'];

if(is_uploaded_file($this-data['Entry']['File']
['tmp_name'])){
   $fileData = fread(fopen($this-data['Entry']['File']
['tmp_name'],r),$this-data['Entry']['File']['size']);
   $this-Entry-name = $this-data['Entry']['File']
['name'];
   $this-Entry-size = $this-data['Entry']['File']
['type'];
   $fsize = $this-data['Entry']['File']['size'];
   $this-Entry-data = addslashes($fileData);

}
if ($this-Entry-save($this-data)){
$this-Session-setFlash(__('The Entry '.$this-Entry-
id.' was added and updated', true));
$this-redirect(array('action' = 'index'));

}  else {
$this-Session-setFlash(__('The Entry could not be
updated. Please, try again.', true));
}
} else {
$this-Session-setFlash(__('The Entry could not be
saved. Please, try again.', true));
}
}

}

On Jan 13, 5:37 am, mona poojapinj...@gmail.com wrote:
 In my add view when i kept all the fields blank and click on submit
 button it will display a message record added successfully instead of
 that i wan't to display my validation message and page should not be
 redirect to other page
 how to do this here is my add function code
 add function in
 controller---
 function add(){
 $this-set('sections', $this-Entry-Section-find('list',array
 ('fields'='Section.section','Section.id')));
 if (!empty($this-data)){
 $this-Entry-save($this-data);
 $id=mysql_insert_id();
 if($id){
 $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(is_uploaded_file($this-data['Entry']['File']['tmp_name'])){
 $fileData = fread(fopen($this-data['Entry']['File']['tmp_name'],
 r),
 $this-data['Entry']['File']['size']);
 $fname = $this-data['Entry']['File']['name'];
 $ftype = $this-data['Entry']['File']['type'];
 $fsize = $this-data['Entry']['File']['size'];
 $fdata = addslashes($fileData);
 $q1=mysql_query(update entries set name='$fname',size=
 $fsize,type='$ftype',data='$fdata' where id=$id);}
 }

 $this-Session-setFlash('The Entry has been saved');
 $this-redirect('/entries/index');}
 }

 -my model code is
 -
 ?php
 class Entry extends AppModel{
         var $name = 'Entry';
         var $belongsTo=array('Section'=array(
         'className'='Section'
         ),
         'Submenu'=array('className'='Submenu')
         );
         var $validate = array(
         'username' = array('/^[a-zA-Z._0-9]+$/'),
                 'Please enter username' = array('rule'='notEmpty'),
                 'Listitem'=array(
                   'Please enter listitem' = array
 ('rule'='notEmpty')),
                  'section_id'=array(
                   'Please select listitem' = array
 ('rule'='notEmpty')),
                 'Telephone'=array(
                   'Please enter phone number' = array
 ('rule'='notEmpty'),
                   'Must be at least 10 chars' = array('rule'=array
 ('minLength', 10))),

       );}

 ?

 please tell me the answer it is very urgent
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: ie7 urls messed up - http:///appname/ rather than http://localhost/appname/

2009-01-13 Thread Webweave

Sounds like you are not getting a reverse DNS for localhost. Try using
127.0.0.1 as your host name and see if IE7 works with that (or do a
nslookup on localhost).

On Jan 13, 1:34 am, will will.ev...@the-omni-group.net wrote:
 Hi there,

 My CakePHP app is working fine in firefox.  In ie7, though, no css or
 pictures display, suggesting that Cake is looking in the wrong place
 for these files, and links appear without localhost -
 http:///appname/controller/action rather 
 thanhttp://localhost/appname/controller/action.

 Anyone know what the problem is?

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



Re: Fighting cakephp : can't add user count to group index

2009-01-13 Thread Webweave

Just add the field and groupings to the find (http://book.cakephp.org/
view/73/Retrieving-Your-Data)

find('all', array('fields' = array('Group.*', '(COUNT(*)) as
group_count', 'User.username')
  'group' = array('Group.id', 'Group.name',
'Group.created', 'Group.modified', 'User.username')

Or even easier (although less cake-like, probably more efficient at
the DB level):

'fields' = array('Group.*', '(select count(1) from users User where
User.group_id = Group.id) as users_count')

On Jan 12, 11:01 pm, Arthur Pemberton pem...@gmail.com wrote:
 I was trying to do what would be a fairly simple thing in plain SQL.
 The bake script generated a nice groups_controller for me which
 paginated the groups listing. Fairly simple.

 All I wanted to do was add a user count to the index. The required SQL would 
 be:

  SELECT `Group`.`id` , `Group`.`name` , `Group`.`created` ,
 `Group`.`modified` , `User`.`username` , COUNT( * )
 FROM `groups` AS `Group`
 INNER JOIN `users` AS `User` ON `User`.`group_id` = `Group`.`id`
 GROUP BY `Group`.`id` , `Group`.`name` , `Group`.`created` ,
 `Group`.`modified` , `User`.`username`
 LIMIT 0 , 30

 this compared to the original SQL before i touched the index action
 generated by bake:
 SELECT `Group`.`id`, `Group`.`name`, `Group`.`created`,
 `Group`.`modified` FROM `groups` AS `Group` WHERE 1 = 1 LIMIT 20

 While there is a lot more SQL, the result set is equivalent, and can
 be ordered and limited just as before.

 And hour later, I have not found a good way to get the user count.,
 short of doing the paginate, and then manually inserting the user
 counts after.

 Is there any way to just force my own SQL into paginate?

 I sawhttp://book.cakephp.org/view/249/Custom-Query-Paginationbut it
 doesn't what to override and where.

 Is there a way i can have cake use an SQL view i make just for this query?

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



Re: counterCache is not working in 1.2

2009-01-13 Thread Webweave

Looks to me like your relationships may not be correct.

Can you post your hasMany/hasOne and belongsTo for each of the models
(User/Project/Topic) ?

On Jan 12, 9:45 pm, Sergei yatse...@gmail.com wrote:
 I think I found a bug in generated countercache query:

 UPDATE `projects` AS `Project` LEFT JOIN `users` AS `User` ON
 (`Project`.`project_id` = `User`.`id`) SET `Project`.`topic_count` = 4
 WHERE `Project`.`id` = 1

 You see, it makes useless and WRONG JOIN-condition with
 `Project`.`project_id`: such column doesn't exist!
 1) wrong join - it doesn't have to be here
 2) wrong join condition

 On Jan 12, 2:06 pm, Sergei yatse...@gmail.com wrote:

  Hello,

  using Cake 1.2 release,counterCachevariable seems to not working.
  Counter field just is not updating.

  I have model Topic:

  var $belongsTo = array(
  'Project' = array('className' = 'Project',
          'foreignKey' = 'project_id',
          'conditions' = '',
          'fields' = '',
          'order' = '',
          'counterCache' = 'topic_count',
                  // OR 'counterCache' = true,
  ),

  And I have a field in Project model called topic_count. Everything
  looks okay but doesn't work.

  Any ideas?

  S.


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



Re: ACL's permission problem

2009-01-12 Thread Webweave

From my experience with this, the user gets redirected back to the
page that they came from.

If you go to http://volunteercake.sf.net and login as jdoe/jdoe, then
try to go to http://volunteercake.sf.net/slots, you'll get the You
are not authorized to access that location. error and be redirected
back to the prior page.

On Jan 9, 7:30 am, vikas vikas...@gmail.com wrote:
 hey all..

 now my aro, aco, aro_aco entry is perfect.

 but now one new problem arise.. I checked permission for the current
 logged in user using yout check()-given above.
 If logged in user has no permission it shows me the message
 “permission denied”…

 But still It allows that logged in user to access that page for which
 he doesn’t have permission…

 So what I ll do Cant get whats the problem..

 Help me If u understand my problem

 And also
 Hey tell me one thing.. after checking permission if user is not
 allowed then what to do with that user is our decision or this is done
 by cakephp automatically???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: hasMany + belongsTo relationship problem

2009-01-12 Thread Webweave

You just need to set the recursive level to fetch the data that is not
directly related. See: http://book.cakephp.org/view/439/recursive

Set it before you do your find, or in the individual action.

On Jan 8, 11:20 pm, Ernesto e.fanz...@gmail.com wrote:
 Hello and thx for the fast response.

 i forgot to paste the var $primaryKey in my model's code. sorry.

 everything is working fine in my app. i just can't fetch Location
 Types starting from persons. i'll take a look @ containable behaviour.

 thx again

 On 8 Gen, 21:43, Webweave webwe...@gmail.com wrote:

  Since you are using non-standard names for your ID columns, you need
  to specify $primaryKey in your models, so your Person model, you would
  need:

  $primaryKey = 'location_id';

  If you set debug to 2 or 3, you'll see the queries being executed. You
  may need to set recursive to get the non-related data too, see:

  On Jan 8, 8:09 am, Ernesto e.fanz...@gmail.com wrote:

   Hello.

   i have 3 models
   - Person
   - Location
   - Location_Type

   pointing respectively @ 3 tables:

   Persons:
   person_id
   name
   surname

   Locations:
   location_id
   person_id
   location_type_id
   address
   country

   Location_Types:
   location_type_id
   description

   the 3 models are linked as follow:
   Person hasMany Location
   Location belongsTo Location_Type

   here's the models' code

   class person extends AppModel {
           var $hasMany = array(
                   Locations = array(
                           className = Location,
                           foreignKey = location_id,
                           dependent = true
                   )
           );

   }

   class location extends AppModel {
           var $belongsTo = array(
                   Location_Type = array(
                           className = LocationType,
                           foreignKey = location_type_id,
                           dependent = true
                   )
           );

   }

   I can't find out why the Location_Type's data is not showing when i
   load data from the Person model


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: belongsTo not working on a HABTM

2009-01-12 Thread Webweave

Why do you have the echo in test action of your controller ?

That's going to break things even if everything else was OK.

If you set debug to 2 or 3, you should get the SQL that was produced,
which will help diagnose your issue.

I don't think you should be calling the test method in the model, but
rather calling the find('all') for the model you need data from, so
for this scenario (assuming your relationships are correct), you'd
just do:

   function test() {
$this-Blog-recursive = 2;
}

And the data should be there for your test.ctp to display.

On Jan 9, 2:17 am, Miles J mileswjohn...@gmail.com wrote:
 This is still making no sense. Heres my controllers (hid $uses below)
 and models.

 ?php
 // controllers/blog_controller.php
 class BlogController extends AppController {
         function test() {
                 $this-EntriesTopic-test();
                 exit();
         }

 }

 // models/entries_topic.php
 class EntriesTopic extends AppModel {
         var $belongsTo = array('Topic', 'Entry');

         function test() {
                 echo 'test';
                 debug($this-find('all', array('recursive' = 2)));
         }

 } ?

 When I go to /blog/test/ I get the following errors. The damn model is
 not even being initialized, you can see it call AppModel instead of
 EntriesTopic, what am I missing here..

 Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
 check the manual that corresponds to your MySQL server version for the
 right syntax to use near 'test' at line 1 [CORE\cake\libs\model
 \datasources\dbo_source.php, line 514]

 DboSource::showQuery() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 514
 DboSource::execute() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 201
 DboSource::fetchAll() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 337
 DboSource::query() - CORE\cake\libs\model\datasources\dbo_source.php,
 line 298
 Model::call__() - CORE\cake\libs\model\model.php, line 436
 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 52
 AppModel::test() - [internal], line ??
 BlogController::test() - APP\controllers\blog_controller.php, line 52
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 245
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 211
 [main] - APP\webroot\index.php, line 88
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: belongsTo not working on a HABTM

2009-01-12 Thread Webweave

Sounds like there was something wrong with your model in that case.

Did you have your corresponding hasMany/hasOne in your Topic and Entry
models ?

What 'extra data' were you not getting that you expected ?

On Jan 12, 12:50 pm, Miles J mileswjohn...@gmail.com wrote:
 Ive tried many different things but simply, I needed to use this model
 to paginate with, not the other way around.

 I could never get the associations to work, so I had to make a fake
 model and do $useTable to the correct table and that worked.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Deployment Issues

2009-01-11 Thread Webweave

Sounds like you may have a problem with your .htaccess or routing.

Are you using the default .htaccess files ?

Is mod_rewrite enabled ?

On Jan 10, 5:35 pm, Chad Casselman ccassel...@gmail.com wrote:
 I have been developing my first cake app locally for the past few
 days.  I uploaded the files to my dedicated server as following:

 .htaccess
 index.php
 /app
 /cake
 /vendors

 When I hit the url I get users/login can't be found.  Yes, I am using
 basic Auth.  To me this means that it executed enough to do the
 redirect and then died.  Mod Rewrite is working, but I am getting some
 weird results.

 I get the correct login form if I go to /app/users/login but of course
 it posts to /users/login

 If I tell Auth to allow all, then everything works right like
 /customers etc. etc, EXCEPT /users/login url is still 404.  My login
 functions in users controller is empty using the automagic.

         function login() {
                 // No form processing needed, Auth does it automatically
                 $this-pageTitle = Please Login!;
         }

 To me this appears to be something wrong with Auth.  Can anyone help
 me get this working?  This is the 1.2 final release.

 Chad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Session trouble

2009-01-11 Thread Webweave

First, you really don't want to read the session from the view, it
should be done from the controller.

Second, the error you are getting sounds like the value wasn't set in
the session, so either you are referencing what you set incorrectly,
or you need to query for it.

The last inserted ID will only contain a value after you insert a
record, so if you hit the page without inserting, your session value
won't be populated (so you'd need to do a query to get it).

On Jan 11, 4:38 pm, Steppio stepisgr...@hotmail.com wrote:
 Thanks alot buddy, thats definatly tightened things up but im still
 getting the odd error. Might just be me. Thanks for your help matey!

 On Jan 8, 8:16 pm, Mark (Germany) dereurom...@googlemail.com
 wrote:

  always make sure that you check on or cast to whatever you need,
  especially reading from session!
  especially as type safety (as in java) is not one of PHP's strong
  points

  if it is an integer id you need to have, use (int) casting:
  $user_id = (int)$session-read('User.id')

  this way your input won't be filled with an array or something
  in this case, it will cast to a 0 (zero), if no valid entry was given
  the DB will prefer that one over just an empty string anyway for an
  INT field

  if it is a UUID, you could cast like this:
  $user_id = (string)$session-read('User.id')

  and if you want to populate a dropdown box (where you want to have an
  array), do this:
  $dropdownItems = (array)$session-read('User.roles')

  etc.

  On 8 Jan., 17:13, Steppio stepisgr...@hotmail.com wrote:

   Hi everybody. I've been getting gip from this cheeky little number for
   a while now, was just wondering if anybody has any insights into how i
   could solve this problem.
   The problem is that i'm passing the lastInsertId into the session and
   trying to pull it out in different views, and it works alot of the
   time, but sometimes it just has a tissy fit. I keep getting
   this error message when passing the ID across controller/views:

   SQL Error: 1366: Incorrect integer value: '' for column 'user_id' at
   row

   The site takes the users username and password, then goes onto a
   different set of controller/views for Details, then onto Duties, and
   finally Terms and Conditions. I find the problem happens most when i
   reload one of the pages, for instance when im adding Details and it
   times-out or i just reload the page. It's sometimes as if it's not
   writing correctly to the Session, but then again it works other times.

   Here's an example of how i read the session in a view:
           ?php $user_id = $session-read('User.id');?
           ?php        echo $form-input('user_id', array('type' =
   'hidden', 'value' = $user_id));?

   And in a controller:
           $this-Session-read('User.id')

   Any suggestions? Any help would be greatly appreciated!
   Thank you
   Steppio


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Deployment Issues

2009-01-11 Thread Webweave

Just a question: are you testing with IE7?

There have been a couple of posts recently where people were having
problems with IE7 and Auth (you can search the group and find the
posts).

My app_controller has the following setup in the beforeFilter:

/*
 *  Set up the Auth component so that we get redirected if we try to
 *  go to a page that isn't open.
 *
 */
function beforeFilter(){
//Configure AuthComponent
$this-Auth-authorize = 'actions';
$this-Auth-loginAction = array(
'admin' = false,
'prefix' = false,
'plugin' = null,
'controller' = 'users',
'action' = 'login'
);

$this-Auth-loginError = 'Invalid user name / password
combination';
$this-Auth-actionPath = 'controllers/';
$this-Auth-fields = array('username' = 'user_name',
'password' = 'user_password');
if ($this-Auth-user('user_name') == 'admin'){
$this-Auth-allowedActions = array('*');
} else{
$this-Auth-allowedActions = array('display');
}
if ($this-params['url']['ext'] == 'xml'){
// Set debug to 1 if it is greater so that
// we get an XML response ...
if (Configure::read()  1) {
Configure::write('debug',1);
}
}
}

Note that you have to have 'display' as an allowed action or you won't
get the login page.

On Jan 11, 5:16 pm, Chad Casselman ccassel...@gmail.com wrote:
 I am 99.9% sure that mod_rewrite is working.  I haven't ever had
 trouble with it before and would it work when allow all was on if
 htaccess wasn't working.  It is only the users/login that is not
 mapped or mapping correctly.

 Chad

 On Sun, Jan 11, 2009 at 3:19 PM, Webweave webwe...@gmail.com wrote:

  Sounds like you may have a problem with your .htaccess or routing.

  Are you using the default .htaccess files ?

  Is mod_rewrite enabled ?

  On Jan 10, 5:35 pm, Chad Casselman ccassel...@gmail.com wrote:
  I have been developing my first cake app locally for the past few
  days.  I uploaded the files to my dedicated server as following:

  .htaccess
  index.php
  /app
  /cake
  /vendors

  When I hit the url I get users/login can't be found.  Yes, I am using
  basic Auth.  To me this means that it executed enough to do the
  redirect and then died.  Mod Rewrite is working, but I am getting some
  weird results.

  I get the correct login form if I go to /app/users/login but of course
  it posts to /users/login

  If I tell Auth to allow all, then everything works right like
  /customers etc. etc, EXCEPT /users/login url is still 404.  My login
  functions in users controller is empty using the automagic.

          function login() {
                  // No form processing needed, Auth does it automatically
                  $this-pageTitle = Please Login!;
          }

  To me this appears to be something wrong with Auth.  Can anyone help
  me get this working?  This is the 1.2 final release.

  Chad


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Loading models within the controller action

2009-01-11 Thread Webweave

I'm confused by your question, why wouldn't you just add the model to
your $uses: http://book.cakephp.org/view/53/components-helpers-and-uses

That's the standard way of including a model in your controller.

On Jan 10, 10:56 pm, Miles J mileswjohn...@gmail.com wrote:
 Der... I could call $this-loadModel().
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Cake ACL check

2009-01-11 Thread Webweave

As long as everything is set up properly for your app, you can just cd
to the app directory and run the following from a command prompt:

cake schema run create DbAcl

If you don't have Cake in your path, you may need to change it to be
something like:

path_to_cake/console/cake schema run create DbAcl

I'm guessing your '-app' switch didn't work because you specified
www.helpwriteabook.co.uk instead of the actual path to where your app
lives.



On Jan 10, 9:48 am, Steppio stepisgr...@hotmail.com wrote:
 Hi there again everybody!

 Has anybody ever tried to use the command 'Cake schema run create
 DbAcl' on a web server? im having trouble locating the correct method
 for reseting / initializing ACL, i've tried 'cake schema run create
 DbAcl -appwww.helpwriteabook.co.uk//test//app//'but needless to say
 that did'nt work. Any ideas for contacting a server through the Cake
 Shell?

 Thanks for you time in advance!

 Steppio
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 $this-Auth-allow(array('display'));

2009-01-11 Thread Webweave

Try adding an isAuthorized method to your AppController:

/**
 * Function to return whether you are authorized or not.
 *
 * @return type
 */
function isAuthorized() {
return true;
}

On Jan 9, 7:31 am, volka volker.b...@googlemail.com wrote:
 Hi there,
 i have
 $this-Auth-allow(array('display'));
 in my beforeFilter() - method of my AppController, but it doesn't show
 the homepage, though.

 I'm using the latest release of 1.2
 ( I tried $this-Auth-allow('display'); to ensure it's not a problem
 with my update)

 I have no isAuthorized() method implemented, yet. Is that a problem?
 Can you help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to do this in cakephp

2009-01-08 Thread Webweave

I'm not sure I understand your question, but if you have a field you
want to save a counter in, you can do this in the model using
countCache: http://book.cakephp.org/view/445/cacheQueries

If on the other hand you need to find the count from some set of
values, you can simply use find('count'): 
http://book.cakephp.org/view/73/Retrieving-Your-Data

On Jan 8, 4:46 am, mona poojapinj...@gmail.com wrote:
 I have code of my controller in which i use normal php codes to fetch
 data from a database and update counter how to do this in cakephp

 ?php
 class EntriesController extends AppController
  {
         var $name = 'Entries';
     var $helpers = array('Html','Form','Javascript','Ajax');
     var $components = array('RequestHandler');
         //var $uses=array('Entry','User');
         function index(){

 -please consider it
 -
     $query=mysql_query(select max(counter) from entries);
     $row=mysql_fetch_array($query);
         $co=$row[0];
         $this-set('co',$co);
         $name=$this-Session-read('User');
         $query1=mysql_query(select id from users where username='$name');
     $row1=mysql_fetch_array($query1);
         $user_id=$row1[0];
         $this-set('user_id',$user_id);
 

         $this-Entry-recursive = 1;
         $this-set('entries', $this-Entry-findAll(null, null, array
 ('Section.id' = 'ASC','Submenu.submenu' = 'ASC')));
     }

          function view($id = null){
          if (!$id){
          $this-Session-setFlash('Invalid id for Entry.');
          $this-redirect('/entries/index');
          }
          $this-set('entry', $this-Entry-read(null, $id));
          }

     function add(){
     $this-set('sections', $this-Entry-Section-find('list',array
 ('fields'='Section.section','Section.id')));
         if (empty($this-data)){
         $this-render();
         }
     else{
         $this-data['Entry']['name'] = $this-data['Entry']['File']['name'];
     $this-data['Entry']['type'] = $this-data['Entry']['File']
 ['type'];
     $this-data['Entry']['size'] = $this-data['Entry']['File']
 ['size'];
         if ($this-Entry-save($this-data)){
 -please check it from
 here---
         $id=mysql_insert_id();
         $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);
 --
         $this-Session-setFlash('The Entry has been saved');
         }
     else{
         $this-Session-setFlash('Please correct errors below.');
         $this-redirect('/entries/add');
         }
     if (move_uploaded_file($this-data['Entry']['File']['tmp_name'],
 WWW_ROOT.'/files/' .$this-data['Entry']['File']['name']))
     {
         echo File uploaded successfully;
     }
     else{
     echo There was an error uploading the file, please try again!;
         }
     $this-redirect('/entries/index');
     }
     }

         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{
 ---please
 check--
     $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.');
         }
         }
         }

     function delete($id = null){
         if (!$id){
         $this-Session-setFlash('Invalid id for Entry');
         $this-redirect('/entries/index');
         }
         if ($this-Entry-del($id)){
         $this-Session-setFlash('Record deleted successfully');
         $this-redirect('/entries/index');
         }
         }

     function update_select(){
     if(!empty($this-data['Entry']['section_id'])){
     $section_id = (int)$this-data['Entry']['section_id'];
     $options = $this-Entry-Submenu-find('list',array('section_id'=
 $section_id,'recursive' = 

Re: ModelBaker ... umm... yummy

2009-01-06 Thread Webweave

It's on their web site now: 399 for an individual license.

Hope they at least donated to CakePHP 

On Jan 4, 6:03 pm, Webweave webwe...@gmail.com wrote:
 Yeah, CakeApp, that was it (although webbaker looks interesting too).

 Anybody have an idea whether ModelBaker is going cost anything?

 On Jan 4, 7:35 am, Bernardo Vieira bvieira.li...@gmail.com wrote:

  Maybe cakeapp?http://cakeapp.com

  Drinkspiller wrote:
   There was a web based thing floating around I saw posted on this group

   WebBaker?
  http://nio.infor96.com/webbaker/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 after uploading to host - mod_rewrite is enabled apparently

2009-01-05 Thread Webweave

You have to look in the httpd.conf file to see if it is allowed or
not. You should see something like LoadModule rewrite_module libexec/
httpd/mod_rewrite.so or (for Apache 1.3) AddModule mod_rewrite.c in
your httpd.conf.

See: http://book.cakephp.org/view/333/A-Note-on-mod_rewrite


On Jan 5, 7:32 am, will will.ev...@the-omni-group.net wrote:
 Sorry - the .htaccess file in the /app/webroot folder has the
 following lines in it:

 IfModule mod_rewrite.c
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
 /IfModule

 Is this the file in question?

 Thanks very much

 On Jan 5, 12:15 pm, netik...@gmail.com netik...@gmail.com wrote:

  be sure to check if mod_rewrite is allowed from .htaccess

  On Jan 5, 12:01 pm, will will.ev...@the-omni-group.net wrote:

   Hi there,

   Thought I'd already posted this, but it didn't seem to be listed.
   Apologies if this appears twice, then.

   I've been playing with cake on my local machine and decided to upload
   it to my host's server to check that it works there.  The page that
   should be the Cake homepage appears as an Apache index page - a list
   of the directories (app/ and cake/).  Trying to access any controller
   functions results in a 404 not found error.

   My hosts (UK2, if anyone has had experience with them) tell me than
   mod_rewrite is enabled on my (shared) server.

   Would greatly appreciate any help on this matter.

   Thanks a lot


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



Re: custom SQL query - all values IN() bust be AND

2009-01-05 Thread Webweave

I'm not really clear on what it is you are trying to fetch. Are you
trying to restrict your results by the associated values?

The results you show can be fetched using a normal find('all')
assuming your models are correct. Just add another select count to the
conditions like:

$this-Advert-find('all', array('conditions' = array(
'AND' = array(
'(select count(1) FROM images WHERE
adverts.id = images.advert_id)  0
'(select count(1) FROM options where
adverts.id = options.advert_id AND options.option IN (3, 4)) = 2'
)));

Or better, do a find('count') for the related data to find out if you
have the right count before you even do the fetch for the Advert:

$this-Advert-find('count', array('conditions' = array
('Options.advert_id' = $advert.id,
 
'Options.option' = array(3,4;

Would give you a count of 2 if there are two matches.

On Jan 5, 7:08 am, dev minde...@gmail.com wrote:
 You wrote good solution, but if I need more than one model (HABTM)
 where i can search for results, like:

 Advert HABTM Option
 Advert HABTM Exta

 example:
 [0] = Array
         (
             [Advert] = Array
                 (
                     [id] = 2
                     [code] = 54
                     [created] = 2008-12-19 11:17:30
                 )

             [Option] = Array
                 (
                     [0] = Array
                         (
                             [id] = 1
                             [advert_id] = 2
                             [option] = 3
                         )
                     [1] = Array
                         (
                             [id] = 2
                             [advert_id] = 2
                             [option] = 4
                         )

                 )

             [Extra] = Array
                 (
                     [0] = Array
                         (
                             [id] = 5
                             [advert_id] = 2
                             [option] = 8
                         )

                     [1] = Array
                         (
                             [id] = 7
                             [advert_id] = 2
                             [option] = 4
                         )

                 )

         )

 How about that?

 On Dec 24 2008, 2:04 pm, Smelly_Eddie ollit...@gmail.com wrote:

  dev if thats the case than my last post should asswer your questions.

  On Dec 24, 3:35 am, dev minde...@gmail.com wrote:

   I will give an example:

   Advert hasMany Option
   I need to find Adverts, where its Options are 3 and 4 values. When
   using IN, it will return results with 3, or, 4, or both 3 and 4. But i
   want only with both values.

   Like:
   [0] = Array
           (
               [Advert] = Array
                   (
                       [id] = 2
                       [code] = 54
                       [created] = 2008-12-19 11:17:30
                   )

               [Option] = Array
                   (
                       [0] = Array
                           (
                               [id] = 1
                               [advert_id] = 2
                               [option] = 3
                           )
                       [1] = Array
                           (
                               [id] = 2
                               [advert_id] = 2
                               [option] = 4
                           )

                   )

           )

   On Dec 24, 12:35 am, Smelly_Eddie ollit...@gmail.com wrote:

How can the same field have multiple values?
-it can be = '3'
-it can be= '4''

Otherwise maybe your are just concatenating multiple variables into
one, e.g.;
-it can be='3,4'
which probably should be evaluated for best practices..

You would not use IN in such a case.

If the are always ordered numerically you might use;
AND options.option like '%3,4%'
(assuming there are higher or lower values (2,..,5))

If they are not always order and could be 4,3 or 4,5,3 then you might
try;
AND options.option like '%3%' AND options.option like '%4%

On Dec 22, 11:21 am, dev minde...@gmail.com wrote:

 i'm building custom SQl query and need a little help.

 query:
 select distinct adverts.id, adverts.code from adverts left join images
 on (images.advert_id = adverts.id) left join options on
 (options.advert_id = adverts.id) where (SELECT count(1) FROM images
 WHERE adverts.id = images.advert_id)  0 AND options.option IN (3, 4);

 but i want to get all Advert records, where options.option has all
 these values (3,4). When i'm using IN(), these values are with OR
 operator, how to set AND?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To 

Re: Auth Redirect And Routes

2009-01-05 Thread Webweave

Don't set the loginRedirect in your beforeFilter, and then just use
$this-Auth-redirect() in your login function as follows:


/**
 * Login function - this is where we do the login ...
 */
function login() {
if ($this-Auth-user())
{
$this-Session-SetFlash(__('Successfully logged in as '.
$auth_user['User']['full_name'],true));
$this-redirect($this-Auth-redirect());
}
}

On Jan 5, 3:22 am, Novice Programmer novice.prog...@gmail.com
wrote:
 Hello All,

 I am trying to set up auth redirect. i.e the user will be redirected to
 login screen if he accesses a page which can't be accessed without the
 username/password. After the user authenticates, I try to redirect the user
 back to the page which he was accessing using
 $this-redirect($this-Auth-referer());

 Though the user is redirected to the proper page but my custom Routes break
 when such a redirection happens. Here is my auth setup.

            $this-Auth-actionPath = null;
            $this-Auth-loginAction = array('controller' = 'invites',
 'action' = 'index');
            $this-Auth-loginRedirect = array('controller' = 'entities',
 'action' = 'index');
            $this-Auth-logoutRedirect = null;

 Please help on how to go about fixing this.
 --
 Thanks  Regards,
 Novice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: debug a failed save()

2009-01-05 Thread Webweave

Did you try setting debug=2 or 3 so you can see the queries that were
executed, and the data ?

The code you posted doesn't show you disabling validation, Cake does
the validation unless you a) remove any validation from the model or
b) you explicitly turn off validation in your save call.

Without seeing the actual Cake debug, it's hard for anybody to tell
you what went wrong.

Also make sure you have something like the following in your
default.ctp:

?php
// Display flash messages ...
if ($session-check('Message.flash')) {
$session-flash();
}

// Display Auth messages ...
if ($session-check('Message.auth')) {
$session-flash('auth');
}
?


On Jan 5, 11:13 am, brian bally.z...@gmail.com wrote:
 I've gone as far as I can in debugging why a save() is failing. I'd
 appreciate any tips.

 The situation:

 I have a form on a user's profile page for uploading a headshot image.
 The image is being saved ok. The part that's failing is updating the
 user's record in the DB.

 The code:
 $this-Member-recursive = -1;
 $this-data = $this-Member-read(null, $id);

 ...  // upload and add headhsot info to $this-data['Member']

 $this-Member-validate = array();

 if ($this-Member-save($this-data))
 {
         $this-flash('image uploaded', $referer);}

 else
 {
         //debug($this-data);exit;
         //debug($this-Member-validationErrors);exit;
         $this-flash('DB info not saved', $referer);

 }

 As you can see, I've disabled validation in an attempt to get this to
 work. And I've also tried dumping both $this-data and
 $validationErrors. The latter, as expected, is empty. The former
 appears perfectly fine. An example:

 Array
 (
     [Member] = Array
         (
             [id] = 1596
             [created] = 2009-01-05 03:32:31
             [modified] = 2009-01-05 13:26:03
             [last_login] = 2009-01-05 13:26:03
             ...
             [headshot] = test1_test1.png
             [headshot_width] = 225
             [headshot_height] = 228
             [headshot_mimetype] = image/png
         )
 )

 I've enabled query logging for the DB and dropped this in just before
 the attempt to save:

 $this-Member-query(SELECT('SAVING ...'));

 This is the result:

 5 Query       SELECT('SAVING ...')
 5 Query       SELECT COUNT(*) AS `count` FROM `users` AS `Member`
 WHERE `Member`.`id` = 1596
 5 Quit

 That query, used in a terminal, returns 1, as expected.

 So, can anyone suggest some other way to debug this failed save? I
 need to figure out why Cake packed it in after that count() query. The
 Model class doesn't seem to have anything else available beside
 $validationErrors. I hunted around a little in DataSource and DboMysql
 but it doesn't appear to be an SQL issue.

 In a nutshell, where does one look to learn the reason for a failed
 save? And, as the save method is in the model, why doesn't the model
 expose failed saves?

 A note about the users/Member thing: I'm using inheritance here but I
 can confirm that saves do work fine. It's just this one action that's
 giving me trouble. In any case, the point of this is that I don't know
 where to look to find out for sure.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: List users who are logged in

2009-01-05 Thread Webweave

You can get some of this if you set up your app to use the database to
store sessions. Look at config/core.php where it talks about setting
Session.save to 'database'

On Jan 5, 10:50 am, Bernardo Vieira bvieira.li...@gmail.com wrote:
 AFAIK you'd need to create custom login and logout actions in your users
 controller to keep a list of logged in users.

 jmmg77 wrote:
  Hi,

  I'm using Cake 1.2 RC3 and the Auth component.

  Is there a way to simply list the user accounts that are logged in.
  Or, is there a way to check if a particular userid is logged in?

  I know I can use $session-check('Auth.User.id') or $this-Auth-User
  ('id') to check if the current user is logged in, but this is not what
  I need here.

  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: New Install Does Not Show Graphics

2009-01-05 Thread Webweave

It should be compiled into Apache so you shouldn't have to download it
separately. What platform are you on?

On Jan 5, 1:31 pm, reidster reidmckin...@gmail.com wrote:
 This is all I see in modules.  I know this isn't an apache group.
 But, do you know if apache requires any special configure options for
 mod_rewrite?

 [r...@localhost modules]# pwd
 /usr/local/apache2/modules
 [r...@localhost modules]# ls
 httpd.exp  libphp5.so

 On Jan 5, 4:20 pm, Bernardo Vieira bvieira.li...@gmail.com wrote:

  The actual path to .so files varies in the various linux distros. Scan
  through your httpd.conf and look for the extensions/modules path and see
  if mod_rewrite.so exists in that path (from the directory listing you
  provided I'm guessing /usr/local/apache2/modules).

  reidster wrote:
   Thanks for the reply.
   My httpd.conf does not have mod_rewrite enabled.  I checked the doc in
   the aforementioned url, but could not locate the .so file.  This does
   not exist in my apache install.  Do I need to re-configure apache?

   libexec/httpd/mod_rewrite.so

   [r...@localhost apache2]# ls
   bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs
   man  manual  modules
   [r...@localhost apache2]# pwd
   /usr/local/apache2

   On Jan 4, 5:29 pm, Steven Wright rhythmicde...@gmail.com wrote:

   Do you have mod_rewrite enabled on your apache server?

  http://book.cakephp.org/view/333/A-Note-on-mod_rewrite

   -Original Message-
   From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
   Behalf

   Of reidster
   Sent: Sunday, January 04, 2009 4:24 PM
   To: CakePHP
   Subject: New Install Does Not Show Graphics

   I am new to CakePHP.

   I have downloaded version 1.2.0.7962, renamed the cake directory and 
   moved
   it to the root of the apache directory (htdocs).

   When I navigate to the cake php website for this directory. I receive a
   listing of all the files in this directory.  I do not see the expected 
   cake
   graphics.

   Any ideas as to what is wrong?

   Configuration:
   PHP Version 5.2.8
   Apache/2.2.11
   Linux 2.6.18-92.1.22.el5 #1 (CentOS 5.2)

   Apache and PHP are working.  I can get to webpages on this host.

   Thanks for your input.
   -Reid


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: setting up cake bake console

2009-01-05 Thread Webweave

Step 1: change directory to where your app lives (in your example
above /Users/myusername/myappname)
Step 2: from a console, type cake bake
Step 3: follow the prompts ...

On Jan 5, 1:15 pm, gemmes variouspix...@googlemail.com wrote:
 Hi,

 I ran:

 cake bake

 I entered my path to appname and proceeded along with no problems
 until I tried to do:

 cake bake model

 this caused the following error:

 Error: Model directory could not be found.
 Be sure you have created /Users/myusername/models/
 myusername:~ myusername$

 When i try cake bake model again console creates a new app called
 model, not what i want.

 I believe my errors are stemming from my paths being incorrect in
 someway and im certain that my app and path should not be my Mac OS X
 username, they should be the name of my app.
 So I can then run multiple apps.

 Everytime Im asked to compare paths I see this:
 Skel Directory: /Users/myusername/Sites/_cake/cake/console/libs/
 templates/skel
 Will be copied to: /Users/myusername/myappname

 The will be copied to line is always wrong and when i tried cake bake
 model the line was wrong too. my Sites directory is always missing
 from my path and I dunno why.

 Pls help.

 gemmes
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 404 error

2009-01-05 Thread Webweave

Your app is in a sub-directory, if you want it to be in the root, you
need to change your configuration or move the app up a directory.

Apparently you have the app for posts in the root for that web server,
which is why it works with /posts/edit

On Jan 5, 12:43 pm, sarahlou sarah_hi...@btopenworld.com wrote:
 I'm a newbie to Cake, so bear with me

 I've managed to complete the blog tutorial, and now trying the IBM
 'Cook up Websites fast' tutorial.  However, I get a 404 URL not found
 error when trying to viewhttp://[domain]/users/register.  I can see
 the register view as expected when I usehttp://[domain]/app/users/register.

 What puzzles me is that I could ( still can) see the equivalent from
 the blog tutorial (e.g.http://[domain]/posts/edit) with no problem,
 and without adding the 'app' bit.

 Sorry if this is a daft question, but have been puzzling for ages over
 it!  Thanks in advance for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New Install Does Not Show Graphics

2009-01-05 Thread Webweave

First look in /usr/local/apache2/conf/httpd.conf and see if rewrite is
enabled.

Then if that bit is correct, run the following command:

apachectl -t -D DUMP_MODULES

You should see something like rewrite_module (shared) if it is
loaded.

On Jan 5, 5:30 pm, reidster reidmckin...@gmail.com wrote:
 Webweave,
 Thanks for your interest.

 Here is the configuration.

 Configuration:
 PHP Version 5.2.8
 Apache/2.2.11
 Linux 2.6.18-92.1.22.el5 #1 (CentOS 5.2)
 Cake 1.2.0.7962

 I have cake directory downloaded and extracted into the htdocs
 directory.

 [r...@localhost rillian_cake]# pwd
 /usr/local/apache2/htdocs/rillian_cake
 [r...@localhost rillian_cake]# ls -altr
 total 64
 -rw-r--r--  1  501   80  139 Jun 14  2006 .htaccess
 -rw-r--r--  1  501   80 2311 Dec 18 21:16 index.php
 -rw-r--r--  1  501   80 1158 Dec 25 18:21 README
 drwxr-xr-x 12  501   80 4096 Dec 25 20:09 app
 drwxr-xr-x  5  501   80 4096 Dec 25 20:15 .
 drwxr-xr-x  5  501   80 4096 Dec 25 20:15 vendors
 drwxr-xr-x  6  501   80 4096 Dec 25 20:17 cake
 drwxr-xr-x  3 root root 4096 Jan  5 14:05 ..
 [r...@localhost rillian_cake]#

 On Jan 5, 5:02 pm, Webweave webwe...@gmail.com wrote:

  It should be compiled into Apache so you shouldn't have to download it
  separately. What platform are you on?

  On Jan 5, 1:31 pm, reidster reidmckin...@gmail.com wrote:

   This is all I see in modules.  I know this isn't an apache group.
   But, do you know if apache requires any special configure options for
   mod_rewrite?

   [r...@localhost modules]# pwd
   /usr/local/apache2/modules
   [r...@localhost modules]# ls
   httpd.exp  libphp5.so

   On Jan 5, 4:20 pm, Bernardo Vieira bvieira.li...@gmail.com wrote:

The actual path to .so files varies in the various linux distros. Scan
through your httpd.conf and look for the extensions/modules path and see
if mod_rewrite.so exists in that path (from the directory listing you
provided I'm guessing /usr/local/apache2/modules).

reidster wrote:
 Thanks for the reply.
 My httpd.conf does not have mod_rewrite enabled.  I checked the doc in
 the aforementioned url, but could not locate the .so file.  This does
 not exist in my apache install.  Do I need to re-configure apache?

 libexec/httpd/mod_rewrite.so

 [r...@localhost apache2]# ls
 bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs
 man  manual  modules
 [r...@localhost apache2]# pwd
 /usr/local/apache2

 On Jan 4, 5:29 pm, Steven Wright rhythmicde...@gmail.com wrote:

 Do you have mod_rewrite enabled on your apache server?

http://book.cakephp.org/view/333/A-Note-on-mod_rewrite

 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] 
 On Behalf

 Of reidster
 Sent: Sunday, January 04, 2009 4:24 PM
 To: CakePHP
 Subject: New Install Does Not Show Graphics

 I am new to CakePHP.

 I have downloaded version 1.2.0.7962, renamed the cake directory and 
 moved
 it to the root of the apache directory (htdocs).

 When I navigate to the cake php website for this directory. I 
 receive a
 listing of all the files in this directory.  I do not see the 
 expected cake
 graphics.

 Any ideas as to what is wrong?

 Configuration:
 PHP Version 5.2.8
 Apache/2.2.11
 Linux 2.6.18-92.1.22.el5 #1 (CentOS 5.2)

 Apache and PHP are working.  I can get to webpages on this host.

 Thanks for your input.
 -Reid


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: HABTM and associations and loading

2009-01-04 Thread Webweave

What do you mean never runs ? Do you mean it times out, or dies, or
what ?

On Jan 4, 4:32 pm, Troy Schmidt schmidt.t...@gmail.com wrote:
 I have a database of 20 tables and several belongsTo, hasMany, and
 HABTM relationships.  When I have all my relationships loaded into the
 models and turned on the program never runs.  When I take out two of
 the HABTM that I will rarely use or can write a custom bindModel to
 run, then the application runs, but on viewing one page loads all the
 models into memory (or at least it seems as such since it caches all
 the tables).

 Now I went through and aggressively took out any associations that I
 didn't think would be used often.  The remainder I plan on using
 bindModel as needed to load them.  My question is does anyone know
 what the performance ramifications are to this model?  Should I let it
 load all of them and keep the associations loading essentially the
 entire application?  What kind of performance hit is there on
 bindModel versus setting it in the model?  And also does bindModel
 offer any caching to it or does it build it all from scratch every
 time?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM naming convention messed up?

2009-01-04 Thread Webweave

Please post your HABTM from your TeamUser model. Seems like you have a
problem there.

Should look something like (guessing):

   // Link to jobs
var $hasAndBelongsToMany = array(
'TeamUser' =
array(
'className' = 'TeamUser',
'joinTable' = 'teams_users',
'foreignKey'= 'user_id',
'associationForeignKey' = 'team_id',
'conditions'= '',
'order' = '',
'limit' = '',
'unique'= true,
'finderQuery'   = '',
'deleteQuery'   = '',
'insertQuery'   = ''
));

On Jan 4, 4:47 pm, gearvOsh mileswjohn...@gmail.com wrote:
 Ok I have a users and teams system. Users are part of a team. Here is
 the naming conventions:

 Model: Team, User
 DB: teams, users
 HABTM: teams_users (TeamUser model)

 But when I set my HABTM relationships I get errors because it says
 that the model TeamsUser does not exist. Shouldnt it be TeamUser?
 Thats what all the documentation says.

 I fail to see how this setup is better then having a table, model,
 controller, etc all called Teams or Users.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Validation errors for the wrong form

2009-01-04 Thread Webweave

I think this is related to the controller, and you need to implement
something like Multivalidatable (see:
http://bakery.cakephp.org/articles/view/multivalidatablebehavior-using-many-validation-rulesets-per-model)

I have this in my user_controller to deal with login, registration and
signup, which require different levels of validation. In my case, I
was having some problems with the Multivalidatable behavior on one of
my hosts, so I ended up coding the logic inside the controller
(basically pulled the behavior back into the controller). You can see
the code at
http://volunteercake.svn.sourceforge.net/viewvc/volunteercake/VolunteerCake/controllers/users_controller.php?view=markup


On Jan 4, 4:21 pm, mariacheu...@gmail.com mariacheu...@gmail.com
wrote:
 Hi Eddie,
 Thanks for your reply. However, my validation will check the username
 and password fields for length, to ensure they're not empty. So this
 is failing validation for the login sidebar, even though it wasn't
 submitted.

 Does anyone else have a register and login form on the same page, and
 have the validation working correctly??

 Thanks!

 On Jan 4, 11:40 pm, Smelly_Eddie ollit...@gmail.com wrote:

  Maria:

  You can simply limit validation to only occur if fields are present.

  For example, a register page might have two password fields to
  compare, while a login will only have one.

  A register page might have email, or address while a login will not.

  The article below explains how to perform such validation and is based
  on a User model. it also includes tips on how to validate user names
  and passwords for better security.

 http://edwardawebb.com/programming/php-programming/cakephp/complex-va...

  On Jan 3, 7:29 am, mariacheu...@gmail.com mariacheu...@gmail.com
  wrote:

   They are both different forms, the register form is from a view and
   the login is part of a sidebar element. Both forms have different
   names too.

   Thanks for your reply!

   On Jan 3, 6:21 pm, Nature Lover nature_lover1...@yahoo.co.in wrote:

Hi!

Are the forms for both login and register differ.
or you have included the login element within the registration form?

thanks!

On Jan 1, 9:33 am, mariacheu...@gmail.com mariacheu...@gmail.com
wrote:

 Hi all,
 Apologies if this has been addressed before, but I've searched and
 can't find a thing.

 I have a register page, with a login element in the sidebar. The login
 element is on every page in the sidebar. When I try register with
 invalid data, the correct validation errors show for the register
 form. However, the errors are also showing on the login form, even
 though that hasn't been submitted. The login form is using jQuery Ajax
 to submit.

 Any ideas anyone?

 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: ModelBaker ... umm... yummy

2009-01-04 Thread Webweave

Yeah, CakeApp, that was it (although webbaker looks interesting too).

Anybody have an idea whether ModelBaker is going cost anything?

On Jan 4, 7:35 am, Bernardo Vieira bvieira.li...@gmail.com wrote:
 Maybe cakeapp?http://cakeapp.com

 Drinkspiller wrote:
  There was a web based thing floating around I saw posted on this group

  WebBaker?
 http://nio.infor96.com/webbaker/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: creating tmp-folder on install

2009-01-04 Thread Webweave

It depends on the users and groups that own your app directory on the
server. If the two users belong to the same group, and the permissions
are set properly with group having full permissions on app, then you
should be able to create the app/tmp directory.

The other issue you may run into is that the umask for the user that
you are creating files with will probably not be set up to allow
creation of RWX, since the HTTP user is usually set with very low
permissions for security reasons.

My guess, based on what you're saying is that the app directory is
owned by FTP-user, and the HTTPD user doesn't have the right groups
and/or permissions to create the directory.

It would be helpful if you post the actual errors you are seeing.

On Jan 4, 5:18 am, Daniel Zuidema danielzuid...@gmail.com wrote:
 Hello all, just trying to get my head around cakePHP after doing some
 oldfashion PHP coding and one thing struck me as odd. Like so many new
 time users, I'm a bit of a novice in PHP, well more of a script-kiddy
 that fully modifies existing scripts and write around that. Hope I
 will do better with cakePHP.

 I've been reading about the tmp folder a lot and sorry for bringing
 this up again.
 My webserver is running on a different user than the ftp-login I use.
 Like most servers.
 So I do have to change the permissions of app/tmp to 777. Now I know,
 it's not a really big issue. As the core will handle any malicious
 attempt on this folder, thanks to the webroot folder.

 But why not use the $Folder-create function to create this tmp-folder
 and the structure below when you first start up CakePHP?

 I've tried to write a simple script to create the tmp-folder through
 PHP so the owner of the tmp-folder will be HTTPD. instead of the
 FTP-user. In theory this would prevent me changing the permissions as
 httpd will have full access to the folder.
 Problem is that my PHP 5 will not let me. Hsphere is throwing a tomcat
 error. Usually does that when the folder is created by the FTP-user
 instead of the httpd-user.
 Hsphere will also not allow me to change the httpd config file so
 that's no option as well. And I can't do a chown. As I don't have
 command line access.

 In the past I've run into this problem as well, and I think I solved
 it once by creating a script with an include that did the mkdir. But I
 can't figure it out again.

 As my linux knowledge is basic as well, I can't see the implications
 of having the tmp-folder owned by the httpd-user. If there's any? Can
 somebody enlighten me?

 Kind regards,
 Daniel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: getting content from another content type into a static page

2009-01-04 Thread Webweave

Elements sound like the right thing, but you can always use a model
anywhere you like, and Cake does some really nice magic for you in
most cases where you'd want to do this.

Sounds like you are wanting to get some specific data displayed on
your home page, which would involve adding the models to your app
controller (haven't ever tried this myself, outside of Auth data).

Chris Hartjes has a nice article on his blog where he debunks Cake
myths, and shows you how to use multiple models in a controller (see
http://www.littlehart.net/atthekeyboard/).

On Jan 4, 8:16 am, Rick Hurst rick.hu...@gmail.com wrote:
 On Sun, Jan 4, 2009 at 3:57 PM, Smelly_Eddie ollit...@gmail.com wrote:

  Rick:

  I think you want to look into elements.

  You can create an action in your articles  controller like
  loadArticleSnippet($id)

  You can then call that action from an element that is coded into your
  homepage.

 http://book.cakephp.org/view/97/Elements

 cheers for that, i'll look into Elements. it would useful to know how
 to use other models in my pages though..

 --
 Rick Hurst, Web developer, Bristol, Englandhttp://www.rickhurst.co.uk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 multiple models in the same page: possible?

2009-01-04 Thread Webweave

All you need to do is handle the related models in the same form.
There's no need to separate into two forms unless that's your
intention. I have many pages where I update data from one form into
multiple models (e.g. - register a user and sign him up for a job,
which involves creating a row in users, and then updating the HABTM
for jobs).

The form create action can be used to tell it which controller and
action to submit as well, so you could have something like:

?php echo $form-create('Image', array('controller' =
'profiles', 'action' = 'image' ));?

To submit the form to the 'image' action of the 'profiles' controller.

The redirection you're talking about is controlled by the action of
the form, so if you want it to go somewhere else, you just need to
code things that way.


On Jan 3, 4:07 pm, Jaime ja...@iteisa.com wrote:
 Hi all,

 I wonder if it's possible to have two different forms for two
 different (but related) models in the same page.

 Imagine a page where the logged in user can edit his profile (model
 Profile) as well as to add a photo into his gallery (model Image).

 ?php echo $form-create('Profile'); ?
 ...

 ?php echo $form-create('Image'); ?
 ...

 The problem here is that after submiting one of the forms, the user is
 redirected to /model/edit/, and not back to the current page.

 I cannot imagine how to fit both forms in the same page without
 loosing the validationErrors info.

 Any clue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: ModelBaker ... umm... yummy

2009-01-02 Thread Webweave

There was a web based thing floating around I saw posted on this group
too (unfortunately I used it once and have promptly forgotten the
URL). It had a lot of the same features, and was driving the build
through the web (even had a slick GUI table building tool).


On Jan 2, 11:44 am, Bernardo Vieira bvieira.li...@gmail.com wrote:
 Wrap a gtk ui around bake and you're half way there ;)

 DM wrote:
  Holy Cow, this thing looks freakin awesome! Does any other framework
  have anything close to ModelBaker?www.widgetpress.com

  IMHO, if this thing takes off, this could add a ton of new people into
  the community. I'll definitely be downloading this thing on Monday.

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



Re: putting 2 modules on the same page

2009-01-02 Thread Webweave

The element refers to data just like any other view. I use an element
to display task listings, and by choosing which data to pass to the
element, I get different displays on the same page:

div class=related
?php if (isset($userSlots)):?
h3?php __('You are signed up for');?/h3
?php echo $this-element('signup_list', array( 'slots' =
$userSlots )); ?
?php endif; ?
h3?php __('Available Time Slots for '. $job['Job']
['job_name']);?/h3
?php if (isset($availableSlots)):?
?php echo $this-element('signup_list', array( 'slots' =
$availableSlots )); ?
?php else: ?
h3Nobody signed up for this job yet/h3
?php endif; ?

div class=actions
ul
li?php echo $html-link(__('Show Jobs', true), array
('controller'= 'jobs', 'action'='index'));? /li
/ul
/div
/div


As you can see, I use the signup_list element with a different value
passed in as 'slots' each time ...

On Jan 2, 2:19 pm, bmaorlo opao...@gmail.com wrote:
 Thanks , and this re-usable view can have a controller ?
 If i want this view to take data from DB for example login box .
 How do i do the logic part on this view ?

 Thanks.

 On Jan 3, 12:04 am, WebbedIT p...@webbedit.co.uk wrote:

  An element is simply a re-usable view ... rather than repeat a whole
  view or a part of a view which is used multiple times across your app,
  create a single element and use that across multiple views.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 crating a table structure for the acl

2009-01-02 Thread Webweave

You are probably running cake from the wrong directory. Change
directory to your app, then run the command (cake has to find your DB
connection in the database.php file).

On Jan 1, 8:26 am, vikas vikas...@gmail.com wrote:
 hello all.. HAPPY NEW YEAR...

 Still problem contenious with ACL in new year also... :)

 I have problem with crating a table structure for the acl

 I am trying to create ACL table structure using command: 'cake acl
 initdb'

 but this shows me error:
 Your database configuration was not found.

 But I have already configured my database and also used cake bake -
 app.. command to crate scaffold..

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



Re: Conditional find on recursive belongsTo association

2009-01-02 Thread Webweave

Probably just a typo, but it should be 'foreignKey' not
'foriegnKey' ...

All you need to do is set the recursive level on your parent model,
and you should get all the related data:

$this-Staff-recursive = 2;

Or set recursive in your find.

On Dec 30 2008, 3:58 am, WebbedIT p...@webbedit.co.uk wrote:
 That doesn't work either as I can't the following returns a
 Staff.Person.organisation_id SQL error

 $this-Staff-bindModel(array(
   'belongsTo'=array(
     'Organisation'=array(
       'foriegnKey'='Person.organisation_id'
     )
   )
 ));

 I then tried to use paginate on $this-Staff-Person as that would
 allow me to access the Organisation table properties, whilst still
 pulling out Staff details, but this seems the wrong way to do it and
 would entail removing a lot of relations I do not require from the
 Person model.

 Surely there is a simpler way to paginate data from my Staff model
 filtered by a field in a table two belongsTo associations away?  All I
 need is for Cake to join these three tables together by their
 belongsTo associations.  I've been stuck at this point for over a week
 now and would be hugely grateful to anyone who can help me out.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Small problem passing variables

2009-01-02 Thread Webweave

It shouldn't as you are writing to the session, which is not shared
across sessions ...

On Dec 30 2008, 6:40 am, Steppio stepisgr...@hotmail.com wrote:
 Ahh thank you very much, i understand now. I've used the following in
 the controller to set the id in the session:

                                 $user_id = $this-User-getLastInsertId();
                                 $this-Session-write('User.id', $user_id);

 And then i used the session helper in the view to retrieve it:

                 $user_id = $session-read('User.id');

                 echo $form-input('user_id',array('type' = 'hidden', 'value' 
 =
 $user_id ));

 It still returned a select box with all the ID's in, but its default
 is the last ID, so i set it to hidden.

 Say. however, two people signed up to the site simultaneously, would
 this confuse the controller / view if configured this way, i.e. might
 one person end up with the others ID?

 Again thank you very much for your help!

 On Dec 30, 2:09 pm, majna majna...@gmail.com wrote:

 http://api.cakephp.org/class_model.html#2525df39f43db3a76bff482265695d54

  getLastInsertID is wrapper for getInsertID,
  so getInsertID is a it faster.
  in controller:
  $this-set('user_id', $this-User-getInsertID());

  On Dec 30, 2:50 pm, Steppio stepisgr...@hotmail.com wrote:

   Thanks to everyone for the responses its been a big help, i am still
   stumped however, are getInsertID and getLastInsertID model functions?
   If so how would i pass these to the views?

   On Dec 29, 4:22 pm, Webweave webwe...@gmail.com wrote:

I think you meant $this-User-getLastInsertId();

On Dec 28, 9:59 am, Troy Schmidt schmidt.t...@gmail.com wrote:

 $this-User-getInsertID();

 I don't know about the Auth component as i haven't used it alot.  But
 that would get the last inserted ID.  I would just set that variable
 and include it in the view for the future steps.

 Otherwise it looks like 'user_id' isn't set yet for user

 On Dec 28, 11:11 am, Steppio stepisgr...@hotmail.com wrote:

  Hello everybody, i am totally new to Cake and am finding it quite
  difficult to understand all the different parts of it. At the moment
  i'm trying to make a three part user registration process, firstly
  with the username and password fields, then onto details about the
  user, then on to duties they wish to undertake on the site. The only
  problem i am having is once the username and password are created it
  creates an ID in the users tables, referenced to my other tables as
  'user_id'. What i cannot quite figure out is how, once a user is
  created, would i get that user_id into the duties view? What i am
  doing at the moment is shown below:

          function add() {
                  if (!empty($this-data)) {
                          $this-User-create();
                          if ($this-User-saveAll($this-data)) {
                                  $this-Session-setFlash(__('Your 
  Username and Password have been
  saved', true));
                                  $cookie = array();
                                  $cookie['user_id'] = 
  $this-Auth-user('user_id');
                                  $this-Session-write('Auth.User', 
  $cookie);
                                  
  $this-redirect(array('controller'='details','action'='add'));
                          } else {
                                  $this-Session-setFlash(__('Your 
  Username and Password could not
  be saved. Please, try again.', true));
                          }
                  }
          }

  ^users_ controller^

  I then call this in the 'duties/add' view with:

                  $user_id = $session-read('User_id');

                  echo $form-input('user_id',array('value' = 
  $user_id ));

  The only problem with this is Cake returns a select box populated 
  with
  all of the id's in the user tables. All i want is the ID that has 
  just
  been created.

  This is probably a very simple problem but i've been reading alot on
  the internet and just cannot understand how to do it. Any help and
  advice would be greatly appreciated!!

  Yours hopefully,
  Steppio


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: TCPDF error: Some data has already been output, can't send PDF file

2009-01-02 Thread Webweave

You are getting redirected to the login page (probably because your
action is not in the allowed list).

Post your beforeFilter() so we can see what the problem is, but my
guess would be the same as robechar: you are being asked to login.

On Dec 29 2008, 1:08 pm, BrianRehg brianr...@gmail.com wrote:
 When I look at the headers this is being sent:
 HTTP/1.1 302 Found
 Date: Mon, 29 Dec 2008 20:56:26 GMT
 Server: Apache/2.2.3 (CentOS)
 X-Powered-By: PHP/5.2.6
 Set-Cookie: CAKEPHP=mrhdqb3hslfrktbbvvf5iobds2; path=/
 P3P: CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM
 Location:http://agc..com:80/users/login
 Content-Length: 553
 Connection: close
 Content-Type: text/html; charset=UTF-8

 Any suggestions what is generating this?

 Thanks,
   Brian

 On Dec 22, 1:08 pm, BrianRehg brianr...@gmail.com wrote:

  PDF error when usingTCPDF. I see several post on this and no real
  solution for tracking down this issue. How can I track down what is
  being sent to the screen. I have tried it with debug off and debug on
  and same error : Some data has already been output, can't send PDF
  file.
  Any suggestions please?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: API

2009-01-02 Thread Webweave

My experience is that you are much better off looking at the cookbook
for that sort of information.

In a few cases the API docs are very clear as to what the options are
and how to use them, but often it requires a lot of digging to
understand them.

What part of the API are you having trouble with ?

On Dec 29 2008, 6:18 pm, rhythmicde...@gmail.com
rhythmicde...@gmail.com wrote:
 I am looking at the API trying to figure some stuff out. I keep
 getting stuck when they docs talk about options but dont actually give
 the options. How am I supposed to figure out what options are
 available for a particular class? Some of the time I can find the
 option in class or method definition but there is no real explanation
 of what it's for.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Selecting users who are not friends

2009-01-02 Thread Webweave

First, you should reall be using find('all') not findAll, as in:

   $friends = $this-User-find('all', array('conditions' = array
('User.id' = $target)));

To find all the users who are not friends, simply use the following:

$notFriends = $this-User-find('all', array('conditions' = array
('NOT' = array('User.id' = $target;

On Dec 29 2008, 12:59 pm, WebFeathers webfeath...@gmail.com wrote:
 Hey-
 I'm trying to generate a list of users who are not friends of the
 currently logged in user.
 I have two tables: profiles, and users_users
 profiles includes the fields: id, first_name, last_name, etc...
 users_users includes: id, user_id, friend_id

 I can get the list of users who ARE friends:
 $friends = $this-User-findAll('User.id=' . $target);

 ...but can't figure out how to go the other way???

 My user model includes:
 class User extends AppModel
 {
         var $name = 'User';
         var $hasAndBelongsToMany = array(
                 'Friends' = array(
                         'className' = 'Profile',
                         'joinTable' ='users_users',
                         'foreignKey' ='user_id',
                         'associationForeignKey' = 'friend_id',
                         'unique'= true
                         ),
                 'FriendList' = array(
                         'className' = 'users_users',
                         'joinTable' ='users_users',
                         'foreignKey' ='user_id',
                         'associationForeignKey' = 'friend_id',
                         'unique'= true
                         )
         );

 }


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



  1   2   >