Multiple login system

2008-10-31 Thread bookme

Hi,

I am working on a site and want to implement two types of users with
different logins
like: http://www.naukri.com/
1. User Login
2. Business Login

Should I use Auth using ACL?

Also, please suggest if you have better solution for this ?

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



htaccess problems.

2008-10-31 Thread Todd M

I'm finding problems with what I believe is with .htaccess in the
cake_install_directory.

My current web server only allows the /html directory as a HTML root.
To reduce complexity, I thought it would be good to start with
untaring the CakePHP in that directory.

so my directory appears something like this

/html
  /cake1.2
   /app
   /cake
   /docs
   /vendors
   /foobar

I've noticed in the past if I wanted to look at an html file in foobar
I had to use http://www.example.com/foobar

So I'm at step 4 in the documentation. I've confirmed with the web
server that has AllowOverride is set to All.

It seems that I can't do
http://www.example.com/cake1.2
http://www.example.com/cake1.2/index.php
or even
http://www.example.com/cake1.2/foo.html

The foo.html is just a hello world html file.

What I found is if I remove the .htaccess file I get a nice CakePHP
link telling my salt needs to be updated and that theres no connection
to DB.

So I went farther in the tutorial, I successfully linked DB  changed
salt word. Checked the http://www.example.com/cake1.2 and everything
looks fine, including DB is connected and no salt warning.

I did do a google search both here and the internet. I did find
something about adding a Rewritebase line to all 3 .htaccess, but not
sure if I did that correctly.  When I changed that, it seemed to just
go to a blank webpage. No errors or anything.

So my questions are if the .htaccess is necessary? good practice?

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



An OO question

2008-10-31 Thread Calvin

Hi all,

I am finding difficult to understand why this isn't working...

?php

abstract class A {
protected static $property = false; # Q1
public static function method() { # Q2
return self::$property;
}
}

class B extends A {
protected static $property = true; # Q1
}

var_dump(B::method());

It prints False and I expect it to be True...

Q1. Does B::$property suppose to overwrite B::$property?
Q2. when B::method() is called, shouldn't it return B::$property (even
though the method is declared in A)?
Q3. Anyways to change the code to work as my expectation?

Thanks in advance

- Calvin

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



Re: htaccess problems.

2008-10-31 Thread Anupom
Hi there,

Can you please share your modified .htaccess file that you have inside your
cake1.2 directory? I guess you have other .htaccess files inside your root
or html directory? Can you tell us what's written inside those as well?

So my questions are if the .htaccess is necessary? good practice?


.htaccess is necessary for pretty URLs and is certainly a good thing to have
:) You can though setup your cake to not to use .htaccess.

Also please check if apache rewrite module is turned on in your web server.

Thanks.

On Fri, Oct 31, 2008 at 9:40 AM, Todd M [EMAIL PROTECTED] wrote:


 I'm finding problems with what I believe is with .htaccess in the
 cake_install_directory.

 My current web server only allows the /html directory as a HTML root.
 To reduce complexity, I thought it would be good to start with
 untaring the CakePHP in that directory.

 so my directory appears something like this

 /html
  /cake1.2
   /app
   /cake
   /docs
   /vendors
   /foobar

 I've noticed in the past if I wanted to look at an html file in foobar
 I had to use http://www.example.com/foobar

 So I'm at step 4 in the documentation. I've confirmed with the web
 server that has AllowOverride is set to All.

 It seems that I can't do
 http://www.example.com/cake1.2
 http://www.example.com/cake1.2/index.php
 or even
 http://www.example.com/cake1.2/foo.html

 The foo.html is just a hello world html file.

 What I found is if I remove the .htaccess file I get a nice CakePHP
 link telling my salt needs to be updated and that theres no connection
 to DB.

 So I went farther in the tutorial, I successfully linked DB  changed
 salt word. Checked the http://www.example.com/cake1.2 and everything
 looks fine, including DB is connected and no salt warning.

 I did do a google search both here and the internet. I did find
 something about adding a Rewritebase line to all 3 .htaccess, but not
 sure if I did that correctly.  When I changed that, it seemed to just
 go to a blank webpage. No errors or anything.

 So my questions are if the .htaccess is necessary? good practice?

 



-- 
Anupom Syam
http://syamantics.com/

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



Re: An OO question

2008-10-31 Thread AD7six



On Oct 31, 5:04 am, Calvin [EMAIL PROTECTED] wrote:
 Hi all,

 I am finding difficult to understand why this isn't working...

 ?php

 abstract class A {
     protected static $property = false; # Q1
     public static function method() { # Q2
         return self::$property;
     }

 }

 class B extends A {
     protected static $property = true; # Q1

 }

 var_dump(B::method());

 It prints False and I expect it to be True...

 Q1. Does B::$property suppose to overwrite B::$property?
 Q2. when B::method() is called, shouldn't it return B::$property (even
 though the method is declared in A)?
 Q3. Anyways to change the code to work as my expectation?

 Thanks in advance


May I ask why you're asking here? Are you using CakePHP at all?

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



Re: Admin + Members suggested setup??

2008-10-31 Thread Flipflops

I've created some sites with multiple admin routes (i.e. members and
admin) although only in 1.1 - there is an article about it in the
bakery: 
http://bakery.cakephp.org/articles/view/using-cake_admin-for-multiple-user-types
- it works very well.

I seem to remember reading that this is built in in 1.2, but haven't
tried this out yet -  I imagine you would just specify an array of
possible routes in /config/core.php, but I could be wrong - although
it would be easy to find out...

Personally I would see it as working in a complementary with
permissions systems (ACL) so for instance you might specify a group
with access to the admin methods, a group with access to members
methods and then the methods that represent your public facing (and
authentication free) site. So in a way it a just about keeping things
nice and tidy. Use Auth to take care of a user login, but it is up to
you to decide where to let somebody go once they have logged in - I
would say that is what ACL is for.

Maybe it is more an issue of philosophy - you need to find a way of
working and structuring things that is good for you - even within the
constraints of Cake there are often many ways of doing things.

On Oct 28, 8:33 pm, Brenton B [EMAIL PROTECTED] wrote:
 Quick question as to what would be the best Cake-y setup:

 So I've got a list of Users who can either be Admin, Editors, or
 simply Members.
 Members can edit their own profiles, but Admin can also edit anyone's
 profile (at this point Editors are just normal Members with special
 status).

 When it comes to admin routing, should that only be used for strictly
 Admins and not Members?
 Ex:
 /profiles/edit - what Members use and there's a check that the
 profile matches with the member
 /profiles/admin_edit - only Admin uses this.

 And how would that all work with ACL? It seems like there's a wee bit
 of overlap here.

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Flipflops

Try em both. See you which you prefer.

But I vote for jquery. The jquery website is really good with loads of
links to tutorials and working examples of everything and even better
it is quick now too.

On Oct 30, 10:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 Hello,

 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?

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



Re: Admin + Members suggested setup??

2008-10-31 Thread Adam Royle

Admin routing as more useful in a CMS-style site where there are
clearly two distinct areas display of site data, and administering
site data, which both could differ greatly in controller  view code,
rather than just acl  permissions.

Hope that clears things up.

Cheers,
Adam

On Oct 29, 6:33 am, Brenton B [EMAIL PROTECTED] wrote:
 Quick question as to what would be the best Cake-y setup:

 So I've got a list of Users who can either be Admin, Editors, or
 simply Members.
 Members can edit their own profiles, but Admin can also edit anyone's
 profile (at this point Editors are just normal Members with special
 status).

 When it comes to admin routing, should that only be used for strictly
 Admins and not Members?
 Ex:
 /profiles/edit - what Members use and there's a check that the
 profile matches with the member
 /profiles/admin_edit - only Admin uses this.

 And how would that all work with ACL? It seems like there's a wee bit
 of overlap here.

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



Re: Question about Data Sanitation in CAKEPHP

2008-10-31 Thread [EMAIL PROTECTED]

If I would sanitaze my input from javascript code?


On 30 Ott, 18:57, Gwoo [EMAIL PROTECTED] wrote:
 The DBO layer handles proper escaping of your data to prevent SQL
 injection. You do not need to use Sanitize unless you are doing
 something out of the ordinary.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Admin + Members suggested setup??

2008-10-31 Thread Kappa

Admin routing and ACL are two different things, admin routing is just
a quick way to have some action not accessible from everybody with a
few efforts.
And from what i know (but it should be cheched) at least in Cake 1.2
there's
also the availability of some super_admin methods.

Anyway a nice advantage in using admin routing, in respect of making
your own
checks, is that you can do ONCE in the before_filter action of the
AppController
(the controller from which every other controller inherits) the check,
and
you have to check only one param of the request: 'admin'.

Here an example:

class AppController extends Controller{

  .

 function beforeFilter() {
   // if admin pages are being requested
   if(isset($this-params['admin'])){
   if (!$this-Session-check('User')) {
   // set flash message and redirect
   $this-Session-setFlash('You need to be logged in to
access this area');
   $this-redirect('/users/login/?redir='.$this-params['url']
['url'],true);
   }
   }

   //If already logged in change the layout to admin
   $this-layout='admin_theme';
}

.

}


Of course this method can be used only for simple and small
applications,
if you need more complex authentication and authorization, you should
consider
using Auth and ACL components.

Bye,
  Andrea

On Oct 30, 7:51 pm, Brenton B [EMAIL PROTECTED] wrote:
 Is the Admin routing intended as strictly for Root Admin? Or anyone
 that can log in? just seems a bit vague.

 On Oct 29, 11:54 am, Brenton B [EMAIL PROTECTED] wrote:

  Essentially ... what makes the Admin Routing so special, and why
  should I use it? What's the advantage over just having all the checks
  in my own code? (ex: checks that they're logged in as admin and have
  the right permissions)

  On Oct 28, 1:33 pm, Brenton B [EMAIL PROTECTED] wrote:

   Quick question as to what would be the best Cake-y setup:

   So I've got a list of Users who can either be Admin, Editors, or
   simply Members.
   Members can edit their own profiles, but Admin can also edit anyone's
   profile (at this point Editors are just normal Members with special
   status).

   When it comes to admin routing, should that only be used for strictly
   Admins and not Members?
   Ex:
   /profiles/edit - what Members use and there's a check that the
   profile matches with the member
   /profiles/admin_edit - only Admin uses this.

   And how would that all work with ACL? It seems like there's a wee bit
   of overlap here.

   How have people set this up?


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Gianluca Gentile

jQuery .

On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 Hello,

 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?

 tks

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread martinp

Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
Helper, I find JQuery so much easier to use that you don't really need
a helper.

On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
wrote:
 jQuery .

 On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

  Hello,

  I'm gonna create a web app using CakePHP but I'm confused about
  chosing between Jquery or Scriptalious? Which one should I choose?
  Does it really matter? What's the differences between them?

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



Position of label on checkbox inputs

2008-10-31 Thread Tom Singer

Hi,

Is there a reason $out is appended to the end in form-input when
$type is set to checkbox? This behaviour is different to all the other
types which place label before the input and is causing me issues with
my layout. I can fix this by moving the out variable between $before
and the checkbox but i don't want to do this if $out is at the end by
design and this will break something. I have had no issues so far but
this may break somethign i have not come across yet.

I am using version 1.2.0.7296 RC2

Thanks,

Tom


[EMAIL PROTECTED]:~/jobzone$ git diff cake/libs/view/helpers/form.php
diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
form.php
index 33639b2..35d06c6 100644
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
unset($divOptions);
break;
case 'checkbox':
-   $out = $before . $this-
checkbox($fieldName, $options) . $between . $out;
+   $out = $before . $out . $this-
checkbox($fieldName, $options) . $between;
break;
case 'radio':
$out = $before . $out . $this-
radio($fieldName, $radioOptions, $options) . $between;

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



Re: Whats the best idea to keep DB under version control or under sync with server?

2008-10-31 Thread Dardo Sordi Bogado

I've been using cake schema from the beginning and (except for some
small bugs already fixed) it worked great out of the box.
Cake schema rocks!

On Thu, Oct 30, 2008 at 9:01 PM, Abhimanyu Grover
[EMAIL PROTECTED] wrote:

 Thanks, looks like Cake schema would be the only problem solver in my
 case.

 @the_woodsman give it a try, works very well with RC3.

 On Oct 30, 5:36 pm, Joel Perras [EMAIL PROTECTED] wrote:
 Take a look at the built-in Cake schema shell.

 $ cake schema help

 -J.

 On Oct 30, 8:21 am, Abhimanyu Grover [EMAIL PROTECTED] wrote:

  I'm sorry this is not Cake related, but I feel its something which
  most of developers are missing. I found info about Cake migrations and
  think it would be too difficult to implement it in my team in short
  time. What tools or techniques are you using to overcome this problem?

  I'm aware of a tool called SqlYog or something, which is capable of
  keeping database structured sync'ed from dev. machine to server, but
  its paid, and I'm looking for some open source alternative, maybe a
  simple PHP script or something. Please let me know what do you guys
  use and recommend for a small team?
 


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Dardo Sordi Bogado

I think Jquery is better, based purely in that it's so easy and
intuitive to use/extend that you will need no helper.

On Fri, Oct 31, 2008 at 7:26 AM, Anupom [EMAIL PROTECTED] wrote:
 I think PHP helper for writing Javascript is a very bad idea.

 On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

 Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
 Helper, I find JQuery so much easier to use that you don't really need
 a helper.

 On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
 wrote:
  jQuery .
 
  On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 
   Hello,
 
   I'm gonna create a web app using CakePHP but I'm confused about
   chosing between Jquery or Scriptalious? Which one should I choose?
   Does it really matter? What's the differences between them?
 
   tks




 --
 Anupom Syam
 http://syamantics.com/

 


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



Translation and placeholders

2008-10-31 Thread Liebermann, Anja Carolin

Hi everybody,

I need a hint how I get my variables into a translateed string.

E.g. (you surely know that one *g*)
'Page %page% of %pages%, showing %current% records out of %count% total,
starting on record %start%, ending on %end%' 

Where do %page% etc come from?

I have several strings like that:
$this-Session-setFlash(__('This image %name% already exists.', true));

So how can I get my variable in this string?

Thanks a lot in advance!

Anja

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



AW: Delete Auth Cookie on Logout

2008-10-31 Thread Liebermann, Anja Carolin

Hi,

What I have:

function logout()
{
// Redirect users to this action if they click on a Logout 
button.
// All we need to do here is trash the session information:

$this-Session-delete('User');

// And we should probably forward them somewhere, too...

$this-redirect('/users/login');
}

So you can choose your favourite forwanrd and you should be happy.

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
thatsgreat2345
Gesendet: Donnerstag, 30. Oktober 2008 21:25
An: CakePHP
Betreff: Re: Delete Auth Cookie on Logout


Not redirecting to the login page fixed it, I plan on sending it to the 
homepage after logout but the home page hasn't been created yet thus why i was 
just sending it back to the login page.

On Oct 30, 1:22 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
 I have logout going back to the login page if this is the problem xD

 On Oct 30, 1:22 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:

  When I do a pr of it , on logout it does a dump of all the data 
  still in the session.

  Array
  (
      [Config] = Array
          (
              [userAgent] = f221f8a145cf92f820aefa5fc4a585bb
              [time] = 1225399272
              [rand] = 1107590627
              [timeout] = 7
          )

      [Auth] = Array
          (
              [User] = Array
                  (
                      [id] = 1
                      [created] = 2008-10-29 14:43:47
                      [modified] = 2008-10-29 14:43:49
                      [username] = thatsgreat2345
                      [level] = 9
                      [email] = [EMAIL PROTECTED]
                  )

          )

      [Message] = Array
          (
          )

  )

  On Oct 30, 12:56 pm, teknoid [EMAIL PROTECTED] wrote:

   Auth doesn't set any cookies...

   logout() should handle deleting the session for you.
   try to pr($this-Session-read()); anywhere after logout and see 
   what happens.

   maybe the problem is somewhere else

   On Oct 30, 3:13 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:

I have a users controller that when logs in redirects to another 
controller that manages the redirects so if an admin logs in it 
sends them to the admin controller and if a customer logs in it 
sends them to the customers controller. They both have different 
access levels, so when I logout I want the cookie deleted but I 
can't seem to achieve it.
I have session in the components. Just wondering how I can get 
the session to be deleted.
The problem arising is that when I logout and try to login as a 
different user with a different level of access it throws an 
authError but when I try to login with the same username and 
access level it sends me to the right place.

  function logout() {
         // $this-Session-del('CAKEPHP');
          $this-Session-destroy();
          $this-Session-setFlash('You have logged out.');
          $this-redirect($this-Auth-logout());
  }


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread grigri

 JQuery or Scriptalicious?

Mootools for me. But to each his own...

On Oct 31, 10:18 am, Dardo Sordi Bogado [EMAIL PROTECTED]
wrote:
 I think Jquery is better, based purely in that it's so easy and
 intuitive to use/extend that you will need no helper.

 On Fri, Oct 31, 2008 at 7:26 AM, Anupom [EMAIL PROTECTED] wrote:
  I think PHP helper for writing Javascript is a very bad idea.

  On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

  Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
  Helper, I find JQuery so much easier to use that you don't really need
  a helper.

  On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
  wrote:
   jQuery .

   On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

Hello,

I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?

tks

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



AW: Translation and placeholders

2008-10-31 Thread Liebermann, Anja Carolin

Found something for my porblem.

Seems the good old sprintf ist still the solutionfro general strings:
E.g.
sprintf(__('Wollen Sie # %s wirklich löschen?', true), $ort['id'])

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
Liebermann, Anja Carolin
Gesendet: Freitag, 31. Oktober 2008 11:48
An: cake-php@googlegroups.com
Betreff: Translation and placeholders


Hi everybody,

I need a hint how I get my variables into a translateed string.

E.g. (you surely know that one *g*)
'Page %page% of %pages%, showing %current% records out of %count% total, 
starting on record %start%, ending on %end%' 

Where do %page% etc come from?

I have several strings like that:
$this-Session-setFlash(__('This image %name% already exists.', true));

So how can I get my variable in this string?

Thanks a lot in advance!

Anja



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



Re: Position of label on checkbox inputs

2008-10-31 Thread grigri

It is common practice to have labels for most form elements before
(above or to the left of) the element itself, except for radio buttons
and checkboxes, where the norm is for the label to be on the right.

[x] Bacon
[x] Eggs
[x] Sausages

easier to read than

Bacon [x]
Eggs [x]
Sausages [x]

I've never had a problem styling forms with the standard form helper
methods.

(On an unrelated note, are there any collections of CSS files for
cakephp forms? Might be a handy resource to create one. The bakery
style is ok, but a drop-in solution for columnar forms that work
directly with the form helper would be cool. A sort of CSS Cake
Garden if you will.)

hth
grigri

On Oct 31, 9:52 am, Tom Singer [EMAIL PROTECTED] wrote:
 Hi,

 Is there a reason $out is appended to the end in form-input when
 $type is set to checkbox? This behaviour is different to all the other
 types which place label before the input and is causing me issues with
 my layout. I can fix this by moving the out variable between $before
 and the checkbox but i don't want to do this if $out is at the end by
 design and this will break something. I have had no issues so far but
 this may break somethign i have not come across yet.

 I am using version 1.2.0.7296 RC2

 Thanks,

 Tom

 [EMAIL PROTECTED]:~/jobzone$ git diff cake/libs/view/helpers/form.php
 diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
 form.php
 index 33639b2..35d06c6 100644
 --- a/cake/libs/view/helpers/form.php
 +++ b/cake/libs/view/helpers/form.php
 @@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
                                 unset($divOptions);
                         break;
                         case 'checkbox':
 -                               $out = $before . $this-checkbox($fieldName, 
 $options) . $between . $out;

 +                               $out = $before . $out . 
 $this-checkbox($fieldName, $options) . $between;

                         break;
                         case 'radio':
                                 $out = $before . $out . $this-

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



Re: Post Data

2008-10-31 Thread MDB

The form values do not show up when I do that, they do when I do a
debug($this) and appear like this:

[form] = Array
(
[Test1] = 04
[Test2] = 05
)

How do I access these values?
I have tried $this-form and $_POST['Test1'] however I always get an
undefined index or property error.




On Oct 30, 9:21 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
 add debug($this-data); to your controller that is receiving the
 submitted data. It will display the structure of $this-data

 On Oct 30, 6:59 am, MDB [EMAIL PROTECTED] wrote:



  How do you get form data that is not part of a controller?  I have a
  select / drop down box called dobDay, then in the controller, I have
  tried $this-data['dobDay'], $_POST['dobDay'] and 
  $this-data['Customer']['dobDay'] (customer = name of form) and nothing

  works.  Can someone please help? TIA- Hide quoted text -

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



Re: Whats the best idea to keep DB under version control or under sync with server?

2008-10-31 Thread joelmoss

Take a look at this guys: http://code.google.com/p/cakephp-migrations/


On Oct 31, 12:42 am, Abhimanyu Grover [EMAIL PROTECTED] wrote:
 I posted a small tutorial on same:

 http://www.gigapromoters.com/blog/2008/10/30/how-to-keep-your-databas...

 Hoping it will help others.

 On Oct 30, 5:36 pm, Joel Perras [EMAIL PROTECTED] wrote:

  Take a look at the built-in Cake schema shell.

  $ cake schema help

  -J.

  On Oct 30, 8:21 am, Abhimanyu Grover [EMAIL PROTECTED] wrote:

   I'm sorry this is not Cake related, but I feel its something which
   most of developers are missing. I found info about Cake migrations and
   think it would be too difficult to implement it in my team in short
   time. What tools or techniques are you using to overcome this problem?

   I'm aware of a tool called SqlYog or something, which is capable of
   keeping database structured sync'ed from dev. machine to server, but
   its paid, and I'm looking for some open source alternative, maybe a
   simple PHP script or something. Please let me know what do you guys
   use and recommend for a small team?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: An OO question

2008-10-31 Thread [EMAIL PROTECTED]

Well I guess its Halloween so we can expect a few (help) vampires
right? hehe!

On Oct 31, 4:04 am, Calvin [EMAIL PROTECTED] wrote:
 Hi all,

 I am finding difficult to understand why this isn't working...

 ?php

 abstract class A {
     protected static $property = false; # Q1
     public static function method() { # Q2
         return self::$property;
     }

 }

 class B extends A {
     protected static $property = true; # Q1

 }

 var_dump(B::method());

 It prints False and I expect it to be True...

 Q1. Does B::$property suppose to overwrite B::$property?
 Q2. when B::method() is called, shouldn't it return B::$property (even
 though the method is declared in A)?
 Q3. Anyways to change the code to work as my expectation?

 Thanks in advance

 - Calvin

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Anupom
I think PHP helper for writing Javascript is a very bad idea.

On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:


 Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
 Helper, I find JQuery so much easier to use that you don't really need
 a helper.

 On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
 wrote:
  jQuery .
 
  On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 
   Hello,
 
   I'm gonna create a web app using CakePHP but I'm confused about
   chosing between Jquery or Scriptalious? Which one should I choose?
   Does it really matter? What's the differences between them?
 
   tks
 



-- 
Anupom Syam
http://syamantics.com/

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



Re: Whats the best idea to keep DB under version control or under sync with server?

2008-10-31 Thread Abhimanyu Grover

Joel, what advantages will cakephp-migrations provide over schema
shell?

On Oct 31, 2:31 pm, joelmoss [EMAIL PROTECTED] wrote:
 Take a look at this guys:http://code.google.com/p/cakephp-migrations/

 On Oct 31, 12:42 am, Abhimanyu Grover [EMAIL PROTECTED] wrote:

  I posted a small tutorial on same:

 http://www.gigapromoters.com/blog/2008/10/30/how-to-keep-your-databas...

  Hoping it will help others.

  On Oct 30, 5:36 pm, Joel Perras [EMAIL PROTECTED] wrote:

   Take a look at the built-in Cake schema shell.

   $ cake schema help

   -J.

   On Oct 30, 8:21 am, Abhimanyu Grover [EMAIL PROTECTED] wrote:

I'm sorry this is not Cake related, but I feel its something which
most of developers are missing. I found info about Cake migrations and
think it would be too difficult to implement it in my team in short
time. What tools or techniques are you using to overcome this problem?

I'm aware of a tool called SqlYog or something, which is capable of
keeping database structured sync'ed from dev. machine to server, but
its paid, and I'm looking for some open source alternative, maybe a
simple PHP script or something. Please let me know what do you guys
use and recommend for a small team?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Fatal error Call to undefined method Controller Html()

2008-10-31 Thread Malcolm Krugger

I have this

var $helpers = array('Html', 'Form', 'Captcha');

and now when I use


$this-Captcha-show();  IT works perfectly..No issues there

but when I use something like

$this-Html('title' , '');

The error given is

Fatal error: Call to undefined method UsersController::Html()

So what could be causing this error ?

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



Re: Question about Data Sanitation in CAKEPHP

2008-10-31 Thread Dardo Sordi Bogado

 If I would sanitaze my input from javascript code?

No, you need to escape whenever you send dynamic content to de user
(though the form helper will escape the inputs values), use the
builtin h() function.

echo h($comment['Comment']['content']);

If you want to strip the tags or other bad content and avoid it from
beign stored (they will be escaped by the dbo layer but will get
inserted in the db anyway) you need to use Sanitize::clean() or
Sanitize::stripWhat() where what is any of Tags, Images, Scripts,
Whitespace, All.

HTH,
- Dardo Sordi.


 On 30 Ott, 18:57, Gwoo [EMAIL PROTECTED] wrote:
 The DBO layer handles proper escaping of your data to prevent SQL
 injection. You do not need to use Sanitize unless you are doing
 something out of the ordinary.
 


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



Re: Question about Data Sanitation in CAKEPHP

2008-10-31 Thread [EMAIL PROTECTED]

Ok Many Thanks

On 31 Ott, 11:29, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  If I would sanitaze my input from javascript code?

 No, you need to escape whenever you send dynamic content to de user
 (though the form helper will escape the inputs values), use the
 builtin h() function.

 echo h($comment['Comment']['content']);

 If you want to strip the tags or other bad content and avoid it from
 beign stored (they will be escaped by the dbo layer but will get
 inserted in the db anyway) you need to use Sanitize::clean() or
 Sanitize::stripWhat() where what is any of Tags, Images, Scripts,
 Whitespace, All.

 HTH,
 - Dardo Sordi.



  On 30 Ott, 18:57, Gwoo [EMAIL PROTECTED] wrote:
  The DBO layer handles proper escaping of your data to prevent SQL
  injection. You do not need to use Sanitize unless you are doing
  something out of the ordinary.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Fatal error Call to undefined method Controller Html()

2008-10-31 Thread dr. Hannibal Lecter

Helpers are not meant to be used in a controller, they are used in
your views/layouts/elements.

Could it be that you also have a component called Captcha? If you do,
that's the reason why $this-Captcha-show(); doesn't crash, but $this-
Html('title' , ''); does.

On Oct 31, 1:15 pm, Malcolm Krugger [EMAIL PROTECTED]
wrote:
 I have this

 var $helpers = array('Html', 'Form', 'Captcha');

 and now when I use

 $this-Captcha-show();  IT works perfectly..No issues there

 but when I use something like

 $this-Html('title' , '');

 The error given is

 Fatal error: Call to undefined method UsersController::Html()

 So what could be causing this error ?

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



Re: Post Data

2008-10-31 Thread Gabriel Gilini
Are you building your form with the Form Helper? Because it seems to me that
there are no naming conventions at all there.

Cheers

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Fri, Oct 31, 2008 at 9:46 AM, MDB [EMAIL PROTECTED] wrote:


 The form values do not show up when I do that, they do when I do a
 debug($this) and appear like this:

 [form] = Array
(
[Test1] = 04
[Test2] = 05
)

 How do I access these values?
 I have tried $this-form and $_POST['Test1'] however I always get an
 undefined index or property error.




 On Oct 30, 9:21 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
  add debug($this-data); to your controller that is receiving the
  submitted data. It will display the structure of $this-data
 
  On Oct 30, 6:59 am, MDB [EMAIL PROTECTED] wrote:
 
 
 
   How do you get form data that is not part of a controller?  I have a
   select / drop down box called dobDay, then in the controller, I have
   tried $this-data['dobDay'], $_POST['dobDay'] and
 $this-data['Customer']['dobDay'] (customer = name of form) and nothing
 
   works.  Can someone please help? TIA- Hide quoted text -
 
  - Show quoted text -
 


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Marcelius

@Anupom: Any arguments?

Anupom schreef:
 I think PHP helper for writing Javascript is a very bad idea.

 On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

 
  Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
  Helper, I find JQuery so much easier to use that you don't really need
  a helper.
 
  On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
  wrote:
   jQuery .
  
   On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
  
Hello,
  
I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?
  
tks
  
 


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Gabriel Gilini
Looks like I'm the only one who loves prototype here :)

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Fri, Oct 31, 2008 at 10:27 AM, Marcelius [EMAIL PROTECTED] wrote:


 @Anupom: Any arguments?

 Anupom schreef:
  I think PHP helper for writing Javascript is a very bad idea.
 
  On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:
 
  
   Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
   Helper, I find JQuery so much easier to use that you don't really need
   a helper.
  
   On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
   wrote:
jQuery .
   
On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
   
 Hello,
   
 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?
   
 tks
   
  
 
 
  --
  Anupom Syam
  http://syamantics.com/
 


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



Re: Fatal error Call to undefined method Controller Html()

2008-10-31 Thread Malcolm Krugger

Perfect

Yes I have a component called Captcha

Oh silly me !


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



The Cake way of doing this? Multiple models accessing a huge dataset

2008-10-31 Thread Skal Tura

I am wondering did i chose the Cake way of doing things with this, or
atleast close :)

We have multiple models, all of which access same set of tables
handling massive amounts of data, searched using fulltext indexes.
There's additions, searches, modifies etc. from 2 different models, ah
but there's a gotcha! Most of these searches are slightly different,
along with some of the inserts.

So what i opted to do about handling this dataset is build an
component used by the controllers. This component rarely contacts the
model, and only one of the models for some assisting functions for
some metadata to attach to the actual dataset.

Is the component way the cake way to do something like this?

Different main search types is 4, with variations for 2 different
models.
Different inserts 1 with 2 variations.
Modifying pages 1. (Same form and everything, just some data used to
check to which model uses that data)

So i've done a simple component with a helper class to handle all of
that :)

Using cake 1.1

Main goal when i code is to get short, simple pieces of code together.

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



Re: Post Data

2008-10-31 Thread MDB

Maybe if I explain what I am doing better.  Basically, I have a form
that asks for a birthday.  We do not want the users to feel
uncomfortable by asking for thier year of birth so I have two drop
down boxes, one for the month (select name='PostDobmonth'
id='PostDobmonth') and one for the year (select name='PostDobday' id
= 'PostDobday' ).  Then since the  DB field is a date, I and creating
a default year by doing this:

$this-data['Customer']['dob'] = '1901'.$this-
form['PostDobmonth'].'-'.$_POST['PostDobday'];

What is the correct format or way to use the form help and dropdown
boxes like this?

Thanks


On Oct 31, 8:25 am, Gabriel Gilini [EMAIL PROTECTED] wrote:
 Are you building your form with the Form Helper? Because it seems to me that
 there are no naming conventions at all there.

 Cheers

 Gabriel Gilini

 www.usosim.com.br
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]



 On Fri, Oct 31, 2008 at 9:46 AM, MDB [EMAIL PROTECTED] wrote:

  The form values do not show up when I do that, they do when I do a
  debug($this) and appear like this:

  [form] = Array
                 (
                     [Test1] = 04
                     [Test2] = 05
                 )

  How do I access these values?
  I have tried $this-form and $_POST['Test1'] however I always get an
  undefined index or property error.

  On Oct 30, 9:21 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
   add debug($this-data); to your controller that is receiving the
   submitted data. It will display the structure of $this-data

   On Oct 30, 6:59 am, MDB [EMAIL PROTECTED] wrote:

How do you get form data that is not part of a controller?  I have a
select / drop down box called dobDay, then in the controller, I have
tried $this-data['dobDay'], $_POST['dobDay'] and
  $this-data['Customer']['dobDay'] (customer = name of form) and nothing

works.  Can someone please help? TIA- Hide quoted text -

   - Show quoted text -- Hide quoted text -

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



Re: Fatal error Call to undefined method Controller Html()

2008-10-31 Thread Malcolm Krugger

?php echo $html-link('Activate  account',
array('controller'='users', 'action' = 'activate', $userid); ?

The above works perfect except the fact that it is not the absolute
URL

$userid by the way is a raw parameter which I want to pass to an
action

Is there a way the above can be used to print out an absolute url ?

Thanks again


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



Re: Fatal error Call to undefined method Controller Html()

2008-10-31 Thread dr. Hannibal Lecter

Try putting 'full_base' = true to your url array.

I haven't tried this myself, but if I'm reading the source right, it
should work.

Hope that helps!

On Oct 31, 2:21 pm, Malcolm Krugger [EMAIL PROTECTED]
wrote:
 ?php echo $html-link('Activate  account',
 array('controller'='users', 'action' = 'activate', $userid); ?

 The above works perfect except the fact that it is not the absolute
 URL

 $userid by the way is a raw parameter which I want to pass to an
 action

 Is there a way the above can be used to print out an absolute url ?

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



Re: Fatal error Call to undefined method Controller Html()

2008-10-31 Thread Rafael Bandeira aka rafaelbandeira3

 ?php echo $html-link('Activate  account',
 array('controller'='users', 'action' = 'activate', $userid); ?
 
^
it's missing a close bracket here -^

anyway:

 Is there a way the above can be used to print out an absolute url ?

$html-link('Activate  account', $html-
url(array('controller'='users', 'action' = 'activate', $userid),
true));
or
$html-link('Activate  account',
Helper::url(array('controller'='users', 'action' = 'activate',
$userid), true));
or
$html-link('Activate  account',
Router::url(array('controller'='users', 'action' = 'activate',
$userid), true));

-the boring explanation:
  you can use Router::url/Helper::url passing true as the second param
to get the full route out of the url you passed in the first param.
  in case you ever extend Helper::url on AppHelper, use $html-url()
to use the overrided method.

LAST BUT CERTAINLY NOT LEAST,
CakePHP has documentation and API specifications that cover this
feature, please refer to http://api.cakephp.org and http://manual.cakephp.org
as often as possible to get in touch with all the features, power and
might and magic of CakePHP.

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Josey

I perfer jQuery as well.
Many Bakers like prototype due to the javascript and ajax helpers that
come with CakePHP.
These make baking with JS quite a bit easier, not to mention faster
however many Javascript experts would cringe to think that developers
are using php helpers for the behavioral portion of their sites
because the scripts are no longer unobtrusive.

jQuery is very easy to learn and uses many of the same selectors that
CSS 2 and 3 use making it incredibly easy to develop around.
However, if you require a JS helper there is a jQuery helper for
CakePHP called pQuery.
http://www.ngcoders.com/php/pquery-php-and-jquery

If not then spend some time at the jQuery API and read through the
tutorials.
http://docs.jquery.com/Main_Page

I love jQuery.

On Oct 30, 5:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 Hello,

 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?

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



Re: Test Suite and HABTM Models - Not Working

2008-10-31 Thread MikeB

Thanks Anupom,

That got me past the missing table cake errors, but now 2/3 of the
tests that cake generated are failing.

Here is my post.test.php

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


class PostTestCase extends CakeTestCase {
var $Post = null;
var $fixtures = array('app.post');

function start() {
parent::start();
$this-Post =  ClassRegistry::init('Post');
}

function testPostInstance() {
$this-assertTrue(is_a($this-Post, 'Post'));
}

function testPostFind() {
$results = $this-Post-recursive = -1;
$results = $this-Post-find('first');
$this-assertTrue(!empty($results));

$expected = array('Post' = array(
'id'  = 1,
'name'  = 'Lorem ipsum dolor sit amet'
));
$this-assertEqual($results, $expected);
}
}

The two cases that fail both reference testPostFind(). After a little
poking around, $this-Post-find('first') does not return anything at
all. The sql queries insert my data from the fixture and truncate it 3
times before finally dropping the tables. However, the query that I
believe is being generated from find('first') is being run on my
default connection, as opposed to the test connection. Shouldn't this
query be run on the test database since that's where the dummy data is
being inserted?

Any help is appreciated.



On Oct 31, 12:48 am, Anupom [EMAIL PROTECTED] wrote:
 Hi Mike,

 I think the RC3 bake script still generates old style code, like the
 following -

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

 class TestPost extends Post {
     var $cacheSources = false;
     var $useDbConfig  = 'test_suite';

 }

 class PostTestCase extends CakeTestCase {
     var $Post = null;
     var $fixtures = array('app.post', 'app.tag');

     function start() {
         parent::start();
         $this-Post = new TestPost();
     }
 .
 .
 .

 Unfortunately this old style is redundant and does not work with
 associations (without some hacks). But GOOD news is that - Tim and Nate have
 come up with an even better solution and that works with associations
 flawlessly. Edit your test files and make it like the following - it's gonna
 work like a charm.

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

 class PostTestCase extends CakeTestCase {
     var $Post = null;
     var $fixtures = array('app.post', 'app.tag');

     function start() {
         parent::start();
         $this-Post = ClassRegistry::init('Post');
     }
 .
 .
 .

 Read Tim's blog on this for more 
 info.http://debuggable.com/posts/testing-models-in-cakephp---now-let%27s-g...



 On Fri, Oct 31, 2008 at 3:18 AM, MikeB [EMAIL PROTECTED] wrote:

  I'm having a problem with the Cake Test Suite throwing errors about
  HABTM join tables not being found. I've successfully recreated the
  problem on a much smaller scale.

  I've created a very basic 3 table database:

  posts (id, name)
  posts_tags (post_id, tag_id)
  tags (id, name)

  I've baked each model without incident. When I go to test.php and try
  to run the post.test.php test that was generated for me, it gives me
  this error:

  Error:  Database table posts_tags for model PostsTag was not found.

  I'm using a default AND test db connection.
  Cake 1.2 rc3
  CakePHP Test Suite v 1.2.0.0
  SimpleTest v1.0.1

  Keep in mind that I have not touched any of these files. They are all
  freshly baked out the oven.

  Any ideas?

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



Re: The Cake way of doing this? Multiple models accessing a huge dataset

2008-10-31 Thread Adam Royle

Well without any real examples it's hard to tell what you're doing.
However I think most people would recommend you should do more inside
your models. Components should just be to help out controllers with
requests.

On Oct 31, 9:41 pm, Skal Tura [EMAIL PROTECTED] wrote:
 I am wondering did i chose the Cake way of doing things with this, or
 atleast close :)

 We have multiple models, all of which access same set of tables
 handling massive amounts of data, searched using fulltext indexes.
 There's additions, searches, modifies etc. from 2 different models, ah
 but there's a gotcha! Most of these searches are slightly different,
 along with some of the inserts.

 So what i opted to do about handling this dataset is build an
 component used by the controllers. This component rarely contacts the
 model, and only one of the models for some assisting functions for
 some metadata to attach to the actual dataset.

 Is the component way the cake way to do something like this?

 Different main search types is 4, with variations for 2 different
 models.
 Different inserts 1 with 2 variations.
 Modifying pages 1. (Same form and everything, just some data used to
 check to which model uses that data)

 So i've done a simple component with a helper class to handle all of
 that :)

 Using cake 1.1

 Main goal when i code is to get short, simple pieces of code together.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with ACL

2008-10-31 Thread Stinkbug

Well, so much for an answer soon.  Sorry about that.  Not sure if you
still need help with this, but could you show us your aro and aco
structures so I get get a better idea as to what you're trying to do.

I think I see what you're trying to do, but let's see if you have a
proper ACl setup first.

On Oct 24, 5:45 am, jst4fun [EMAIL PROTECTED] wrote:
 Well I had gone through the links which you guys had provided. Thanks.
 But the issue for me to implement an ACL is that I am not sure what
 all function should be used due to the lack of documentation. One of
 the requirement is already discussed above. I think I was able to
 implement it partially. What I did was to create three tables one
 offices, groups and then users.I created parentNode() for group
 binding it to the office model and in users binding every users to
 group model. Now when I create a Group and select an office it is
 correctly created in aros table. Same with the users too. I found a
 script from cakebaker to list all controllers and save it as acos. Now
 I have aros and acos setup. In my application a superadmin can add new
 user, group and offices dynamically. This part i guess is already
 solved, thanks to parentNode(). When the super admin takes the add
 group page all the controllers with their actions are also displayed
 in that page. Actions will be having checkboxes to enable or disable
 that action to the user of that group. So my first doubt is
 1) How is it possible to save a group and then its associated
 permissions dynamically?
 Then definitely the admin might have to delete a office or a group. In
 such a case
 2) How is it possible to delete all the office and its group and
 remove the deleted group information from the users .
 I hope I have made everything clear and hope to get a reply soon.
 Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Jquery or Scriptalicious?

2008-10-31 Thread teknoid

 I think PHP helper for writing Javascript is a very bad idea.

I would say it depends on the purpose...

Let's take an example of AJAX form validation, why not have $form-
input() transparently supply jquery hooks to make it happen?
The developer might only be concerned with including the library (and
plugin), and even that can happen by doing $javascript-
jquery('formValidation');


On Oct 31, 5:26 am, Anupom [EMAIL PROTECTED] wrote:
 I think PHP helper for writing Javascript is a very bad idea.



 On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

  Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
  Helper, I find JQuery so much easier to use that you don't really need
  a helper.

  On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
  wrote:
   jQuery .

   On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

Hello,

I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?

tks

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Dérico Filho

JQuery has more available animation plugins than Scriptaculous
+Prototype.js

Although JQuery has a compatibility mode, which permits it to live
in the same room with Prototacolous.

DF.

On Oct 30, 8:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 Hello,

 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?

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



Re: Position of label on checkbox inputs

2008-10-31 Thread teknoid

Why?

You could use $form-checkbox();
or simply: This is my field: ?php echo $form-input('something',
array('label'=false, 'type'='checkbox')); ?


On Oct 31, 5:52 am, Tom Singer [EMAIL PROTECTED] wrote:
 Hi,

 Is there a reason $out is appended to the end in form-input when
 $type is set to checkbox? This behaviour is different to all the other
 types which place label before the input and is causing me issues with
 my layout. I can fix this by moving the out variable between $before
 and the checkbox but i don't want to do this if $out is at the end by
 design and this will break something. I have had no issues so far but
 this may break somethign i have not come across yet.

 I am using version 1.2.0.7296 RC2

 Thanks,

 Tom

 [EMAIL PROTECTED]:~/jobzone$ git diff cake/libs/view/helpers/form.php
 diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
 form.php
 index 33639b2..35d06c6 100644
 --- a/cake/libs/view/helpers/form.php
 +++ b/cake/libs/view/helpers/form.php
 @@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
                                 unset($divOptions);
                         break;
                         case 'checkbox':
 -                               $out = $before . $this-checkbox($fieldName, 
 $options) . $between . $out;

 +                               $out = $before . $out . 
 $this-checkbox($fieldName, $options) . $between;

                         break;
                         case 'radio':
                                 $out = $before . $out . $this-

 radio($fieldName, $radioOptions, $options) . $between;


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



Re: Post Data

2008-10-31 Thread MDB

I figured out the correct name convention.  Thanks


On Oct 31, 8:52 am, MDB [EMAIL PROTECTED] wrote:
 Maybe if I explain what I am doing better.  Basically, I have a form
 that asks for a birthday.  We do not want the users to feel
 uncomfortable by asking for thier year of birth so I have two drop
 down boxes, one for the month (select name='PostDobmonth'
 id='PostDobmonth') and one for the year (select name='PostDobday' id
 = 'PostDobday' ).  Then since the  DB field is a date, I and creating
 a default year by doing this:

 $this-data['Customer']['dob'] = '1901'.$this-

 form['PostDobmonth'].'-'.$_POST['PostDobday'];

 What is the correct format or way to use the form help and dropdown
 boxes like this?

 Thanks

 On Oct 31, 8:25 am, Gabriel Gilini [EMAIL PROTECTED] wrote:



  Are you building your form with the Form Helper? Because it seems to me that
  there are no naming conventions at all there.

  Cheers

  Gabriel Gilini

 www.usosim.com.br
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]

  On Fri, Oct 31, 2008 at 9:46 AM, MDB [EMAIL PROTECTED] wrote:

   The form values do not show up when I do that, they do when I do a
   debug($this) and appear like this:

   [form] = Array
                  (
                      [Test1] = 04
                      [Test2] = 05
                  )

   How do I access these values?
   I have tried $this-form and $_POST['Test1'] however I always get an
   undefined index or property error.

   On Oct 30, 9:21 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
add debug($this-data); to your controller that is receiving the
submitted data. It will display the structure of $this-data

On Oct 30, 6:59 am, MDB [EMAIL PROTECTED] wrote:

 How do you get form data that is not part of a controller?  I have a
 select / drop down box called dobDay, then in the controller, I have
 tried $this-data['dobDay'], $_POST['dobDay'] and
   $this-data['Customer']['dobDay'] (customer = name of form) and nothing

 works.  Can someone please help? TIA- Hide quoted text -

- Show quoted text -- Hide quoted text -

  - Show quoted text -- Hide quoted text -

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread 703designs

I agree in most cases. JavaScript code should be unobtrusive and only
be written once, especially when already using a framework (like
jQuery). I can almost see the value in generating widgets, but really
the only thing that Cake should do is provide utility scripts and use
naming conventions (FormHelper could use CSS classes that validation
scripts target, etc.). Does JavaScriptHelper actually generate JS
code? I've never used it because I use jQuery and write all of my own
scripts.

Thomas

On Oct 31, 6:18 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 I think Jquery is better, based purely in that it's so easy and
 intuitive to use/extend that you will need no helper.

 On Fri, Oct 31, 2008 at 7:26 AM, Anupom [EMAIL PROTECTED] wrote:
  I think PHP helper for writing Javascript is a very bad idea.

  On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

  Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
  Helper, I find JQuery so much easier to use that you don't really need
  a helper.

  On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
  wrote:
   jQuery .

   On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

Hello,

I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?

tks

  --
  Anupom Syam
 http://syamantics.com/


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Anupom
On Fri, Oct 31, 2008 at 6:27 PM, Marcelius [EMAIL PROTECTED] wrote:

@Anupom: Any arguments?

Anupom schreef:
 I think PHP helper for writing Javascript is a very bad idea.


Find my points below,

It minimizes the code but maximizes the chance of error
It's really becomes hard to debug
We should write unobtrusive Javascript
In almost 99% cases we need to write custom JS logics. Unfortunately we cant
write it using PHP.
Most of the PHP devs know or should know how to write Javascript. At least
what those helpers can do - it's easy man!
JS itself is not that hard that, any PHP dev should be able learn it quickly
JS libraries are very easy to learn as well
It becomes hard to manage/modify or extend
If you really want to use cool JS stuffs and you think you cant - then I
would recommend you to hire a JS Ninja or become one. It will be far better
than writing PHP to output JS.
JS libraries are their to minimize your effort, maximize reusability
 Why do we need to use PHP?
Less control, less flexibility. and we are getting almost nothing good
in return.
And I can tell you some more points, if you really want to know.

I would rather ask you what's the benefit of using PHP to output Javascript?
To me still it's really a weird idea!


 On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:
 
  
   Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
   Helper, I find JQuery so much easier to use that you don't really need
   a helper.
  
   On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
   wrote:
jQuery .
   
On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:
   
 Hello,
   
 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?
   
 tks
   
  
 
 
  --
  Anupom Syam
  http://syamantics.com/
 



-- 
Anupom Syam
http://syamantics.com/ http://www.anupom.wordpress.com/

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



Re: Position of label on checkbox inputs

2008-10-31 Thread Jacek Ziółkowski

Yeah, that's a correct assumption when using checkboxes in separate 
rows. I got the same issue, because my project uses several checkboxes 
in a single line - it makes confusion, i.e.
[X] C [X] M [_] Y [_] K

looks dumb and nonsensical.
I was thinking of extending the $form-checkbox helper with an option to 
alter this, but the method posted by teknoid is much much better due to 
its readability and complete lack of coding needed.

My field: $form-checkbox(...) with label set to false works best.

grigri pisze:
 It is common practice to have labels for most form elements before
 (above or to the left of) the element itself, except for radio buttons
 and checkboxes, where the norm is for the label to be on the right.

 [x] Bacon
 [x] Eggs
 [x] Sausages

 easier to read than

 Bacon [x]
 Eggs [x]
 Sausages [x]

 I've never had a problem styling forms with the standard form helper
 methods.

 (On an unrelated note, are there any collections of CSS files for
 cakephp forms? Might be a handy resource to create one. The bakery
 style is ok, but a drop-in solution for columnar forms that work
 directly with the form helper would be cool. A sort of CSS Cake
 Garden if you will.)

 hth
 grigri

 On Oct 31, 9:52 am, Tom Singer [EMAIL PROTECTED] wrote:
   
 Hi,

 Is there a reason $out is appended to the end in form-input when
 $type is set to checkbox? This behaviour is different to all the other
 types which place label before the input and is causing me issues with
 my layout. I can fix this by moving the out variable between $before
 and the checkbox but i don't want to do this if $out is at the end by
 design and this will break something. I have had no issues so far but
 this may break somethign i have not come across yet.

 I am using version 1.2.0.7296 RC2

 Thanks,

 Tom

 [EMAIL PROTECTED]:~/jobzone$ git diff cake/libs/view/helpers/form.php
 diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
 form.php
 index 33639b2..35d06c6 100644
 --- a/cake/libs/view/helpers/form.php
 +++ b/cake/libs/view/helpers/form.php
 @@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
 unset($divOptions);
 break;
 case 'checkbox':
 -   $out = $before . $this-checkbox($fieldName, 
 $options) . $between . $out;

 +   $out = $before . $out . 
 $this-checkbox($fieldName, $options) . $between;

 break;
 case 'radio':
 $out = $before . $out . $this-

 
 radio($fieldName, $radioOptions, $options) . $between;
   
 

   


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



Re: Test Suite and HABTM Models - Not Working

2008-10-31 Thread MikeB

Fixed it!

I grabbed the nightly build for 1.2.x.x_31.10.2008 and everything is
going smoothly now. Thanks for the suggestions and link Anupom.

On Oct 31, 9:50 am, MikeB [EMAIL PROTECTED] wrote:
 Thanks Anupom,

 That got me past the missing table cake errors, but now 2/3 of the
 tests that cake generated are failing.

 Here is my post.test.php

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

 class PostTestCase extends CakeTestCase {
         var $Post = null;
         var $fixtures = array('app.post');

         function start() {
                 parent::start();
                 $this-Post =  ClassRegistry::init('Post');
         }

         function testPostInstance() {
                 $this-assertTrue(is_a($this-Post, 'Post'));
         }

         function testPostFind() {
                 $results = $this-Post-recursive = -1;
                 $results = $this-Post-find('first');
                 $this-assertTrue(!empty($results));

                 $expected = array('Post' = array(
                         'id'  = 1,
                         'name'  = 'Lorem ipsum dolor sit amet'
                         ));
                 $this-assertEqual($results, $expected);
         }

 }

 The two cases that fail both reference testPostFind(). After a little
 poking around, $this-Post-find('first') does not return anything at
 all. The sql queries insert my data from the fixture and truncate it 3
 times before finally dropping the tables. However, the query that I
 believe is being generated from find('first') is being run on my
 default connection, as opposed to the test connection. Shouldn't this
 query be run on the test database since that's where the dummy data is
 being inserted?

 Any help is appreciated.

 On Oct 31, 12:48 am, Anupom [EMAIL PROTECTED] wrote:

  Hi Mike,

  I think the RC3 bake script still generates old style code, like the
  following -

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

  class TestPost extends Post {
      var $cacheSources = false;
      var $useDbConfig  = 'test_suite';

  }

  class PostTestCase extends CakeTestCase {
      var $Post = null;
      var $fixtures = array('app.post', 'app.tag');

      function start() {
          parent::start();
          $this-Post = new TestPost();
      }
  .
  .
  .

  Unfortunately this old style is redundant and does not work with
  associations (without some hacks). But GOOD news is that - Tim and Nate have
  come up with an even better solution and that works with associations
  flawlessly. Edit your test files and make it like the following - it's gonna
  work like a charm.

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

  class PostTestCase extends CakeTestCase {
      var $Post = null;
      var $fixtures = array('app.post', 'app.tag');

      function start() {
          parent::start();
          $this-Post = ClassRegistry::init('Post');
      }
  .
  .
  .

  Read Tim's blog on this for more 
  info.http://debuggable.com/posts/testing-models-in-cakephp---now-let%27s-g...

  On Fri, Oct 31, 2008 at 3:18 AM, MikeB [EMAIL PROTECTED] wrote:

   I'm having a problem with the Cake Test Suite throwing errors about
   HABTM join tables not being found. I've successfully recreated the
   problem on a much smaller scale.

   I've created a very basic 3 table database:

   posts (id, name)
   posts_tags (post_id, tag_id)
   tags (id, name)

   I've baked each model without incident. When I go to test.php and try
   to run the post.test.php test that was generated for me, it gives me
   this error:

   Error:  Database table posts_tags for model PostsTag was not found.

   I'm using a default AND test db connection.
   Cake 1.2 rc3
   CakePHP Test Suite v 1.2.0.0
   SimpleTest v1.0.1

   Keep in mind that I have not touched any of these files. They are all
   freshly baked out the oven.

   Any ideas?

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



ajax form submission - nothing happens

2008-10-31 Thread Kieron

Hi,

I am trying to add a comments form to a blog post, updating the page
with ajax, specifically using prototype.js.
I've used ajax-form, however when I press the submit button
absolutely nothing happens.
I've tried the ajax submit method with the same result. If I submit
the form without ajax it works fine.

my view code is as follows:

echo $ajax-form('/comments/
add','post',array('update'='comments','url'='/comments/add'));
echo $form-input('Comment.name');
echo $form-input('Comment.content');
echo $form-
input('Comment.post_id',array('type'='hidden','value'=$post['Post']
['id']));
echo $form-end('Add Comment');

the add action in the comments controller is as follows:

function add() {
if (!empty($this-data)) {
$this-Comment-create();
if ($this-Comment-save($this-data)) {
$comments = $this-Comment-
find('all',array('conditions'=array('post_id'=$this-data['Comment']
['post_id']),'recursive'=-1));
$this-set(compact('comments'));
$this-render('add_success','ajax');
} else {
$this-render('add_failure', 'ajax');
}
}
}

and the created source is as follows:

  div id=comments
form id=form283226270 onsubmit=event.returnValue = false;
return false; method=post action=/blog/comments/add
fieldset style=display:none;
  input type=hidden name=_method value=POST /
/fieldset
script type=text/javascript
//![CDATA[
Event.observe('form283226270', 'submit', function(event) { new
Ajax.Updater('comments','/blog/comments/add', {asynchronous:true,
evalScripts:true, parameters:Form.serialize('form283226270'),
requestHeaders:['X-Update', 'comments']}) }, false);
//]]
/script
div class=input text
  label for=CommentNameName/label
  input name=data[Comment][name] type=text maxlength=100
value= id=CommentName /
/div
div class=input textarea
  label for=CommentContentContent/label
  textarea name=data[Comment][content] cols=30 rows=6
id=CommentContent /textarea
/div
input type=hidden name=data[Comment][post_id] value=7
id=CommentPostId/
div class=submit
  input type=submit value=Add Comment /
/div
/form
  /div

Does anyone know what might be wrong?

I'd appreciate any feedback as I've spent a whole day trying to solve
this and have no desire to quit the whole cakephp thing over something
like this!

Thanks
Kieron.

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Josey

I think we've moved off topic since the question wasn't about helpers,
though I agree 100% with Anupom.
It seems that the majority prefer jQuery but it's just that, a
preference.

I also agree with Flipflops. You should visit the official site of
both libraries and do a bit of research and testing for yourself.
Prototype has more widgets or plugins built by 3rd parties but jQuery
seems to be one of the fastest growing and many, including myself,
consider it the easiest to use with the smallest learning curve.

On Oct 31, 10:01 am, Anupom [EMAIL PROTECTED] wrote:
 On Fri, Oct 31, 2008 at 6:27 PM, Marcelius [EMAIL PROTECTED] wrote:

 @Anupom: Any arguments?

 Anupom schreef:

  I think PHP helper for writing Javascript is a very bad idea.

 Find my points below,

 It minimizes the code but maximizes the chance of error
 It's really becomes hard to debug
 We should write unobtrusive Javascript
 In almost 99% cases we need to write custom JS logics. Unfortunately we cant
 write it using PHP.
 Most of the PHP devs know or should know how to write Javascript. At least
 what those helpers can do - it's easy man!
 JS itself is not that hard that, any PHP dev should be able learn it quickly
 JS libraries are very easy to learn as well
 It becomes hard to manage/modify or extend
 If you really want to use cool JS stuffs and you think you cant - then I
 would recommend you to hire a JS Ninja or become one. It will be far better
 than writing PHP to output JS.
 JS libraries are their to minimize your effort, maximize reusability
  Why do we need to use PHP?
 Less control, less flexibility. and we are getting almost nothing good
 in return.
 And I can tell you some more points, if you really want to know.

 I would rather ask you what's the benefit of using PHP to output Javascript?
 To me still it's really a weird idea!



  On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
Helper, I find JQuery so much easier to use that you don't really need
a helper.

On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
wrote:
 jQuery .

 On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

  Hello,

  I'm gonna create a web app using CakePHP but I'm confused about
  chosing between Jquery or Scriptalious? Which one should I choose?
  Does it really matter? What's the differences between them?

  tks

   --
   Anupom Syam
  http://syamantics.com/

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



Re: Test Suite and HABTM Models - Not Working

2008-10-31 Thread Anupom
Cool! I was just about to suggest you to checkout the latest version from
SVN or download the latest build! :)

On Fri, Oct 31, 2008 at 9:25 PM, MikeB [EMAIL PROTECTED] wrote:


 Fixed it!

 I grabbed the nightly build for 1.2.x.x_31.10.2008 and everything is
 going smoothly now. Thanks for the suggestions and link Anupom.

 On Oct 31, 9:50 am, MikeB [EMAIL PROTECTED] wrote:
  Thanks Anupom,
 
  That got me past the missing table cake errors, but now 2/3 of the
  tests that cake generated are failing.
 
  Here is my post.test.php
 
  App::import('Model', 'Post');
 
  class PostTestCase extends CakeTestCase {
  var $Post = null;
  var $fixtures = array('app.post');
 
  function start() {
  parent::start();
  $this-Post =  ClassRegistry::init('Post');
  }
 
  function testPostInstance() {
  $this-assertTrue(is_a($this-Post, 'Post'));
  }
 
  function testPostFind() {
  $results = $this-Post-recursive = -1;
  $results = $this-Post-find('first');
  $this-assertTrue(!empty($results));
 
  $expected = array('Post' = array(
  'id'  = 1,
  'name'  = 'Lorem ipsum dolor sit amet'
  ));
  $this-assertEqual($results, $expected);
  }
 
  }
 
  The two cases that fail both reference testPostFind(). After a little
  poking around, $this-Post-find('first') does not return anything at
  all. The sql queries insert my data from the fixture and truncate it 3
  times before finally dropping the tables. However, the query that I
  believe is being generated from find('first') is being run on my
  default connection, as opposed to the test connection. Shouldn't this
  query be run on the test database since that's where the dummy data is
  being inserted?
 
  Any help is appreciated.
 
  On Oct 31, 12:48 am, Anupom [EMAIL PROTECTED] wrote:
 
   Hi Mike,
 
   I think the RC3 bake script still generates old style code, like the
   following -
 
   App::import('Model', 'Post');
 
   class TestPost extends Post {
   var $cacheSources = false;
   var $useDbConfig  = 'test_suite';
 
   }
 
   class PostTestCase extends CakeTestCase {
   var $Post = null;
   var $fixtures = array('app.post', 'app.tag');
 
   function start() {
   parent::start();
   $this-Post = new TestPost();
   }
   .
   .
   .
 
   Unfortunately this old style is redundant and does not work with
   associations (without some hacks). But GOOD news is that - Tim and Nate
 have
   come up with an even better solution and that works with associations
   flawlessly. Edit your test files and make it like the following - it's
 gonna
   work like a charm.
 
   App::import('Model', 'Post');
 
   class PostTestCase extends CakeTestCase {
   var $Post = null;
   var $fixtures = array('app.post', 'app.tag');
 
   function start() {
   parent::start();
   $this-Post = ClassRegistry::init('Post');
   }
   .
   .
   .
 
   Read Tim's blog on this for more info.
 http://debuggable.com/posts/testing-models-in-cakephp---now-let%27s-g...
 
   On Fri, Oct 31, 2008 at 3:18 AM, MikeB [EMAIL PROTECTED] wrote:
 
I'm having a problem with the Cake Test Suite throwing errors about
HABTM join tables not being found. I've successfully recreated the
problem on a much smaller scale.
 
I've created a very basic 3 table database:
 
posts (id, name)
posts_tags (post_id, tag_id)
tags (id, name)
 
I've baked each model without incident. When I go to test.php and try
to run the post.test.php test that was generated for me, it gives me
this error:
 
Error:  Database table posts_tags for model PostsTag was not found.
 
I'm using a default AND test db connection.
Cake 1.2 rc3
CakePHP Test Suite v 1.2.0.0
SimpleTest v1.0.1
 
Keep in mind that I have not touched any of these files. They are all
freshly baked out the oven.
 
Any ideas?
 
   --
   Anupom Syamhttp://syamantics.com/
 



-- 
Anupom Syam
TrippertLabs, Dhaka
http://www.anupom.wordpress.com/

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



Re: The Cake way of doing this? Multiple models accessing a huge dataset

2008-10-31 Thread Skal Tura

Doing those tasks inside model seemed messy way to it.
We have multiple models accessing portions of the data.

Thought i showed quite clearly what this is upto :)

So we have a text search engine, every snippet of text can have
multiple boolean type of modes, such as: removed and verified along
others.
Texts are in UTF8 because some is in normal latin1 charset, some are
russian or japanese. Therefore we have a field for romanised text
(normal alphabetic).

That data is searched, used, and modified by multiple different
models, using slightly different criterias.

There is 3 different models currently utilizing this component in a
way or an another. Every one of those models uses that component
differently, to output completely different things, from the same
data.

On Oct 31, 3:54 pm, Adam Royle [EMAIL PROTECTED] wrote:
 Well without any real examples it's hard to tell what you're doing.
 However I think most people would recommend you should do more inside
 your models. Components should just be to help out controllers with
 requests.

 On Oct 31, 9:41 pm, Skal Tura [EMAIL PROTECTED] wrote:



  I am wondering did i chose the Cake way of doing things with this, or
  atleast close :)

  We have multiple models, all of which access same set of tables
  handling massive amounts of data, searched using fulltext indexes.
  There's additions, searches, modifies etc. from 2 different models, ah
  but there's a gotcha! Most of these searches are slightly different,
  along with some of the inserts.

  So what i opted to do about handling this dataset is build an
  component used by the controllers. This component rarely contacts the
  model, and only one of the models for some assisting functions for
  some metadata to attach to the actual dataset.

  Is the component way the cake way to do something like this?

  Different main search types is 4, with variations for 2 different
  models.
  Different inserts 1 with 2 variations.
  Modifying pages 1. (Same form and everything, just some data used to
  check to which model uses that data)

  So i've done a simple component with a helper class to handle all of
  that :)

  Using cake 1.1

  Main goal when i code is to get short, simple pieces of code together.- 
  Hide quoted text -

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



Re: Looking for suggestion to filter data in cakephp

2008-10-31 Thread [EMAIL PROTECTED]

A Mac coming from Obj-C... you must be just a little frustrated with
phps OO support :)

I put the models I have and a controller method, as an example, in the
bin for you to take a look at and laugh at as you please.
http://bin.cakephp.org/view/1027493569

The code can be re-factored and improved a lot. I just wrote it in
desperate haste a good while ago and have not had a cause to revisit
it since.

I forgot to put in the fields model (stored the searchable fields and
their types). That part will probably be replaced by som automatic
schema mapping but in my case I still have is as a table. The model
has no special features.
For your reference here is the table for that:
CREATE TABLE `fields` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `display_name` varchar(255) default NULL,
  `type` varchar(255) default NULL,
  `field_name` varchar(255) default NULL,
  `model` varchar(255) default '',
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8



On Oct 30, 5:13 pm, mario [EMAIL PROTECTED] wrote:
 Thanks Martin.

 That gave me a bit of an idea of what I'm going to
 do. And yes I want to know the specific details on how
 you implemented it. It would also be good if I could see
 some snippets of your code (model,controller,view) to further
 understand what you're trying to explain.

 Btw, I'm actually a mac developer but I'm still new in cakephp. =)

 On Oct 30, 8:36 am, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  First I'll admit I did not read through all your code. But I think I
  get what you are doing.

  I created a filtering system about a year ago. I wanted/needed
  something that worked a bit like the find feature in Mac OS X Finder,
  or in some SQL-GUIs I have used. If you have see this you know what I
  am talking about. I also needed these to be saved and recalled later.

  Anyway.
  I ended up with something that is a lot more streamlined in the
  controller but with a bit more work done in the Models.

  Filter is the whole search setup for a particular search.
  Rule is a single filtering rule.
  Filter hasMany Rule

  One Rule can have:
  - a property to filter
  - an operator
  - a value entered by the user

  End result might be email ends with gmail.com for a single rule.
  Adding more rules to a Filter would narrow the search using AND.
  This turned out the be very flexible. A filter can be attached to any
  other model and do filtering on it.

  The rule model contained a big data array with different operators
  (sql fragments) for different types of data. Since humans want to
  filter numbers differently from email addresses I created a number of
  these preset custom fragments that could be selected from drop-downs
  in the gui. The rule model also contained a method for converting the
  stored parameters (field, match, value) to an sql fragment for a given
  model.

  Some examples of fragments:
  $this-types['Text']['equals'] = '%s LIKE \'%s\'';
  $this-types['Text']['contains'] = '%s LIKE \'%%%s%%\'';
  $this-types['Text']['starts_with'] = '%s LIKE \'%s%%\'';
  $this-types['Text']['ends_with'] = '%s LIKE \'%%%s\'';
  $this-types['Date']['days_ago'] = 'FLOOR(DATEDIFF(CURDATE(),
  DATE(%s))) = \'%s\'';
  $this-types['Date']['weeks_ago'] = 'FLOOR(DATEDIFF(CURDATE(),
  DATE(%s))/7) = \'%s\'';

  Each field is mapped to a type. Datetime fields becomes the Date
  type. Text fields could be set to email or anything but defaults to
  Text.

  The filter code was nothing special. The only special method there was
  getFilterFor($model_name) which gathers the results from each rule.

  The reason for this setup was partly flexibility and partly the GUI. I
  really wanted a humane gui. No wildcards or pseudo-sql. Simple selects
  and meaningful words. Looking back it is not a very difficult setup
  but it did take some time to come up with the right way to set it all
  up.

  I hope that gives you some ideas.
  Let me know if you want a few more boring details of the
  implementation.

  /Martin

  On Oct 30, 3:43 pm, mario [EMAIL PROTECTED] wrote:

   Hello everyone,

   I'm planning to include filters in my new project wherein it will
   allow the user to filter or show only the information that he/she
   wants. Of course there would be a search form
   (textfield,combobox,checkbox, submit button) for this relative to my
   tables' fieldnames in the database.

   I've already done this before on my recent project using cakephp. I
   will post some of my code snippets here for you to make some
   suggestion and for me to find out if what I'm doing is correct or not.
   I'm also looking forward on recommendations on how to improve my
   filtering process (which I'm gonna use on my next project).

   Here is the code snippet of my controller (I've placed the filters in
   my index view):
   ---
--
           function 

Re: Jquery or Scriptalicious?

2008-10-31 Thread Flipflops

As lots of people have said you miss out on the helpers with jQuery,
but if you don't like Prototype then its no great loss - but anyway
what I've stared doing is writing a my own bake templates (ad7six
wrote a really handy introduction 
http://www.ad7six.com/MiBlog/CustomBakeTemplates)
which i have edited to include all the hooks (mostly css class names)
and my jQuery scripts just work off those.

Lets face it bake is pretty good, but you can still spend an age
editing it all, especially the index views so you might as well get it
set up how you like to begin with. Honestly I wish I'd bothered to do
this a year ago.

On Oct 30, 10:49 pm, Matthieu [EMAIL PROTECTED] wrote:
 Hello,

 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I choose?
 Does it really matter? What's the differences between them?

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread clemos

I prefer Mootools too.
It's very lightweight.
The API is, IMHO, much cleaner and more convenient than
Prototype/scriptaculous'.
And there is this dom:ready event, that AFAIK prototype has not.

++
Clément

ps: Now I'm thinking about totally switching to haXe, but that's
another story...

On Fri, Oct 31, 2008 at 11:58 AM, grigri [EMAIL PROTECTED] wrote:

 JQuery or Scriptalicious?

 Mootools for me. But to each his own...

 On Oct 31, 10:18 am, Dardo Sordi Bogado [EMAIL PROTECTED]
 wrote:
 I think Jquery is better, based purely in that it's so easy and
 intuitive to use/extend that you will need no helper.

 On Fri, Oct 31, 2008 at 7:26 AM, Anupom [EMAIL PROTECTED] wrote:
  I think PHP helper for writing Javascript is a very bad idea.

  On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED] wrote:

  Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
  Helper, I find JQuery so much easier to use that you don't really need
  a helper.

  On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
  wrote:
   jQuery .

   On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED] wrote:

Hello,

I'm gonna create a web app using CakePHP but I'm confused about
chosing between Jquery or Scriptalious? Which one should I choose?
Does it really matter? What's the differences between them?

tks

  --
  Anupom Syam
 http://syamantics.com/
 


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



Re: The Cake way of doing this? Multiple models accessing a huge dataset

2008-10-31 Thread teknoid

Make it a Behavior or (at least place in App Model).
Certainly any kind of data access/manipulation does not belong in a
component.

On Oct 31, 11:48 am, Skal Tura [EMAIL PROTECTED] wrote:
 Doing those tasks inside model seemed messy way to it.
 We have multiple models accessing portions of the data.

 Thought i showed quite clearly what this is upto :)

 So we have a text search engine, every snippet of text can have
 multiple boolean type of modes, such as: removed and verified along
 others.
 Texts are in UTF8 because some is in normal latin1 charset, some are
 russian or japanese. Therefore we have a field for romanised text
 (normal alphabetic).

 That data is searched, used, and modified by multiple different
 models, using slightly different criterias.

 There is 3 different models currently utilizing this component in a
 way or an another. Every one of those models uses that component
 differently, to output completely different things, from the same
 data.

 On Oct 31, 3:54 pm, Adam Royle [EMAIL PROTECTED] wrote:

  Well without any real examples it's hard to tell what you're doing.
  However I think most people would recommend you should do more inside
  your models. Components should just be to help out controllers with
  requests.

  On Oct 31, 9:41 pm, Skal Tura [EMAIL PROTECTED] wrote:

   I am wondering did i chose the Cake way of doing things with this, or
   atleast close :)

   We have multiple models, all of which access same set of tables
   handling massive amounts of data, searched using fulltext indexes.
   There's additions, searches, modifies etc. from 2 different models, ah
   but there's a gotcha! Most of these searches are slightly different,
   along with some of the inserts.

   So what i opted to do about handling this dataset is build an
   component used by the controllers. This component rarely contacts the
   model, and only one of the models for some assisting functions for
   some metadata to attach to the actual dataset.

   Is the component way the cake way to do something like this?

   Different main search types is 4, with variations for 2 different
   models.
   Different inserts 1 with 2 variations.
   Modifying pages 1. (Same form and everything, just some data used to
   check to which model uses that data)

   So i've done a simple component with a helper class to handle all of
   that :)

   Using cake 1.1

   Main goal when i code is to get short, simple pieces of code together.- 
   Hide quoted text -

  - Show quoted text -


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Anupom

 And there is this dom:ready event, that AFAIK prototype has not.


Prototype has got a dom: loaded event from 1.6v :)


On Fri, Oct 31, 2008 at 10:13 PM, clemos [EMAIL PROTECTED] wrote:


 I prefer Mootools too.
 It's very lightweight.
 The API is, IMHO, much cleaner and more convenient than
 Prototype/scriptaculous'.
 And there is this dom:ready event, that AFAIK prototype has not.

 ++
 Clément

 ps: Now I'm thinking about totally switching to haXe, but that's
 another story...

 On Fri, Oct 31, 2008 at 11:58 AM, grigri [EMAIL PROTECTED]
 wrote:
 
  JQuery or Scriptalicious?
 
  Mootools for me. But to each his own...
 
  On Oct 31, 10:18 am, Dardo Sordi Bogado [EMAIL PROTECTED]
  wrote:
  I think Jquery is better, based purely in that it's so easy and
  intuitive to use/extend that you will need no helper.
 
  On Fri, Oct 31, 2008 at 7:26 AM, Anupom [EMAIL PROTECTED] wrote:
   I think PHP helper for writing Javascript is a very bad idea.
 
   On Fri, Oct 31, 2008 at 3:23 PM, martinp [EMAIL PROTECTED]
 wrote:
 
   Despite the fact that CakePHP comes with a Scriptaculous-powered AJAX
   Helper, I find JQuery so much easier to use that you don't really
 need
   a helper.
 
   On Oct 31, 9:30 am, Gianluca Gentile [EMAIL PROTECTED]
   wrote:
jQuery .
 
On Oct 30, 11:49 pm, Matthieu [EMAIL PROTECTED]
 wrote:
 
 Hello,
 
 I'm gonna create a web app using CakePHP but I'm confused about
 chosing between Jquery or Scriptalious? Which one should I
 choose?
 Does it really matter? What's the differences between them?
 
 tks
 
   --
   Anupom Syam
  http://syamantics.com/
  
 

 



-- 
Anupom Syam
TrippertLabs, Dhaka
http://www.anupom.wordpress.com/

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



Re: Admin + Members suggested setup??

2008-10-31 Thread Brenton B

Thanks everyone for the useful tips, that helps a lot, which means I
may have to restructure some stuff.
Mostly, I think I was getting confused by the fact that with having
`index` and `admin_index` I ended up doing 2 different views, where
the difference was only whether or not to include an 'edit' link in
the list ... which all seemed redundant, because any small change I'd
make to one, I'd have to make to the other and seemed a bit more
efficient to have a single view with checks for if they have
permission or not.

Cheers

On Oct 31, 1:49 am, Adam Royle [EMAIL PROTECTED] wrote:
 Admin routing as more useful in a CMS-style site where there are
 clearly two distinct areas display of site data, and administering
 site data, which both could differ greatly in controller  view code,
 rather than just acl  permissions.

 Hope that clears things up.

 Cheers,
 Adam

 On Oct 29, 6:33 am, Brenton B [EMAIL PROTECTED] wrote:

  Quick question as to what would be the best Cake-y setup:

  So I've got a list of Users who can either be Admin, Editors, or
  simply Members.
  Members can edit their own profiles, but Admin can also edit anyone's
  profile (at this point Editors are just normal Members with special
  status).

  When it comes to admin routing, should that only be used for strictly
  Admins and not Members?
  Ex:
  /profiles/edit - what Members use and there's a check that the
  profile matches with the member
  /profiles/admin_edit - only Admin uses this.

  And how would that all work with ACL? It seems like there's a wee bit
  of overlap here.

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



Re: HABTM goodness: searching!!

2008-10-31 Thread Brenton B

http://bakery.cakephp.org/articles/view/habtm-searching

On Oct 14, 4:56 pm, Brenton B [EMAIL PROTECTED] wrote:
 In the mean time:

 http://www.bbartel.ca/blog/brenton/2008/oct/14/habtm-searching

 Please forgive the horrible formatting, not sure what's going on
 there, and don't have time right now to figure it out.

 On Oct 14, 4:43 pm, Brenton B [EMAIL PROTECTED] wrote:

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



Re: Multiple table conditions HABTM

2008-10-31 Thread Brenton B

http://bakery.cakephp.org/articles/view/habtm-searching

On Oct 15, 9:47 am, [EMAIL PROTECTED] wrote:
 I am a worker for this grouped i am sorry i clicked the worng post.

 On 10/15/2008, Brenton B [EMAIL PROTECTED] wrote:





  Huh? This specific discussion, or the group itself?
  Probably because at some point you signed up to follow this
  discussion, can always remove yourself from it and edit your profile
  to no longer receive updates.

  On Oct 14, 4:59 pm, [EMAIL PROTECTED] wrote:
  This keeps on show up in my email. The subject. I was wondering what
  this was for?

  On 10/14/2008, Brenton B [EMAIL PROTECTED] wrote:

   Not sure if this is close to what you need,
  http://www.bbartel.ca/blog/brenton/2008/oct/14/habtm-searching
   (will touch up formatting shortly).

   On Oct 14, 3:16 am, hariharan [EMAIL PROTECTED] wrote:
   I am also stuck with the same problem . For HABTM or hasMany it doesnt
   query with join. rather queries each and every table in an individual
   manner, which is time consuming one.

   Another thing is cakephp does not support through association like
   ROR.  suppose if I have two HABTM then i cant access the fields of the
   extra table formed due to the relationships.

   eg user and group

   users  - HASMANYANDBELONGSTO - groups
   groups - HASMANYANDBELONGSTO - users

   so the other table result due to this is groups_users. other than
   group_id and user_id suppose if i want to store additional info such
   as when did they joined group etc... i cant access those fields.

   help me.

   On Oct 8, 1:56 am, jmmg77 [EMAIL PROTECTED] wrote:

Okay,

Whenever I have a hasOne or belongsTo association, those models are
included in the query whenever I do a find('all');

But, when I have any other type of association, find('all' only
generates a query with the model I'm searching.
This keeps me from filtering by fields in the related models.

ex:
$funnypeople = $this-Individual-find('all', array('conditions' =
array('Personality.type' = 3)));

This example works find if a person only has one Personality Type.
But what about this.

$racecardrivers = $this-Individual-find('all', array('conditions'
=
array('Vehicle.type' = 2)));

The problem here is a person could own multiple vehicles, so
belongsTo
 hasOne don't work here.
I would need hasMany or hasAndBelongsToMany, which makes those model
inaccessible using find.

Any help would be greatly appreciated.  Thanks.

  --
  Xavier A. Mathews
  Student/Developer/Web-Master
  GG Client Based Tech Support Specialist
  Hazel Crest Illinois
  [EMAIL PROTECTED]
  Fear of a name, only increases fear of the thing itself.

 --
 Xavier A. Mathews
 Student/Developer/Web-Master
 GG Client Based Tech Support Specialist
 Hazel Crest Illinois
 [EMAIL PROTECTED]
 Fear of a name, only increases fear of the thing itself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: htaccess problems.

2008-10-31 Thread Todd M

Ok, so I read up some more on htaccess, so I went back to the original
htaccess file that was in the cake_install_dir
I should  point out that I'm on a shared web server.

I found some hints on debugging on the web so here are my
modified .htaccess
Mostly added the the [R] where the [L] was. This was for debugging so
the url would be in the address bar when it failed

in cake1.2 directory
IfModule mod_rewrite.c
   RewriteEngine on
   RewriteRule^$ app/webroot/[R]
   RewriteRule(.*) app/webroot/$1 [R]
/IfModule

for apps directory
IfModule mod_rewrite.c
RewriteEngine on
RewriteRule^$webroot/[R]
RewriteRule(.*) webroot/$1[R]
 /IfModule

for webroot directory
IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^index.php
RewriteRule ^(.*)$ index.php?url=$1 [R]
/IfModule


I did add another RewriteCond in the webroot .htaccess. I also
modified the webroot's index.php to just an if-else looking at the url
?php
  if (isset($_GET['url'])){
echo 'You are here and url = ' . $_GET['url'];
  }
  else
  {
echo ' No url seen ';
  }
  echo 'BLAH';
?

So what I see works and doesn't work.
 http://www.example.net/cake1.2/app/webroot/foo.html  (just a hello
world html)
 http://www.example.net/cake1.2/app/webroot/index.php
http://www.example.net/cake1.2/app/webroot/index.php?url=posts

What doesn't work is
http://www.example.net/cake1.2/posts
http://www.example.net/cake1.2/app/posts
http://www.example.net/cake1.2/app/webroot/posts

Looking at the last one http://www.example.com/cake1.2/app/webroot/posts.
Because I put the [R] flags I see this in the address bar of the
failed attempt page
http://www.example.net/home/net/example/html/cake1.2/app/webroot/index.php?url=posts

So I'm thinking the problem is because I'm on a shared web server. But
thats just a hunch






On Oct 31, 3:42 am, Anupom [EMAIL PROTECTED] wrote:
 Hi there,

 Can you please share your modified .htaccess file that you have inside your
 cake1.2 directory? I guess you have other .htaccess files inside your root
 or html directory? Can you tell us what's written inside those as well?

 So my questions are if the .htaccess is necessary? good practice?



 .htaccess is necessary for pretty URLs and is certainly a good thing to have
 :) You can though setup your cake to not to use .htaccess.

 Also please check if apache rewrite module is turned on in your web server.

 Thanks.



 On Fri, Oct 31, 2008 at 9:40 AM, Todd M [EMAIL PROTECTED] wrote:

  I'm finding problems with what I believe is with .htaccess in the
  cake_install_directory.

  My current web server only allows the /html directory as a HTML root.
  To reduce complexity, I thought it would be good to start with
  untaring the CakePHP in that directory.

  so my directory appears something like this

  /html
       /cake1.2
            /app
            /cake
            /docs
            /vendors
        /foobar

  I've noticed in the past if I wanted to look at an html file in foobar
  I had to usehttp://www.example.com/foobar

  So I'm at step 4 in the documentation. I've confirmed with the web
  server that has AllowOverride is set to All.

  It seems that I can't do
 http://www.example.com/cake1.2
 http://www.example.com/cake1.2/index.php
  or even
 http://www.example.com/cake1.2/foo.html

  The foo.html is just a hello world html file.

  What I found is if I remove the .htaccess file I get a nice CakePHP
  link telling my salt needs to be updated and that theres no connection
  to DB.

  So I went farther in the tutorial, I successfully linked DB  changed
  salt word. Checked thehttp://www.example.com/cake1.2and everything
  looks fine, including DB is connected and no salt warning.

  I did do a google search both here and the internet. I did find
  something about adding a Rewritebase line to all 3 .htaccess, but not
  sure if I did that correctly.  When I changed that, it seemed to just
  go to a blank webpage. No errors or anything.

  So my questions are if the .htaccess is necessary? good practice?

 --
 Anupom Syamhttp://syamantics.com/

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



Routing: Actions

2008-10-31 Thread 703designs

Router::connect('portfolio/*', array('controller' = 'port_items'));

How do I pass the * to PortItemsController::*()? I considered using
call_user_function on the controller from the index($method) method
with the * as $method, but I'd rather direct the request straight to
the * method.

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



Re: Routing: Actions

2008-10-31 Thread teknoid

Router::connect('portfolio/:action/*,
array('controller'='port_items'));

p.s. it's in the manual ;)

On Oct 31, 2:22 pm, 703designs [EMAIL PROTECTED] wrote:
 Router::connect('portfolio/*', array('controller' = 'port_items'));

 How do I pass the * to PortItemsController::*()? I considered using
 call_user_function on the controller from the index($method) method
 with the * as $method, but I'd rather direct the request straight to
 the * method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: htaccess problems.

2008-10-31 Thread Anupom
Did you try adding something like this?

RewriteBase /home/net/example/html/cake1.2/

On Sat, Nov 1, 2008 at 12:06 AM, Todd M [EMAIL PROTECTED] wrote:


 Ok, so I read up some more on htaccess, so I went back to the original
 htaccess file that was in the cake_install_dir
 I should  point out that I'm on a shared web server.

 I found some hints on debugging on the web so here are my
 modified .htaccess
 Mostly added the the [R] where the [L] was. This was for debugging so
 the url would be in the address bar when it failed

 in cake1.2 directory
 IfModule mod_rewrite.c
   RewriteEngine on
   RewriteRule^$ app/webroot/[R]
   RewriteRule(.*) app/webroot/$1 [R]
 /IfModule

 for apps directory
 IfModule mod_rewrite.c
RewriteEngine on
RewriteRule^$webroot/[R]
RewriteRule(.*) webroot/$1[R]
  /IfModule

 for webroot directory
 IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^index.php
RewriteRule ^(.*)$ index.php?url=$1 [R]
 /IfModule


 I did add another RewriteCond in the webroot .htaccess. I also
 modified the webroot's index.php to just an if-else looking at the url
 ?php
  if (isset($_GET['url'])){
echo 'You are here and url = ' . $_GET['url'];
  }
  else
  {
echo ' No url seen ';
  }
  echo 'BLAH';
 ?

 So what I see works and doesn't work.
  http://www.example.net/cake1.2/app/webroot/foo.html  (just a hello
 world html)
  http://www.example.net/cake1.2/app/webroot/index.php
 http://www.example.net/cake1.2/app/webroot/index.php?url=posts

 What doesn't work is
 http://www.example.net/cake1.2/posts
 http://www.example.net/cake1.2/app/posts
 http://www.example.net/cake1.2/app/webroot/posts

 Looking at the last one http://www.example.com/cake1.2/app/webroot/posts.
 Because I put the [R] flags I see this in the address bar of the
 failed attempt page

 http://www.example.net/home/net/example/html/cake1.2/app/webroot/index.php?url=posts

 So I'm thinking the problem is because I'm on a shared web server. But
 thats just a hunch






 On Oct 31, 3:42 am, Anupom [EMAIL PROTECTED] wrote:
  Hi there,
 
  Can you please share your modified .htaccess file that you have inside
 your
  cake1.2 directory? I guess you have other .htaccess files inside your
 root
  or html directory? Can you tell us what's written inside those as well?
 
  So my questions are if the .htaccess is necessary? good practice?
 
 
 
  .htaccess is necessary for pretty URLs and is certainly a good thing to
 have
  :) You can though setup your cake to not to use .htaccess.
 
  Also please check if apache rewrite module is turned on in your web
 server.
 
  Thanks.
 
 
 
  On Fri, Oct 31, 2008 at 9:40 AM, Todd M [EMAIL PROTECTED] wrote:
 
   I'm finding problems with what I believe is with .htaccess in the
   cake_install_directory.
 
   My current web server only allows the /html directory as a HTML root.
   To reduce complexity, I thought it would be good to start with
   untaring the CakePHP in that directory.
 
   so my directory appears something like this
 
   /html
/cake1.2
 /app
 /cake
 /docs
 /vendors
 /foobar
 
   I've noticed in the past if I wanted to look at an html file in foobar
   I had to usehttp://www.example.com/foobar
 
   So I'm at step 4 in the documentation. I've confirmed with the web
   server that has AllowOverride is set to All.
 
   It seems that I can't do
  http://www.example.com/cake1.2
  http://www.example.com/cake1.2/index.php
   or even
  http://www.example.com/cake1.2/foo.html
 
   The foo.html is just a hello world html file.
 
   What I found is if I remove the .htaccess file I get a nice CakePHP
   link telling my salt needs to be updated and that theres no connection
   to DB.
 
   So I went farther in the tutorial, I successfully linked DB  changed
   salt word. Checked thehttp://www.example.com/cake1.2and everything
   looks fine, including DB is connected and no salt warning.
 
   I did do a google search both here and the internet. I did find
   something about adding a Rewritebase line to all 3 .htaccess, but not
   sure if I did that correctly.  When I changed that, it seemed to just
   go to a blank webpage. No errors or anything.
 
   So my questions are if the .htaccess is necessary? good practice?
 
  --
  Anupom Syamhttp://syamantics.com/

 



-- 
Anupom Syam
http://syamantics.com/

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



Help with complex find() spanning several models

2008-10-31 Thread 33rtp

Hey all...

New to PHP, Cake, and MySQL so bear with me.

I've been searching high and low for the best way to make this query
work, but just haven't gotten it yet.

Here's my setup:

I have models for Users, Subscriptions, Authors, and Posts where:
User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
Author, HasMany Subscription (pk_Author.id,
fk_Subscription.author_id),
Author HasMany Post (pk_Author.id, fk_Post.author_id)
and all of the related BelongsTo's as well.

I want to search $this-User-Subscription-Author-Post (from the
UsersController) for all posts where the logged in user has a current
subscription to that(/those) author(s).

E.g. - ($this-Auth-user('id') = Subscription.user_id AND
Subscription.expiration_date = date ('Y m d') AND
Subscription.author_id = Post.author_id).

Further, each Post contains a second field (INT) called
Post.access_level and this must be lower than the value stored in
Subscriptions.subscription_level.

The trick, of course, isn't just doing this, but doing it
efficiently.  Here are the options I've thought of.

- I could query $this-User-Subscriptions for relevant subscriptions
and return either the full array (set to $subscriptions) or a 'list'
of key/value pairs where key = author_id and value =
subscription_level.  However, in issuing a second find() call to Post,
I don't know how I would compare the key/value pairs in the
$subscriptions array with the values for 'Post.author_id' and
'Post.access_level' where the evaluation occurs at the row level in
$subscriptions.  With the find('all') array I mentioned first,
$subscriptions returns an array with [key][Subscription][field] so I
can't set conditions for 'Post.author_id' and 'Post.access_level'
without a foreach() which I don't want because of the extra database
queries it would generate.

-Alternately, I could use BindModel() to create a HABTM (or I could
just create it permanently in the models) relationship between
Subscription and Post.  This option requires an extra join table in my
database though, and may result in slower database queries as all the
joins are performed.  Additionally, there are other models (File,
Event, etc) that are owned by Author and each of these would require
an extra join table and HABTM relationship.  I could be wrong, but
doing all of this seems somehow redundant and there should be a more
elegant solution.

-There are also probably other ways using PHP functions to manipulate
the arrays after they have been returned from find calls (e.g.
Subscriptions-find w/ conditions and Post-find w/ conditions and
then some PHP array functions to compare those two arrays), but I'm
too new to this to know where to even start with that.

There's got to be a simple method I'm missing (or just don't know
about yet).  Any ideas?


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Gabriel Gilini
Sorry, mate, but prototype also supports all CSS3 selectors.

ps: I never use cakephp's ajax helpers, and I love writing javascript

Cheers

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Fri, Oct 31, 2008 at 10:45 AM, Josey [EMAIL PROTECTED] wrote:


 I perfer jQuery as well.
 Many Bakers like prototype due to the javascript and ajax helpers that
 come with CakePHP.
 These make baking with JS quite a bit easier, not to mention faster
 however many Javascript experts would cringe to think that developers
 are using php helpers for the behavioral portion of their sites
 because the scripts are no longer unobtrusive.

 jQuery is very easy to learn and uses many of the same selectors that
 CSS 2 and 3 use making it incredibly easy to develop around.
 However, if you require a JS helper there is a jQuery helper for
 CakePHP called pQuery.
 http://www.ngcoders.com/php/pquery-php-and-jquery

 If not then spend some time at the jQuery API and read through the
 tutorials.
 http://docs.jquery.com/Main_Page

 I love jQuery.

 On Oct 30, 5:49 pm, Matthieu [EMAIL PROTECTED] wrote:
  Hello,
 
  I'm gonna create a web app using CakePHP but I'm confused about
  chosing between Jquery or Scriptalious? Which one should I choose?
  Does it really matter? What's the differences between them?
 
  tks
 


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



Re: Help with complex find() spanning several models

2008-10-31 Thread teknoid

That's a lot to read, but I can point you in the direction of checking
out the Containable behavior (in the manual).
... as well as really carefully reading up on the model associations
and data retrieval.

On Oct 31, 2:30 pm, 33rtp [EMAIL PROTECTED] wrote:
 Hey all...

 New to PHP, Cake, and MySQL so bear with me.

 I've been searching high and low for the best way to make this query
 work, but just haven't gotten it yet.

 Here's my setup:

 I have models for Users, Subscriptions, Authors, and Posts where:
 User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
 Author, HasMany Subscription (pk_Author.id,
 fk_Subscription.author_id),
 Author HasMany Post (pk_Author.id, fk_Post.author_id)
 and all of the related BelongsTo's as well.

 I want to search $this-User-Subscription-Author-Post (from the
 UsersController) for all posts where the logged in user has a current
 subscription to that(/those) author(s).

 E.g. - ($this-Auth-user('id') = Subscription.user_id AND
 Subscription.expiration_date = date ('Y m d') AND
 Subscription.author_id = Post.author_id).

 Further, each Post contains a second field (INT) called
 Post.access_level and this must be lower than the value stored in
 Subscriptions.subscription_level.

 The trick, of course, isn't just doing this, but doing it
 efficiently.  Here are the options I've thought of.

 - I could query $this-User-Subscriptions for relevant subscriptions
 and return either the full array (set to $subscriptions) or a 'list'
 of key/value pairs where key = author_id and value =
 subscription_level.  However, in issuing a second find() call to Post,
 I don't know how I would compare the key/value pairs in the
 $subscriptions array with the values for 'Post.author_id' and
 'Post.access_level' where the evaluation occurs at the row level in
 $subscriptions.  With the find('all') array I mentioned first,
 $subscriptions returns an array with [key][Subscription][field] so I
 can't set conditions for 'Post.author_id' and 'Post.access_level'
 without a foreach() which I don't want because of the extra database
 queries it would generate.

 -Alternately, I could use BindModel() to create a HABTM (or I could
 just create it permanently in the models) relationship between
 Subscription and Post.  This option requires an extra join table in my
 database though, and may result in slower database queries as all the
 joins are performed.  Additionally, there are other models (File,
 Event, etc) that are owned by Author and each of these would require
 an extra join table and HABTM relationship.  I could be wrong, but
 doing all of this seems somehow redundant and there should be a more
 elegant solution.

 -There are also probably other ways using PHP functions to manipulate
 the arrays after they have been returned from find calls (e.g.
 Subscriptions-find w/ conditions and Post-find w/ conditions and
 then some PHP array functions to compare those two arrays), but I'm
 too new to this to know where to even start with that.

 There's got to be a simple method I'm missing (or just don't know
 about yet).  Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search Engine Bots Generating Strange Queries

2008-10-31 Thread MikeK

So you're saying the search bots are just walking all my actions as if
they are subdirs on a site? Not sure about this.

Maybe I should disallow those specific requests with robots.txt? Any
other cakers have an opinion on this? If I disallow

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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Samuel DeVore

Here's my take for what little it's worth (note I use scripa/proto)
if you want to use the ajax helper at this point you are tied to
scripta/proto.  now given that the stated plans in unofficial channels
is that the helper is either being migrated to jQuery or being driving
to a javascript _framwork_ agnostic place, it really doesn't matter.

If on the otherhand you see yourself not feeling like the helper as it
exists now will meet your needs and you will be wanting insight and
help from people on this list on integrating javascript _framework_
into your project, then I would say that the responses to your
question indicate, to me, that jQuery is a more of the current
'hotness' and you are likely to get more help from people jazzed up on
jQuery.

To me it is a question of who is going to help you if you need it and
what do you think your projected needs are.

See totally unhelpful answer ;)

Sam D


On Fri, Oct 31, 2008 at 12:16 PM, Gabriel Gilini [EMAIL PROTECTED] wrote:
 Sorry, mate, but prototype also supports all CSS3 selectors.

 ps: I never use cakephp's ajax helpers, and I love writing javascript

 Cheers

 Gabriel Gilini

 www.usosim.com.br
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]


 On Fri, Oct 31, 2008 at 10:45 AM, Josey [EMAIL PROTECTED] wrote:

 I perfer jQuery as well.
 Many Bakers like prototype due to the javascript and ajax helpers that
 come with CakePHP.
 These make baking with JS quite a bit easier, not to mention faster
 however many Javascript experts would cringe to think that developers
 are using php helpers for the behavioral portion of their sites
 because the scripts are no longer unobtrusive.

 jQuery is very easy to learn and uses many of the same selectors that
 CSS 2 and 3 use making it incredibly easy to develop around.
 However, if you require a JS helper there is a jQuery helper for
 CakePHP called pQuery.
 http://www.ngcoders.com/php/pquery-php-and-jquery

 If not then spend some time at the jQuery API and read through the
 tutorials.
 http://docs.jquery.com/Main_Page

 I love jQuery.

 On Oct 30, 5:49 pm, Matthieu [EMAIL PROTECTED] wrote:
  Hello,
 
  I'm gonna create a web app using CakePHP but I'm confused about
  chosing between Jquery or Scriptalious? Which one should I choose?
  Does it really matter? What's the differences between them?
 
  tks



 


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



Re: Jquery or Scriptalicious?

2008-10-31 Thread Gabriel Gilini
The right answers is: learn real javascript
Yes, the learning curve with jQuery is way lower, but when you really know
javascript, take a look in proto ;)

Gabriel Gilini

www.usosim.com.br
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Fri, Oct 31, 2008 at 4:37 PM, Samuel DeVore [EMAIL PROTECTED] wrote:


 Here's my take for what little it's worth (note I use scripa/proto)
 if you want to use the ajax helper at this point you are tied to
 scripta/proto.  now given that the stated plans in unofficial channels
 is that the helper is either being migrated to jQuery or being driving
 to a javascript _framwork_ agnostic place, it really doesn't matter.

 If on the otherhand you see yourself not feeling like the helper as it
 exists now will meet your needs and you will be wanting insight and
 help from people on this list on integrating javascript _framework_
 into your project, then I would say that the responses to your
 question indicate, to me, that jQuery is a more of the current
 'hotness' and you are likely to get more help from people jazzed up on
 jQuery.

 To me it is a question of who is going to help you if you need it and
 what do you think your projected needs are.

 See totally unhelpful answer ;)

 Sam D


 On Fri, Oct 31, 2008 at 12:16 PM, Gabriel Gilini [EMAIL PROTECTED]
 wrote:
  Sorry, mate, but prototype also supports all CSS3 selectors.
 
  ps: I never use cakephp's ajax helpers, and I love writing javascript
 
  Cheers
 
  Gabriel Gilini
 
  www.usosim.com.br
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
 
 
  On Fri, Oct 31, 2008 at 10:45 AM, Josey [EMAIL PROTECTED] wrote:
 
  I perfer jQuery as well.
  Many Bakers like prototype due to the javascript and ajax helpers that
  come with CakePHP.
  These make baking with JS quite a bit easier, not to mention faster
  however many Javascript experts would cringe to think that developers
  are using php helpers for the behavioral portion of their sites
  because the scripts are no longer unobtrusive.
 
  jQuery is very easy to learn and uses many of the same selectors that
  CSS 2 and 3 use making it incredibly easy to develop around.
  However, if you require a JS helper there is a jQuery helper for
  CakePHP called pQuery.
  http://www.ngcoders.com/php/pquery-php-and-jquery
 
  If not then spend some time at the jQuery API and read through the
  tutorials.
  http://docs.jquery.com/Main_Page
 
  I love jQuery.
 
  On Oct 30, 5:49 pm, Matthieu [EMAIL PROTECTED] wrote:
   Hello,
  
   I'm gonna create a web app using CakePHP but I'm confused about
   chosing between Jquery or Scriptalious? Which one should I choose?
   Does it really matter? What's the differences between them?
  
   tks
 
 
 
  
 

 


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



A couple of things with Security Component

2008-10-31 Thread Stinkbug

I'm having a bit of a problem with the Security Component on one of my
actions.  It works on most, but this one action is quiet complex.  I'm
not even sure what the problem could possible be.  So rather than
asking what the problem is with my action, I would rather ask if there
is any information that explains how the security component works (not
how to implement it), so that I might be able to pin point the problem
with my code.  Basically, my request get's black holed when I select a
checkbox.  I'm using

?php echo $form-select('Category.Category', $categories,
$selectedCategories, array('multiple' = 'checkbox'));?

Everything works fine if I don't select a category.  But if I select a
category, the request get's blackholed.  So if I can learn how the
security component actually works, maybe I can figure out my problem.
How does the security component create it's token?  Hidden field
values?  And at what point does it do this?  afterRender perhaps,
because how can it know what hidden fields there are if we're setting
those values in our controller action?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: A couple of things with Security Component

2008-10-31 Thread Nate

There were a couple of bug fixes related to this issue that got
committed just recently.  If you're not running on the latest SVN
branch code, try updating to that and see if the problem persists.

On Oct 31, 3:54 pm, Stinkbug [EMAIL PROTECTED] wrote:
 I'm having a bit of a problem with the Security Component on one of my
 actions.  It works on most, but this one action is quiet complex.  I'm
 not even sure what the problem could possible be.  So rather than
 asking what the problem is with my action, I would rather ask if there
 is any information that explains how the security component works (not
 how to implement it), so that I might be able to pin point the problem
 with my code.  Basically, my request get's black holed when I select a
 checkbox.  I'm using

 ?php echo $form-select('Category.Category', $categories,
 $selectedCategories, array('multiple' = 'checkbox'));?

 Everything works fine if I don't select a category.  But if I select a
 category, the request get's blackholed.  So if I can learn how the
 security component actually works, maybe I can figure out my problem.
 How does the security component create it's token?  Hidden field
 values?  And at what point does it do this?  afterRender perhaps,
 because how can it know what hidden fields there are if we're setting
 those values in our controller action?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with complex find() spanning several models

2008-10-31 Thread 33rtp



On Oct 31, 3:28 pm, teknoid [EMAIL PROTECTED] wrote:
 That's a lot to read, but I can point you in the direction of checking
 out the Containable behavior (in the manual).
 ... as well as really carefully reading up on the model associations
 and data retrieval.

 On Oct 31, 2:30 pm, 33rtp [EMAIL PROTECTED] wrote:

  Hey all...

  New to PHP, Cake, and MySQL so bear with me.

  I've been searching high and low for the best way to make this query
  work, but just haven't gotten it yet.

  Here's my setup:

  I have models for Users, Subscriptions, Authors, and Posts where:
  User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
  Author, HasMany Subscription (pk_Author.id,
  fk_Subscription.author_id),
  Author HasMany Post (pk_Author.id, fk_Post.author_id)
  and all of the related BelongsTo's as well.

  I want to search $this-User-Subscription-Author-Post (from the
  UsersController) for all posts where the logged in user has a current
  subscription to that(/those) author(s).

  E.g. - ($this-Auth-user('id') = Subscription.user_id AND
  Subscription.expiration_date = date ('Y m d') AND
  Subscription.author_id = Post.author_id).

  Further, each Post contains a second field (INT) called
  Post.access_level and this must be lower than the value stored in
  Subscriptions.subscription_level.

  The trick, of course, isn't just doing this, but doing it
  efficiently.  Here are the options I've thought of.

  - I could query $this-User-Subscriptions for relevant subscriptions
  and return either the full array (set to $subscriptions) or a 'list'
  of key/value pairs where key = author_id and value =
  subscription_level.  However, in issuing a second find() call to Post,
  I don't know how I would compare the key/value pairs in the
  $subscriptions array with the values for 'Post.author_id' and
  'Post.access_level' where the evaluation occurs at the row level in
  $subscriptions.  With the find('all') array I mentioned first,
  $subscriptions returns an array with [key][Subscription][field] so I
  can't set conditions for 'Post.author_id' and 'Post.access_level'
  without a foreach() which I don't want because of the extra database
  queries it would generate.

  -Alternately, I could use BindModel() to create a HABTM (or I could
  just create it permanently in the models) relationship between
  Subscription and Post.  This option requires an extra join table in my
  database though, and may result in slower database queries as all the
  joins are performed.  Additionally, there are other models (File,
  Event, etc) that are owned by Author and each of these would require
  an extra join table and HABTM relationship.  I could be wrong, but
  doing all of this seems somehow redundant and there should be a more
  elegant solution.

  -There are also probably other ways using PHP functions to manipulate
  the arrays after they have been returned from find calls (e.g.
  Subscriptions-find w/ conditions and Post-find w/ conditions and
  then some PHP array functions to compare those two arrays), but I'm
  too new to this to know where to even start with that.

  There's got to be a simple method I'm missing (or just don't know
  about yet).  Any ideas?

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



Re: Help with complex find() spanning several models

2008-10-31 Thread 33rtp

Thanks for the help teknoid.  I've done that, and I think there are
some possibilities there, but they are a little longer than I'd like.

For those who might come after this and not feel like reading the full
situation above, my question in a nut-shell really is:

How do you run a find on a field in a Model that is two associations
away rather than just one?

E.g. - When querying Post which belongsTo Artist which hasMany
Subscription, how do I compare a field in Post to a field in
Subscription?  Cake doesn't seem to want to create a second JOIN in
the SQL output.

On Oct 31, 3:28 pm, teknoid [EMAIL PROTECTED] wrote:
 That's a lot to read, but I can point you in the direction of checking
 out the Containable behavior (in the manual).
 ... as well as really carefully reading up on the model associations
 and data retrieval.

 On Oct 31, 2:30 pm, 33rtp [EMAIL PROTECTED] wrote:

  Hey all...

  New to PHP, Cake, and MySQL so bear with me.

  I've been searching high and low for the best way to make this query
  work, but just haven't gotten it yet.

  Here's my setup:

  I have models for Users, Subscriptions, Authors, and Posts where:
  User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
  Author, HasMany Subscription (pk_Author.id,
  fk_Subscription.author_id),
  Author HasMany Post (pk_Author.id, fk_Post.author_id)
  and all of the related BelongsTo's as well.

  I want to search $this-User-Subscription-Author-Post (from the
  UsersController) for all posts where the logged in user has a current
  subscription to that(/those) author(s).

  E.g. - ($this-Auth-user('id') = Subscription.user_id AND
  Subscription.expiration_date = date ('Y m d') AND
  Subscription.author_id = Post.author_id).

  Further, each Post contains a second field (INT) called
  Post.access_level and this must be lower than the value stored in
  Subscriptions.subscription_level.

  The trick, of course, isn't just doing this, but doing it
  efficiently.  Here are the options I've thought of.

  - I could query $this-User-Subscriptions for relevant subscriptions
  and return either the full array (set to $subscriptions) or a 'list'
  of key/value pairs where key = author_id and value =
  subscription_level.  However, in issuing a second find() call to Post,
  I don't know how I would compare the key/value pairs in the
  $subscriptions array with the values for 'Post.author_id' and
  'Post.access_level' where the evaluation occurs at the row level in
  $subscriptions.  With the find('all') array I mentioned first,
  $subscriptions returns an array with [key][Subscription][field] so I
  can't set conditions for 'Post.author_id' and 'Post.access_level'
  without a foreach() which I don't want because of the extra database
  queries it would generate.

  -Alternately, I could use BindModel() to create a HABTM (or I could
  just create it permanently in the models) relationship between
  Subscription and Post.  This option requires an extra join table in my
  database though, and may result in slower database queries as all the
  joins are performed.  Additionally, there are other models (File,
  Event, etc) that are owned by Author and each of these would require
  an extra join table and HABTM relationship.  I could be wrong, but
  doing all of this seems somehow redundant and there should be a more
  elegant solution.

  -There are also probably other ways using PHP functions to manipulate
  the arrays after they have been returned from find calls (e.g.
  Subscriptions-find w/ conditions and Post-find w/ conditions and
  then some PHP array functions to compare those two arrays), but I'm
  too new to this to know where to even start with that.

  There's got to be a simple method I'm missing (or just don't know
  about yet).  Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with complex find() spanning several models

2008-10-31 Thread teknoid

By default joins are only built for hasOne or belongsTo.
Here's how to trick cake into building joins for deep model
bindings:
http://teknoid.wordpress.com/2008/07/17/forcing-an-sql-join-in-cakephp/

there is another post on my blog if you search, which has a slightly
more advanced example of the same principal.

On Oct 31, 4:28 pm, 33rtp [EMAIL PROTECTED] wrote:
 Thanks for the help teknoid.  I've done that, and I think there are
 some possibilities there, but they are a little longer than I'd like.

 For those who might come after this and not feel like reading the full
 situation above, my question in a nut-shell really is:

 How do you run a find on a field in a Model that is two associations
 away rather than just one?

 E.g. - When querying Post which belongsTo Artist which hasMany
 Subscription, how do I compare a field in Post to a field in
 Subscription?  Cake doesn't seem to want to create a second JOIN in
 the SQL output.

 On Oct 31, 3:28 pm, teknoid [EMAIL PROTECTED] wrote:

  That's a lot to read, but I can point you in the direction of checking
  out the Containable behavior (in the manual).
  ... as well as really carefully reading up on the model associations
  and data retrieval.

  On Oct 31, 2:30 pm, 33rtp [EMAIL PROTECTED] wrote:

   Hey all...

   New to PHP, Cake, and MySQL so bear with me.

   I've been searching high and low for the best way to make this query
   work, but just haven't gotten it yet.

   Here's my setup:

   I have models for Users, Subscriptions, Authors, and Posts where:
   User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
   Author, HasMany Subscription (pk_Author.id,
   fk_Subscription.author_id),
   Author HasMany Post (pk_Author.id, fk_Post.author_id)
   and all of the related BelongsTo's as well.

   I want to search $this-User-Subscription-Author-Post (from the
   UsersController) for all posts where the logged in user has a current
   subscription to that(/those) author(s).

   E.g. - ($this-Auth-user('id') = Subscription.user_id AND
   Subscription.expiration_date = date ('Y m d') AND
   Subscription.author_id = Post.author_id).

   Further, each Post contains a second field (INT) called
   Post.access_level and this must be lower than the value stored in
   Subscriptions.subscription_level.

   The trick, of course, isn't just doing this, but doing it
   efficiently.  Here are the options I've thought of.

   - I could query $this-User-Subscriptions for relevant subscriptions
   and return either the full array (set to $subscriptions) or a 'list'
   of key/value pairs where key = author_id and value =
   subscription_level.  However, in issuing a second find() call to Post,
   I don't know how I would compare the key/value pairs in the
   $subscriptions array with the values for 'Post.author_id' and
   'Post.access_level' where the evaluation occurs at the row level in
   $subscriptions.  With the find('all') array I mentioned first,
   $subscriptions returns an array with [key][Subscription][field] so I
   can't set conditions for 'Post.author_id' and 'Post.access_level'
   without a foreach() which I don't want because of the extra database
   queries it would generate.

   -Alternately, I could use BindModel() to create a HABTM (or I could
   just create it permanently in the models) relationship between
   Subscription and Post.  This option requires an extra join table in my
   database though, and may result in slower database queries as all the
   joins are performed.  Additionally, there are other models (File,
   Event, etc) that are owned by Author and each of these would require
   an extra join table and HABTM relationship.  I could be wrong, but
   doing all of this seems somehow redundant and there should be a more
   elegant solution.

   -There are also probably other ways using PHP functions to manipulate
   the arrays after they have been returned from find calls (e.g.
   Subscriptions-find w/ conditions and Post-find w/ conditions and
   then some PHP array functions to compare those two arrays), but I'm
   too new to this to know where to even start with that.

   There's got to be a simple method I'm missing (or just don't know
   about yet).  Any ideas?


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



Re: htaccess problems.

2008-10-31 Thread Todd M

No I did try that. The physical path was added by the server or
somehow my account is setup.

The RewriteBase did give me success !!

I'll just share part of the process for future people that may find
the same problem.

First of all the [R] that I talked about in my second post helped me
debug this a little more.

I needed to use the RewriteBase to strip off the physical address. I
now have the following .htaccesses

#/cake1.2/.htaccess
IfModule mod_rewrite.c
   RewriteEngine on
   RewriteBase /cake1.2
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]
/IfModule

#/cake1.2/app/.htaccess
IfModule mod_rewrite.c
RewriteEngine on
RewriteBase /cake1.2/app
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]
 /IfModule

#/cake1.2/app/webroot/.htaccess

IfModule mod_rewrite.c
RewriteEngine On

RewriteBase /cake1.2/app/webroot
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

What also helps debug is to make a backup of the original index.php in
webroot and replace it with something simple like I did in my second
post. This reduced the the problem set to just the htaccess and
defines I needed to tell where cake directories were.

Thanks a ton.
-T

On Oct 31, 2:39 pm, Anupom [EMAIL PROTECTED] wrote:
 Did you try adding something like this?

 RewriteBase /home/net/example/html/cake1.2/



 On Sat, Nov 1, 2008 at 12:06 AM, Todd M [EMAIL PROTECTED] wrote:

  Ok, so I read up some more on htaccess, so I went back to the original
  htaccess file that was in the cake_install_dir
  I should  point out that I'm on a shared web server.

  I found some hints on debugging on the web so here are my
  modified .htaccess
  Mostly added the the [R] where the [L] was. This was for debugging so
  the url would be in the address bar when it failed

  in cake1.2 directory
  IfModule mod_rewrite.c
    RewriteEngine on
    RewriteRule    ^$ app/webroot/    [R]
    RewriteRule    (.*) app/webroot/$1 [R]
  /IfModule

  for apps directory
  IfModule mod_rewrite.c
     RewriteEngine on
     RewriteRule    ^$    webroot/    [R]
     RewriteRule    (.*) webroot/$1    [R]
   /IfModule

  for webroot directory
  IfModule mod_rewrite.c
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_URI} !^index.php
     RewriteRule ^(.*)$ index.php?url=$1 [R]
  /IfModule

  I did add another RewriteCond in the webroot .htaccess. I also
  modified the webroot's index.php to just an if-else looking at the url
  ?php
   if (isset($_GET['url'])){
     echo 'You are here and url = ' . $_GET['url'];
   }
   else
   {
     echo ' No url seen ';
   }
   echo 'BLAH';
  ?

  So what I see works and doesn't work.
   http://www.example.net/cake1.2/app/webroot/foo.html (just a hello
  world html)
   http://www.example.net/cake1.2/app/webroot/index.php
 http://www.example.net/cake1.2/app/webroot/index.php?url=posts

  What doesn't work is
 http://www.example.net/cake1.2/posts
 http://www.example.net/cake1.2/app/posts
 http://www.example.net/cake1.2/app/webroot/posts

  Looking at the last onehttp://www.example.com/cake1.2/app/webroot/posts.
  Because I put the [R] flags I see this in the address bar of the
  failed attempt page

 http://www.example.net/home/net/example/html/cake1.2/app/webroot/inde...

  So I'm thinking the problem is because I'm on a shared web server. But
  thats just a hunch

  On Oct 31, 3:42 am, Anupom [EMAIL PROTECTED] wrote:
   Hi there,

   Can you please share your modified .htaccess file that you have inside
  your
   cake1.2 directory? I guess you have other .htaccess files inside your
  root
   or html directory? Can you tell us what's written inside those as well?

   So my questions are if the .htaccess is necessary? good practice?

   .htaccess is necessary for pretty URLs and is certainly a good thing to
  have
   :) You can though setup your cake to not to use .htaccess.

   Also please check if apache rewrite module is turned on in your web
  server.

   Thanks.

   On Fri, Oct 31, 2008 at 9:40 AM, Todd M [EMAIL PROTECTED] wrote:

I'm finding problems with what I believe is with .htaccess in the
cake_install_directory.

My current web server only allows the /html directory as a HTML root.
To reduce complexity, I thought it would be good to start with
untaring the CakePHP in that directory.

so my directory appears something like this

/html
     /cake1.2
          /app
          /cake
          /docs
          /vendors
      /foobar

I've noticed in the past if I wanted to look at an html file in foobar
I had to usehttp://www.example.com/foobar

So I'm at step 4 in the documentation. I've confirmed with the web
server that has AllowOverride is set to All.

It seems that I can't do
   http://www.example.com/cake1.2
   

File uploads timing out

2008-10-31 Thread pj

Hi all,

I've been drawn back into cake (and some of you may remember me from
WAAAY back - I have ticket number 1 on cake :) , wondering if
anyone can help:

My image uploads appear to be timing out - I'm using the Authenticate
component and some digging has revealed some sort of issue over
session ids, I've tried the tricks that have been suggested but with
no joy (sometimes I'll get the chance to upload one or two files and
then after that it'll just appear to stop working)

I've tried logging things through and it looks like the entire thing
is progressing all the way through the to view file but nothing is
being rendered on screen.

Any ideas?

Cheers

- pj
www.infurious.com

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



Re: hasMany bind on the fly

2008-10-31 Thread Ita

Well since no shiny knight in white armor came to my rescue I wound up
creating my query.
I guess cake has its own limitations.

On Oct 30, 7:41 am, Ita [EMAIL PROTECTED] wrote:
 So it just can't handle the conditions?
 What should I do in this case? create my own query?

 On Oct 29, 7:29 pm, teknoid [EMAIL PROTECTED] wrote:

  cake does not create joins for hasMany (only hasOne and belongsTo)

  On Oct 29, 12:27 pm, Ita [EMAIL PROTECTED] wrote:

   Hi,
   I have 2 models Item and Defect.
   both of them have description.
   an Item can have many Defects and my defects table has a an item_id
   field.

   Now I'm trying to create a search query that will search both the item
   description and the defect description.
   What I do is this:

   $this-Item-bindModel(
                               array('hasMany' = array(
                                   'Defect' = array(
                                       'className' = 'Defect',
                                       'foreignKey' = 'item_id',
                                       'type' = 'INNER'
                                       )
                                   )
                               )
                       );
   then I run findAll.

   Now when I use findAll with no conditions everything works fine. cake
   seems to run 2 queries:
   SELECT `Item`.`id`,.. FROM `items` AS `Item` WHERE 1 = 1
   SELECT `Defect`.`id`,.. FROM `defects` AS `Defect` WHERE
   `Defect`.`item_id` IN (1, 2, 16, 15, 14, 13, 12, 11, 10, 17, 18, 19,
   20)

   My first question is why does cake doesn't create one query with INNER
   JOIN?
   The second problem is when I add conditions:
   $conditions[] = `Item`.`name` LIKE '% .$search_term .%' OR
   `Defect`.`description` LIKE '% . $search_term . %';

   It seems that cake in this case ignores the join all together and just
   does a regular select so I get an error:
   1054: Unknown column 'Defect.description' in 'where clause'

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



Scaffold belongsTo question

2008-10-31 Thread Crambo

I assume convention over configuration:


I have Two Models:

Users:

Requests:
belongsTo ('User')

Hoever, when I bake up the MVC, the index view of Requests shows the
ID of Request.id rather than the NAME of User.name.


I am to understand that this should not happen.

Your thoughts or rants are both appreciated.

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



Re: File uploads timing out

2008-10-31 Thread Adam Royle

You didn't mention what technique you were using to upload files,
however here is one idea.

If you are doing a flash upload, some browsers (can't remember which)
won't complete the request until data is returned from the server. So
in my upload action I always output a space. exit(' ');

Also, are you testing locally or on a server? Do any errors show up in
the apache, php or cakephp logs?

Cheers,
Adam

On Nov 1, 6:37 am, pj [EMAIL PROTECTED] wrote:
 Hi all,

 I've been drawn back into cake (and some of you may remember me from
 WAAAY back - I have ticket number 1 on cake :) , wondering if
 anyone can help:

 My image uploads appear to be timing out - I'm using the Authenticate
 component and some digging has revealed some sort of issue over
 session ids, I've tried the tricks that have been suggested but with
 no joy (sometimes I'll get the chance to upload one or two files and
 then after that it'll just appear to stop working)

 I've tried logging things through and it looks like the entire thing
 is progressing all the way through the to view file but nothing is
 being rendered on screen.

 Any ideas?

 Cheers

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



Re: hasMany bind on the fly

2008-10-31 Thread teknoid

no, cake can easily build the join that you need:
http://teknoid.wordpress.com/2008/07/17/forcing-an-sql-join-in-cakephp/

as matter of fact there is an example like like this one in the
manual. and i must've posted this link on the list a bunch of times.
so searching is always a good idea...


On Oct 31, 6:06 pm, Ita [EMAIL PROTECTED] wrote:
 Well since no shiny knight in white armor came to my rescue I wound up
 creating my query.
 I guess cake has its own limitations.

 On Oct 30, 7:41 am, Ita [EMAIL PROTECTED] wrote:

  So it just can't handle the conditions?
  What should I do in this case? create my own query?

  On Oct 29, 7:29 pm, teknoid [EMAIL PROTECTED] wrote:

   cake does not create joins for hasMany (only hasOne and belongsTo)

   On Oct 29, 12:27 pm, Ita [EMAIL PROTECTED] wrote:

Hi,
I have 2 models Item and Defect.
both of them have description.
an Item can have many Defects and my defects table has a an item_id
field.

Now I'm trying to create a search query that will search both the item
description and the defect description.
What I do is this:

$this-Item-bindModel(
                            array('hasMany' = array(
                                'Defect' = array(
                                    'className' = 'Defect',
                                    'foreignKey' = 'item_id',
                                    'type' = 'INNER'
                                    )
                                )
                            )
                    );
then I run findAll.

Now when I use findAll with no conditions everything works fine. cake
seems to run 2 queries:
SELECT `Item`.`id`,.. FROM `items` AS `Item` WHERE 1 = 1
SELECT `Defect`.`id`,.. FROM `defects` AS `Defect` WHERE
`Defect`.`item_id` IN (1, 2, 16, 15, 14, 13, 12, 11, 10, 17, 18, 19,
20)

My first question is why does cake doesn't create one query with INNER
JOIN?
The second problem is when I add conditions:
$conditions[] = `Item`.`name` LIKE '% .$search_term .%' OR
`Defect`.`description` LIKE '% . $search_term . %';

It seems that cake in this case ignores the join all together and just
does a regular select so I get an error:
1054: Unknown column 'Defect.description' in 'where clause'

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



Named parameter routing does not work with pagination(bug or feature?)

2008-10-31 Thread Novice Programmer
Hello guys,

I have defined following route in routes.php:
Router::connect('/users/:uid/friends/*', array('controller' = 'users',
'action' = 'friends'),
array('pass'=array('uid')));

when i try to use paginator to build pagination links, the links to pages
look like the default cake php route:
they look as /users/friends/uid/page:1 where as using the above route, i
expect them to be: /users/uid/friends/page:1.

I am confused whether this a bug or feature? My pagination code for building
the links:

?=$paginator-last('img src=/img/last.gif border=0 width=18
height=18 /',
array('escape'=false));?

?= $paginator-numbers(); ?

My paginate setup:

$this-paginate = array('limit'=1,
'page'=1,
'order'='UsersFriend.created DESC',
'contain'=array('User', 'Profile'));

$data = $this-paginate('UsersFriend',
array('UsersFriend.user_id'=$user['User']['id']));


Please help.


-- 
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with complex find() spanning several models

2008-10-31 Thread 33rtp

Awesome.  Thanks.

On Oct 31, 4:37 pm, teknoid [EMAIL PROTECTED] wrote:
 By default joins are only built for hasOne or belongsTo.
 Here's how to trick cake into building joins for deep model
 bindings:http://teknoid.wordpress.com/2008/07/17/forcing-an-sql-join-in-cakephp/

 there is another post on my blog if you search, which has a slightly
 more advanced example of the same principal.

 On Oct 31, 4:28 pm, 33rtp [EMAIL PROTECTED] wrote:

  Thanks for the help teknoid.  I've done that, and I think there are
  some possibilities there, but they are a little longer than I'd like.

  For those who might come after this and not feel like reading the full
  situation above, my question in a nut-shell really is:

  How do you run a find on a field in a Model that is two associations
  away rather than just one?

  E.g. - When querying Post which belongsTo Artist which hasMany
  Subscription, how do I compare a field in Post to a field in
  Subscription?  Cake doesn't seem to want to create a second JOIN in
  the SQL output.

  On Oct 31, 3:28 pm, teknoid [EMAIL PROTECTED] wrote:

   That's a lot to read, but I can point you in the direction of checking
   out the Containable behavior (in the manual).
   ... as well as really carefully reading up on the model associations
   and data retrieval.

   On Oct 31, 2:30 pm, 33rtp [EMAIL PROTECTED] wrote:

Hey all...

New to PHP, Cake, and MySQL so bear with me.

I've been searching high and low for the best way to make this query
work, but just haven't gotten it yet.

Here's my setup:

I have models for Users, Subscriptions, Authors, and Posts where:
User HasMany Subscription (pk_User.id, fk_Subscription.user_id),
Author, HasMany Subscription (pk_Author.id,
fk_Subscription.author_id),
Author HasMany Post (pk_Author.id, fk_Post.author_id)
and all of the related BelongsTo's as well.

I want to search $this-User-Subscription-Author-Post (from the
UsersController) for all posts where the logged in user has a current
subscription to that(/those) author(s).

E.g. - ($this-Auth-user('id') = Subscription.user_id AND
Subscription.expiration_date = date ('Y m d') AND
Subscription.author_id = Post.author_id).

Further, each Post contains a second field (INT) called
Post.access_level and this must be lower than the value stored in
Subscriptions.subscription_level.

The trick, of course, isn't just doing this, but doing it
efficiently.  Here are the options I've thought of.

- I could query $this-User-Subscriptions for relevant subscriptions
and return either the full array (set to $subscriptions) or a 'list'
of key/value pairs where key = author_id and value =
subscription_level.  However, in issuing a second find() call to Post,
I don't know how I would compare the key/value pairs in the
$subscriptions array with the values for 'Post.author_id' and
'Post.access_level' where the evaluation occurs at the row level in
$subscriptions.  With the find('all') array I mentioned first,
$subscriptions returns an array with [key][Subscription][field] so I
can't set conditions for 'Post.author_id' and 'Post.access_level'
without a foreach() which I don't want because of the extra database
queries it would generate.

-Alternately, I could use BindModel() to create a HABTM (or I could
just create it permanently in the models) relationship between
Subscription and Post.  This option requires an extra join table in my
database though, and may result in slower database queries as all the
joins are performed.  Additionally, there are other models (File,
Event, etc) that are owned by Author and each of these would require
an extra join table and HABTM relationship.  I could be wrong, but
doing all of this seems somehow redundant and there should be a more
elegant solution.

-There are also probably other ways using PHP functions to manipulate
the arrays after they have been returned from find calls (e.g.
Subscriptions-find w/ conditions and Post-find w/ conditions and
then some PHP array functions to compare those two arrays), but I'm
too new to this to know where to even start with that.

There's got to be a simple method I'm missing (or just don't know
about yet).  Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search Engine Bots Generating Strange Queries

2008-10-31 Thread Mathew

Hi Mike,

Disallowing that in your robots.txt is a waste of time.

The robots.txt file was started by Google, and is not an officially
supported feature of all crawlers. So they don't have to follow it,
and I can tell you this doesn't sound like the google bot anyway,
because that bot doesn't generate phantom URIs.

Web crawlers can extract URIs from many different sources, and they
can generate URIs as they see fit. URIs can come from HTML, CSS, SWF,
JavaScript, and form post/get actions. I've even seen crawlers submit
post requests to generate more URIs to crawl.

Crawlers will also clean URIs removing ids, changing queries, fake
cookies, and sometimes rotate their IP address.

There are no rules about crawlers, no guidelines they have to follow,
or limits on how long they will crawl or how aggressively they will
request URIs from your server.

You should modify your Routes to point to a 404 if they request paths
that you don't want them to see.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to manage HABTM that is reflexive?

2008-10-31 Thread [EMAIL PROTECTED]

I have a table of users, and I want to make links between users, so
each user can have links to one or more other users. I can't see,
however, how to set this up in Cake. The linking table has two fields
that link to the Users table, but how to I create the correct 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---