QA Automation - Alpharetta GA - 3+Months Contract

2015-06-02 Thread Andy Johnson
Hello,

I saw your details in our Database and wanted to talk with you about a *QA
Automation* position (contract) I have for one of my clients in *Alpharetta
GA*. Please see details below  and contact me if you are interested in
discussing further.  If not, perhaps you might know of someone who is
looking and can refer?




*Job Title  : QA AutomationLocation  :   Alpharetta GADuration  :
3+Months ContractStart Date :  ASAP*

*Local to Alpharetta GA only – Face to face required.*

*We need 2 QA Automation testers for 3+ month contracts in Alpharetta, GA.
We can pay up to $40 an hour.  Looking for 4-6 years experience, and
excellent communication skills. *

Skills required:



*Selinium with Ruby and JavaUse of UI automation tools (.Net and C#)3-5
years’ experience in testingLocation: Alpharetta GA – Face to face
required.*

Thank you and I look forward to hearing back from you!

Warm Regards,
Andy Johnson • Sr. Technical Recruiter • Panzer Solutions, LLC
50 Washington Street • 9th Floor, SONO Corporate Center • Norwalk CT 06854
USA
Office: 203 -652 -1444 Ext 259 • Fax: 203-286-1457 • Email:
ajohn...@panzersolutions.com
(In case you are not able to reach me or for any escaltions, you can reach
my Accounts Manager - Sam Riley @ 203 652 1444 ext 203;
sam.ri...@panzersolutions.com)

Notice of Confidentiality:
The information contained herein is intendaed only for the confidential use
of the recipient. If the reader of this message is neither the intended
recipient, nor the person responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error, and that any review, dissemination, distribution,
or copying of this communication is strictly prohibited. If you receive
this in error, please notify the sender immediately by telephone, and
destroy this e-mail message OR reply with the subject“REMOVE” such that
your email would be taken.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Jquery mobile+Phonegap mobile app and authentication

2012-08-26 Thread Andy
Arash,

I seem to have the same problem, would you mind posting your solution with 
your sample code and all?



On Saturday, June 23, 2012 8:45:50 AM UTC-4, Arash wrote:

 Thanks Tarique, it looks to be the correct way but i didn't have any 
 success using it!

 Here is what i did:

 1. used HTTP Basic Authentication

 class AppController extends Controller {
 public $components = array(
 'Session',
 'RequestHandler',
 'Auth' = array(
 'authenticate' = array(
 'Basic' = array(
 'fields' = array('username' = 'email'),
 'realm' = 'touch'
 ),
 ),
 )
 );
 }



 2. created a login method which lets cross domain requests and cros domain 
 authorization

 class UsersController extends AppController {
 public function login() {
 header(Access-Control-Allow-Origin: *);
 header(Access-Control-Allow-Headers: Authorization);
 $response = false;
 if ($this-Auth-login()) {
 $response = true;
 }
 $this-set('response',$response);
 }


 3. i've added this line to router file so that i can use json 

 Router::parseExtensions('json');


 4. in the client side, i make login request using ajax like this:

 $.ajax({
 url: url,
 dataType: json,
 crossDomain: true,
 beforeSend: function(xhr){
 xhr.setRequestHeader(Authorization, Basic  + 
 Base64.encode(email + : + password));
 },
 success: function ( response ) {
 console.log(response);
 },
 error: function (xhr, ajaxOptions, thrownError) {
 console.log(xhr);
 }
 }); 


 The problem is that after i login successfully the next ajax requests get 
 401 (Unauthorized), i've tried to debug the problem and it seems that once 
 client login, the next ajax requests get 401 because the get user method in 
 BasicAuthenticate class can't get the user via env('PHP_AUTH_USER') and 
 env('PHP_AUTH_PW')

 Any idea why after successful ajax login the next ajax requests get 401 
 (Unauthorized) response?! why the authentication system can't get user by 
 env('PHP_AUTH_USER') ?



 On Friday, June 22, 2012 1:05:27 PM UTC+4:30, Dr. Tarique Sani wrote:

 See 
 http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#creating-stateless-authentication-systems
  

 Tarique 

 On Tue, Jun 19, 2012 at 3:35 AM, Arash  wrote: 
  Hi, 
  We are working on a mobile app for our SAAS website which uses Cake 
 1.3, 
  we've decided to use Jquery mobile+ Phonegap so we will use the HTML5 
 power 
  for building a mobile app. 
  
  The whole app is an HTML page with a few js ans css files which will be 
  running natively on the mobile and will interact with server with Ajax. 
  
  The problem we encountered here is that using the cakephp Auth the 
 session 
  id is not being saved on the browser (because the page is not being 
 served 
  from a webserver i think) so we don't have access to the session and we 
  can't know for sure if the user is authenticated or not. 
  
  I've seen some mobile authentication systems that provide a Token after 
  login, save it in browser local storage and send this token with each 
 ajax 
  request to the server, the server checks the token and if it is valid 
 then 
  severs the data. 
  
  Is there any reasonable way of authenticating users on a mobile app 
 using 
  the Auth component?! 
  
  -- 
  Our newest site for the community: CakePHP Video Tutorials 
  http://tv.cakephp.org 
  Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help 
  others with their CakePHP related questions. 
  
  
  To unsubscribe from this group, send email to 
  cake-php+u...@googlegroups.com javascript: For more options, visit 
 this group at 
  http://groups.google.com/group/cake-php 



 -- 
 = 
 PHP for E-Biz: http://sanisoft.com 
 = 



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




Re: Error: The requested address was not found on this server.

2012-07-25 Thread Andy Gale
On Wed, Jul 25, 2012 at 10:49 AM, Luís de Sousa
luis.a.de.so...@gmail.com wrote:

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

Things to check -

1. Is your web server running Apache?
2. Does your apache server allow .htaccess

http://httpd.apache.org/docs/current/mod/core.html#allowoverride

3. Does your apache server have mod_rewrite enabled?

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Cheers,

Andy

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Archive old data from model's table

2012-07-25 Thread Andy Gale
On Wed, Jul 25, 2012 at 6:04 PM, baur79 bau...@gmail.com wrote:
 i have model Report with table reports
 it contain report of last month. (50 000 records every month)

 please give some suggestions

These are called partitions. A quick Google came up with this:

https://github.com/deeeki/cakephp-partitionable

I haven't tried it but maybe this will help you.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: LESS CSS

2012-07-19 Thread Andy Gale
On Thu, Jul 19, 2012 at 1:25 PM, André Luis cavall...@live.com wrote:

 Hi people, i dont know if here is the right place to ask for this, but it
 would be nice if the HTML helper detects if the desired css file is a .css
 or .less, them it doesnt put a .css in front of the file, i always need to
 change my core files to accept the less files. And the less script doesnt
 accepts .css files =(

You're not serving .less files to the browser though are you? If you
are you won't be too popular with Internet Explorer users.

This is how to do it anyway:

http://www.syahzul.com/cakephp/how-to-use-less-css-in-cakephp-application/

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: 3.0: a peek into CakePHP's future

2012-07-06 Thread Andy Gale
On Fri, Jul 6, 2012 at 2:17 PM, Marsson C. marss...@gmail.com wrote:

 Does it mean Cake 3.0´s Model will return objects instead of arrays ?

Yes

Model layer rewrite:

Models to return objects from queries


--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 1.3 :: What does if block do in cake/lib/controller.php ?

2011-11-23 Thread Andy Gale
Hi,

On Wed, Nov 23, 2011 at 4:09 AM, mmhan mmha...@gmail.com wrote:

 I was just curiously checking out some of the core code in github and
 stumbled upon this.. I'm just wondering the reasoning behind it.In PHP4...

Yes, in PHP4...

$obj2 = $obj;

... would assign a copy of $obj to $obj2. i.e. an entirely different
object which is a copy of $obj.

So in PHP4, = is need to assign a reference to $obj to $obj2.

In PHP5...

$obj2 = $obj;

... assigns $obj2 as a reference of $obj by default so = is not required.

Cheers,

Andy

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0.3 out of the oven

2011-11-17 Thread Andy Gale
On Thu, Nov 17, 2011 at 10:16 AM, Davor Ilic webfa...@gmail.com wrote:

 does any of you have this error message when you calling wrong controller or
 action:
 Fatal error: Call to a member function flash() on a non-object
 in /srv/www/htdocs/web843/html/schaetzmal/lib/Cake/View/Layouts/default.ctp on
 line 44

You need to include the Session helper I'd imagine.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Se Ya Cake..bake a dick cake frosting on your face...............

2011-09-11 Thread Andy Gale
This is CLASSIC trolling. Congratulations on a job well done.

On Sun, Sep 11, 2011 at 7:45 AM, Krissy Masters
naked.cake.ba...@gmail.comwrote:

 Cake is falling apart,  everyone wants Drupal .

 Kill me hate me but its true.

 Cake is an ass in the pan going where?

 Cake fest eat it up cause the cake tastes better when someone cares, 

 Don’t see any Cake jobs no one want cake devs, they want Wordpress and
 Drupal and ROR.

 ** **

 1 in 1 want cakePHP .  Why? Because they make $$$ cake makes
 nothing! Put up a big name studio vs Cake Studio…who has more $$$ profits?
 Not Cake.

 Yes  I watched the  Cake community and you see the names asking questions
 then no more……where did the go I wonder..they moved on. Cake is a joke to
 the real dev world. 

 It’s for people who can spell, if my name is Steve the steve _ it is, Cake
 was a good thing and it has lost it all. Yes I’m full of it but 3 years to
 release a stable php 5 framework where others have surpassed, What have you
 to show? Miss America or Buy me a beer?  In 4 years I have not seen a single
 Cake site.

 I was shit this is good its all amature bullshit and that why cake sucks.
 No movement no future no ideas….lets play catch up and 1 day you will see no
 one cares.

 ** **

 Peace CakePHP officially signing off and CakeSucks ass! Fuck all you gay
 fuckers sucking Mark Story’s Cock! Cake is an ass eaters anal shit hole suck
 that nasty ass losers ball sack and enjoy it., losers no girlfriends playing
 with each others nuts,,ohh yes PHPNut who else would put nut in their name
 unless they like sucking them…phpMy Ass fag

 ** **

 Bake on Suckers going no where! Bake a cock cake and eat
 it!!!Emm yuymmy I like cocks !

 ** **

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php




-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Media Manager not handling uploads - why?

2011-08-26 Thread Cape Town Andy
Hi,

I installed David Pearsson's media manager per the readme file but
can't see how to link it to my forms so that it handles image
uploads.  I've scoured Google, the bakery, and ask.cakephp.org but
can't find any clear answer on this.

Any help or examples would be appreciated.

Thanks,
 Andy

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Warning (512)

2011-01-07 Thread Andy Dirnberger
What version of Cake are you using? findAll() was replaced by
find('all') in 1.2.

From the 1.3 docs: 
http://book.cakephp.org/view/1017/Retrieving-Your-Data#find-all-1021

On Jan 6, 7:22 pm, AndreGuerreiro andreadguerre...@gmail.com wrote:
 Hi, I got this message callingwww.bodoquemkt.com.br/users/knownusers
 .

 This knownusers was created as described 
 onhttp://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/s...
 .

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

 I wasn´t able to find where to set the MySQL server version.

 I´ll apreciate any help. Thank´s.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Common Punctuation

2010-11-29 Thread Andy Dirnberger
The 'i' means case insensitive, so you don't need the A-Z anymore:
'/^[\-\'\.\sa-z]+$/i'

On Nov 29, 3:54 am, Stephen step...@ninjacodermonkey.co.uk wrote:
 My mistake, i goes after the forward slash.

 *'rule' = array('custom', '/^[\-\'\.\sa-zA-Z]+$/i'),*

 On 29 November 2010 08:53, Stephen step...@ninjacodermonkey.co.uk wrote:









  Try adding an i to the end, this worked for me.

  *'rule' = array('custom', '/^[\-\'\.\sa-zA-Z]+$i/'),*

  On 29 November 2010 00:25, Dave Maharaj m...@davemaharaj.com wrote:

  Thanks,

  I have 'rule' = array('custom', '/^[\-\'\.\sa-zA-Z]+$/'),

  But the ' will not go thru.

  I know im an idiot..lol

  Dave

  -Original Message-
  From: Miles J [mailto:mileswjohn...@gmail.com]
  Sent: November-28-10 8:42 PM
  To: CakePHP
  Subject: Re: Common Punctuation

  Forgot spaces:

  /^[\-\.\sa-zA-Z]+$/

  On Nov 28, 4:08 pm, Miles J mileswjohn...@gmail.com wrote:
   Off the top of my head:

   /^[\-\.a-zA-Z]+$/

   Regex is probably the easiest approach. Just set it as a custom
   validation rule.

   On Nov 28, 1:30 pm, Dave Maharaj m...@davemaharaj.com wrote:

I know its not so much Cake question so forgive me ahead of time.

But does anyone know a regex for common punctuation? I want to put
validation on my City field where it's a-z and also allow ' - and .
  City
should not have any numbers. Open to any other ideas that you have
  used
  also
as I hate regex. I do not want people putting in crazy fake names.
  Almost
impossible to verify the name they enter (imagine that db table of
  every
possible name of every city / town in the world) so I would like to
  ensure
its within the realm of being real.

St.Louis has (.)

St.John's (.  And ' )

And other have the - separating words of the name. Cant think of any
  else?
Any help would be great.

Thanks,

Dave

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others
  with their CakePHP related questions.

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

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others with their CakePHP related questions.

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

  --
  Kind Regards
   Stephen @ NinjaCoderMonkey

   www.ninjacodermonkey.co.uk

 --
 Kind Regards
  Stephen @ NinjaCoderMonkey

  www.ninjacodermonkey.co.uk

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Memcached not working on default settings

2010-09-21 Thread Andy Gale
On Tue, Sep 21, 2010 at 4:02 PM, j.blotus j.blo...@gmail.com wrote:
 I recently set up memcached as well, it's too bad that it doesn't give
 you a great idea of how things are working behind the scenes.

Run memcached with the -vv option and it will tell you exactly what's going on.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to use CURRENT_TIMESTAMP in find conditions array

2010-09-20 Thread Andy Dirnberger
Did you try array(..., 'ClubsPlayer.start_datetime =
CURRENT_TIMESTAMP')?

On Sep 19, 5:38 pm, DerBjörn b.unkh...@googlemail.com wrote:
 Hi Zaky,

 yes with time() it works like that: ClubsPlayer.start_datetime =' =
 date('Y-m-d H:i:s', time()) but i thought there is a easilier way :)
 Thanks anyway!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Why are there no logs?!

2010-09-10 Thread Andy Dirnberger
What are you using for the log setting in core.php?

On Sep 10, 7:52 am, psybear83 psybea...@gmail.com wrote:
 Hi everybody

 From Ruby On Rails I'm used that while developing my log files are
 full of informations about what pages were rendered etc.

 In CakePHP I'm missing this - I don't even seem to have a log file in
 my app/tmp/logs directory? Is this normal? I have set

 define('LOG_ERROR', 2);

 is this OK? Am I missing anything else?

 Thanks a lot
 Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Why are there no logs?!

2010-09-10 Thread Andy Dirnberger
Which is not what I asked. From core.php:

/**
 * CakePHP Log Level:
 *
 * In case of Production Mode CakePHP gives you the possibility to
continue logging errors.
 *
 * The following parameters can be used:
 *  Boolean: Set true/false to activate/deactivate logging
 *Configure::write('log', true);
 *
 *  Integer: Use built-in PHP constants to set the error level (see
error_reporting)
 *Configure::write('log', E_ERROR | E_WARNING);
 *Configure::write('log', E_ALL ^ E_NOTICE);
 */
Configure::write('log', true);

On Sep 10, 9:30 am, Joshua Muheim psybea...@gmail.com wrote:
 as mentioned above i use

 define('LOG_ERROR', 2);

 On Fri, Sep 10, 2010 at 3:11 PM, Andy Dirnberger



 andy.dirnber...@gmail.com wrote:
  What are you using for the log setting in core.php?

  On Sep 10, 7:52 am, psybear83 psybea...@gmail.com wrote:
  Hi everybody

  From Ruby On Rails I'm used that while developing my log files are
  full of informations about what pages were rendered etc.

  In CakePHP I'm missing this - I don't even seem to have a log file in
  my app/tmp/logs directory? Is this normal? I have set

  define('LOG_ERROR', 2);

  is this OK? Am I missing anything else?

  Thanks a lot
  Josh

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help from a routing expert

2010-08-30 Thread Andy Dirnberger
Router::connect('/threads/*', array('controller' = 'threads',
'action' = 'index'));

On Aug 30, 7:52 am, Greg Skerman gsker...@gmail.com wrote:
 Ok so this should be fairly easy right?

 I have a few controllers (forums, threads and posts)

 The index of the forums controller shows the list of available forums
 The index of the threads controller shows the list of threads for a forum
 (so an ID is passed to the index method)
 The index of the posts controller shows the list of posts within a thread
 (so a forumID and a threadID is passed to the index method).

 So my URL's look somewhat awefuli have /threads/index/1 etc

 what i'd really like is /threads/1

 so i tried Router::connect('/threads/:id', array('controller' = 'threads',
 'action' = 'index'); to no avail... i tried playing with named arguments
 (which I would prefer to avoid) and still no luck.

 Surely it can't be hard to route out the action..help?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


hasMany relationship not appearing in array

2010-08-20 Thread Andy Fitz Diack
Hi all,

Apologies in advance if I have missed a solution to this or something
obvious.

I am setting up a Blog site and I have specified posts, comments and
users then used the console to generate my models, controllers and
views.

This has given me the following code in posts model:


var $hasMany = array(
'Comment' = array(
'className' = 'Comment',
'foreignKey' = 'post_id',
'dependent' = true,
'conditions' = '',
'fields' = '',
'order' = '',
'limit' = '',
'offset' = '',
'exclusive' = '',
'finderQuery' = '',
'counterQuery' = ''
)
);


var $belongsTo = array(
'User' = array(
'className' = 'User',
'foreignKey' = 'user_id',
'conditions' = '',
'fields' = '',
'order' = ''
)
);

but when I view the array from the index view for posts (with a
comment existing) I only get Posts and Users, with no mention of
Comments.

Is there a reason for this?

Andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Homepage Sweeper (clear cache) Question

2010-08-07 Thread andy
Hi all,

Has anyone made a CakePHP project where you have a homepage that pulls
information from various models (ex: calendar events, news articles,
etc.) and displays it on said homepage?

In Rails I did something like that in the past... and I was able to
clear the cache for the homepage whenever I made an update to any of
the (calendar events, news articles, etc.) models.

I've been reading through the CakePHP Book docs and searching this
group but I haven't been able to find a way to clear my Homepage cache
whenever I make a change to those included models.

Any idea how I could do this?  If all else fails... I may just have to
put in some code to delete the main Homepage cache file manually after
a model is saved or deleted.  But I still hope there is a cleaner
way...

Andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Backend best option

2010-08-03 Thread Andy Gale
On Mon, Aug 2, 2010 at 6:27 PM, mike karthauser mi...@brightstorm.co.uk wrote:

 hi hugo
 making one application with front end and backend functionality is far
 superior to creating and maintaining two apps.
 it seems you might benefit from reading book.cakephp.org
 mikek

Definitely from a code generation point of view but maybe not from a
performance point of view. Depends how important performance is
really.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP Tags Plugin Question 2

2010-08-02 Thread Andy Dirnberger
There's an error in your syntax. The line should be $filter =
array('Event.postcode' = '4883');

On Aug 2, 11:24 pm, #2Will willjbar...@gmail.com wrote:
 Sorry but i seem to be struggling today.  Ive got my index page
 showing my paginated list and filtering by tag, but what if i want to
 add in more filters?

 so  $filter = array( 'Event.postcode' = '4883')

 $this-paginate['Tagged'] = array(
                         'model' = 'Event',
                         'tagged',
                         'by' = $this-passedArgs['by']);
                 $recipes = $this-paginate('Tagged', $filter);

 the filter is just ignored.

 Surely im just doing something silly? You must be able to add more
 conditions right?

 Thanks,

 a confused will.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Display images outside webroot folder

2010-07-26 Thread Andy Gale
On Mon, Jul 26, 2010 at 12:37 PM, rez...@gmail.com rez...@gmail.com wrote:
 In my application I upload images in folder outside webroot called
 userFiles - in the same level of webroot - and I can't display these
 images using html helper
 ?php echo $html-image('/userFiles/my_pic.png')?
 as cake consider all images url in webroot img
 Any help plz

They are outside the document root so your web server can't serve them.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Element caching using memcache

2010-07-26 Thread Andy Gale
On Mon, Jul 26, 2010 at 1:31 PM, majna majna...@gmail.com wrote:
 Andy Gale,
 you can't cache elements  and views in cache engine (1.2 or 1.3,
 because Cache::read() and Cache::Write is not even used here).
 It requires refactoring cache() and clearCache() functions
 (basics.php) to implement memcache.

 Also, clearCache() calls form Model class deletes all cached elements
 and views which contains Model name (or associated models names)
 in a cache key. Let userland code decide that!?

Of course it uses a file cache for that whatever you put in for the
cache engine. Which is why we bypassed the requestAction stuff when we
implemented our caching system. What are the reasons why the cache
engine isn't used there? Seems a bit of a no-brainier to me.

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Element caching using memcache

2010-07-25 Thread Andy Gale
On Sun, Jul 25, 2010 at 5:15 PM, DragonI dragonc...@gmail.com wrote:

 Are there any plans for an option to enable element caching via
 memcache?

You can already cache elements via requestAction. If memcache is set
as your caching engine it'll surely cache said elements in memcache.

http://book.cakephp.org/view/434/requestAction

-- 
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Link with image and text

2010-07-25 Thread Andy Dirnberger
Things will be different if you're using Cake 1.3, but it will be
along the lines of:

$this-Html-link($this-Html-image('folio/thumb/' . $feature['Entry']
[0]['image'], array('alt' = __($feature['Portfolio']['title'], true),
'border' = 0)) . 'h3' . $feature['Portfolio']['title'] . '/h3',
URL_HERE, array('escape' = false));

You can see an example here http://book.cakephp.org/view/1442/link

On Jul 25, 9:32 pm, Dave Maharaj m...@davemaharaj.com wrote:
 I am trying to place an link which is an html image then text after the
 image.

 But all I get is the actual image source in the screen, not the image.

 ?php echo $html-link(

 $html-image('folio/thumb/'.$feature['Entry']['0']['image'] , array(

 'alt'= __($feature['Portfolio']['title'], true), 'border'=0)),

 'h3'.$feature['Portfolio']['title'] .'/h3');?

 Thanks

 Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Website Structure

2010-07-22 Thread Andy H
Hi Chaim,

This is more of a HTML/css question rather than a cakephp question.

Try checking out some web libraries like JQuery or similar. These will
help you achieve what you are after



On Jul 21, 6:13 pm, Chaim ch...@oxfordshul.com wrote:
 Hello,

 I am a beginner to CakePHP, so forgive my amateur question.
 I am unsure how to structure my website.
 I have four blocks and then when one block is clicked it changes to
 show the content for that block. However the other three blocks still
 remain visible and clickable so that if you click on another block it
 will hide the first block and show the new one.

 Can anyone help me with how I should set up my website in CakePHP?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problems with blog tutorial Warning (512): SQL Error: 1064:

2010-07-12 Thread Andy H
Hi,

The first line of you edit function has a mistake.

should be

$this-Post-id = $id;

Good luck!



On Jul 9, 11:13 pm, BlaineRumsey bla...@blainerumsey.com wrote:
 Hello,  I am new to cake and I am trying to complete the blog tutorial
 in the manual for 1.3  for getting started.  I am at the edit post
 section and I am having a problem.  When I click edit I get and sql
 syntax error.

 1064: You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near 'edit' at line 1

 the output sql query is :

 SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`, `Post`.`created`,
 `Post`.`modified` FROM `posts` AS `Post` WHERE `Post`.`id` = 1 LIMIT 1

 which when pasted into the sql cmd editor in myadmin comes out fine no
 errors.

 can anyone help me out here?

 details:

 php 5.2.4
 mysql 5.0.24a

 here is my edit function

         function edit($id){
                 $this-Post-edit($id);
                 if(empty($this-Post-data)){
                         $this-data = $this-Post-read();
                 }else{
                         if($this-Post-save($this-data)){
                                 $this-Session-setFlash('Your post has been 
 updated.');
                                 $this-redirect(array('action'='index'));
                         }
                 }
         }

 I appreciate the help.

 BlaineRumsey

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 404 Error in Debug Mode

2010-07-07 Thread Andy Dirnberger
The 404 page is the same. When an error occurs in production mode, the
site will return a 404 instead of the actual error. That's the only
difference in how 404s are handled.

The difference that may be tripping you up is that when debug is set
to 1+ there is an HTML comment appended to the end of your output with
how long it took to build the page. This causes problems with requests
through things like Ajax and Flash. You can see an example of how to
handle the debug setting for Ajax here:
http://book.cakephp.org/view/1292/Obtaining-Request-Information. While
this doesn't directly address your Java applet, hopefully it can get
you started on the right path.

On Jul 7, 12:33 am, jonathan jlspecto...@gmail.com wrote:
 Hi All,

 Working in CakePHP 1.3 and really digging it.  I am having one
 particular issue and I am hoping someone could point me in the right
 direction.

 I have a third-party Java applet in my view and as long as the debug
 level is 0 in core.php, it runs fine.  If I set debug to 1 or higher,
 it fails to load.  All things point to the 404 error being different
 for the different debug levels (i.e. 0 gives one type of 404 error, 1+
 gives another).

 Is there a way to simulate the non-debug mode 404 error while debug
 mode is set to 1+?  I tried messing with custom error404 files but
 didn't get very far.

 Thanks much for any assistance,

 Jonathan

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: admin routing.prefix

2010-06-13 Thread Andy Dirnberger
Sounds like you have private function admin_login() in
UsersController. Try public function admin_login() instead.

On Jun 13, 7:05 pm, Davor Ilic webfa...@gmail.com wrote:
 with this i mean this 
 link:http://groups.google.com/group/cake-php/browse_thread/thread/4a445f48...

 2010/6/14 Davor Ilic webfa...@gmail.com



  i´ve forgot to say i´ve try this but i only get this issue to ad an method
  with : admin_admin_login()

  and if i comment  Configure::write('Routing.prefixes', array('admin')); it
  works but when it try to login it gives me back the login site again i do
  not know what i am doing wrong...

  2010/6/14 Davor Ilic webfa...@gmail.com

  Hi caker,

  i try to use the Prefix Route from cake to say which of my root the admin
  is but i have some issue to get to the right site because i do not wanna 
  for
  the user to say them the hole root where they have to go like this
  /admin/users/login

  i just wanna say add in the after .com/  admin.

  i ask this because Route.prefix don´t allow me if i use this url:
 http://mysite.com/admin

  it gives me an error back:

  Private Method in UsersController

  *Error: **UsersController::**admin_login()* cannot be accessed directly.
  what i have to do to make it work?

  i also have this in my route :

   *Router::connect('/admin', array('controller' = 'users', 'action' =
  'admin_login'));*

   be accessed directly.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: can i use html5 in cakephp?

2010-06-09 Thread Andy Dirnberger
According to the W3C, they expect to reach the recommendation
milestone for HTML5 in Q3 2010. 
http://www.w3.org/2007/03/HTML-WG-charter.html#deliverables

On Jun 9, 11:11 pm, calvin cal...@rottenrecords.com wrote:
 You can use whatever you want, but HTML5 is nowhere near completion.
 It's not even expected to become a W3C recommendation until 2022, and
 few browsers besides Chrome and Safari even support half of the
 specification.

 On Jun 9, 6:40 am, ytbryan ytbr...@gmail.com wrote:



  how do I render html element in cakephp?

  Thanks!

  /Bryan

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: $pageTitle not working

2010-06-01 Thread Andy Dirnberger
I got around this by adding the following to
AppController::beforeRender until I was able to clean up the
controllers.

if (!empty($this-pageTitle)) {
  $this-set('title_for_layout', $this-pageTitle);
}

On May 31, 11:27 pm, Miles J mileswjohn...@gmail.com wrote:
 This was the one thing I hated that they changed. Took me the longest
 to go through and update every controller.

 The time spent changing this was greater than the time spent upgrading
 to 1.3 as a whole.

 On May 31, 6:03 pm, Sergei yatse...@gmail.com wrote:



  $this-pageTitle was removed in 1.3. Use only $this-

  set( title_for_layout, First Page ) in controller or template.

  On Jun 1, 8:21 am, SeeVik vikramvmalhotra1...@gmail.com wrote:

   Hello all

   I just started with CakePHP 1.3.1. I am trying to set the title of a
   page. I have defined the title_for_layout in the default layout as
   well, still the view does not get the title I want. Instead it
   displays the name of controller. Although setting the title_for_layout
   in the view template works fine. Here's what I am doing

   // /app/controllers/nodes_controller.php
   class NodesController {
     $name = Nodes;
     $uses = array();
     $helpers = array( Html );
     function index() {
        $this-pageTitle = First Page; // This does not work
     }

   }

   // /app/views/nodes/index.ctp
   php $this-set( title_for_layout, First Page ); // This works ?

   What am I doing wrong here? Can somebody help me out.

   Thanks and Regards
   ShiVik

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Getting .htpasswd protection to work

2010-06-01 Thread Andy Dirnberger
While that may be your FTP user's full path, it most likely isn't your
server's full path. Try putting a file in webroot with the line:
echo __FILE__;

For example, putting that line in a file called path.php will probably
give you /full/path/to/app/webroot/path.php rather than just /app/
webroot/path.php.

On Jun 1, 11:16 pm, Jeff jhull...@gmail.com wrote:
 Hi Andy,

 Actually that is my full path.  At least when I FTP to my server,
 immediately in the root directory / is the app folder.  Is there
 anything else that could be wrong?

 Thanks

 On May 12, 9:20 pm, Andy Dirnberger andy.dirnber...@gmail.com wrote:



  You need to use /the/full/path/to/app/.htpasswd.

  On May 12, 11:17 pm, Jeff jhull...@gmail.com wrote:

   Hi, I have the following in my /app/webroot/.htaccess file, as well as
   a matching .htpasswd file in the correct directory per multiple online
   how-to's, but my password protection is not working.  Can someone tell
   me what I am doing wrong?

   /app/webroot/.htaccess

   AuthUserFile /app/.htpasswd
   AuthName Restricted Area
   AuthType Basic
   require valid-user

   IfModule mod_rewrite.c

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

   /IfModule

   I saw one tutorial that said I needed to find httpd.conf or something
   to that effect, but I don't see anything.  Maybe this config file
   doesn't exist with the Cake setup

   Any help is GREATLY appreciated.

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
   with their CakePHP related questions.

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

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 1.3 prefix routing.

2010-05-28 Thread Andy Dirnberger
In your controller, the current prefix is stored in $this-
params['prefix']. It's also available through Router::currentRoute()-
defaults['prefix'].

On May 27, 6:45 pm, aleph1 cubeythero...@gmail.com wrote:
 I can't see how to retrieve the current prefix that is being used for
 routing purposes.

 For example, if I configure Routing.prefixes as follows:

 Configure::write('Routing.prefixes', array('admin','moderator'));

 How do I retrieve the current prefix when a page is viewed?

 In 1.2 this was Configure::read('Routing.admin');, but I can't seem to
 find an equivalent for 1.3.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: case sensitivity on certain hosting

2010-05-27 Thread Andy Dirnberger
Does that host have a users folder at ..users?

On May 27, 11:37 am, leo ponton@gmail.com wrote:
 I'm having a problem on one of our hostings with case sensitivity.
 Strangely, it is only on the 'users' controller.

 If I do '..users/login' it doesn't work. If I do '..Users/login' it
 does.
 If I move the application to a subfolder, it works for both upper and
 lower cases.
 No other controllers are affected.
 It leads to problems downstream when auth starts writing urls in
 lowercase.

 Anybody seen this before and/or have a solution?

 Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How can I consolidate conditions that I will use for every find?

2010-05-22 Thread Andy Dirnberger
This is just a rough idea and will need to be completed (and probably
improved some), but hopefully it can get you started.

In AppModel:

var $schedule_id;

function find($conditions = null, $fields = array(), $order = null,
$recursive = null) {
  if (is_array($conditions)) {
if (!array_key_exists('conditions', $conditions))
$conditions['conditions'] = array();
$conditions['conditions']['schedule_id'] = $this-schedule_id;
  }
  else if (is_array($fields)) {
if (!array_key_exists('conditions', $fields))
$fields['conditions'] = array();
$fields['conditions']['schedule_id'] = $this-schedule_id;
  }

  return parent::find($conditions, $fields, $order, $recursive);
}

And then in your controller:

$this-Model-schedule_id = $schedule_id;
$result = $this-Model-find(...);

On May 22, 10:07 am, shantamg jason.galu...@gmail.com wrote:
 @Andrel: I'd love to be able to set the conditions in the model, but
 the model can't know what's in the session!

 @Paul:

   $this-Person-contain('Hobby', 'Job');

  I've never seen anyone set containable options like above, I thought
  they had to be within the find options array

 http://book.cakephp.org/view/857/Containing-deeper-associations

  I don't see how your conditions array can be set the same for every
  model within your schema as I doubt every model is directly associated
  to People for the conditions People.schedule_id to work.

 Every model is related to the Schedule model. So I was thinking of
 something like this in the appController:

 $this-{$model}-conditions-array('schedule_id' = $schedule_id);

 but i don't think that will work...
 Also, every related model has to be given those conditions in the
 containable:

 $this-[$model}-contain(
     {$related_model1}.schedule_id = $schedule_id,
     {$related_model2}.schedule_id = $schedule_id
 );

  And what about the finds where a user is not logged in/has not created
  a session, they can't have a schedule_id set?

 No user has to be logged in. I am doing this in the appController:

 function beforeFilter() {
     // put the latest published schedule into the session
     if (!$this-Session-check('Schedule')) {
         $schedule = ClassRegistry::init('Schedule')-find('first',
                 array('order' = 'id desc')
         );
         $this-Session-write('Schedule', $schedule['Schedule']);
     }

 }

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problems with URLs causing flash too break

2010-05-18 Thread Andy Dirnberger
Do you have a crossdomain.xml file?

On May 17, 8:21 pm, Cycling_Joe joespran...@gmail.com wrote:
 Can anyone guide me to what I am doing wrong.
 If the www is omitted in my url's it causes my flash  files to break.
 If I go tohttp://www.mysite.comeverything is fine.
 If I go tohttp://mysite.comall my flash files show undefined

 Or is there an easy way to redirect any request missing the 
 wwwhttp://mysite.com/somepage tohttp://www.mysite.com/somepage

 Any ideas/links would be helpful.
 Sorry, brand new to Cake and need to fix this quick.
 Thanks

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Front-end for end-users and admins design

2010-05-18 Thread Andy Dirnberger
You may want to take a look at prefix routing (admin routing prior to
1.3) http://book.cakephp.org/view/950/Prefix-Routing.

On May 18, 9:58 am, Andrei Mita andrei.m...@gmail.com wrote:
 Thank Renato. Actually I was thinking to develop two separate cake apps: one
 to run the website for the end-users and one, nested inside the main cake
 app, to run the administration panel.

 for instance: mywebsite.com for end-users and mywebsite.com/oven for admins

 Any other suggestions?

 On Tue, May 18, 2010 at 4:27 PM, Renato de Freitas Freire 





 renat...@gmail.com wrote:
  I like to do all the client system first, then I do another system,
  completly diferent to admin stuff.
  Even cake having the admin route, I dont like to use it.
  That way, I can put it in another url, so, guessing my admins urls is not a
  trivial thing...
  so, if one day, someone find a bug in cake admin route, my systems will be
  safe.

  I just heard that there is some robots scanning cake's urls for an open
  scafold. So, I just want to prevent this things.
  I dont know if it is the better way, but the work is the same.

  sry my bad english.

  --
  Renato de Freitas Freire
  ren...@morfer.org

  On Tue, May 18, 2010 at 5:38 AM, Andrei Mita andrei.m...@gmail.comwrote:

  Hello,

  I'm getting ready to start a real project using Cake and the first
  question is: how to separate controllers, actions and views for end-users
  and admins.

  I mean, is there a recommended way of doing the splitting or is it enough
  to create separate actions for end-users and for admins?

  For instance is it OK to have in Articles controller index() and
  admin_index() ?

  Thanks

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others with their CakePHP related questions.

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

   Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others with their CakePHP related questions.

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

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Getting .htpasswd protection to work

2010-05-12 Thread Andy Dirnberger
You need to use /the/full/path/to/app/.htpasswd.

On May 12, 11:17 pm, Jeff jhull...@gmail.com wrote:
 Hi, I have the following in my /app/webroot/.htaccess file, as well as
 a matching .htpasswd file in the correct directory per multiple online
 how-to's, but my password protection is not working.  Can someone tell
 me what I am doing wrong?

 /app/webroot/.htaccess

 AuthUserFile /app/.htpasswd
 AuthName Restricted Area
 AuthType Basic
 require valid-user

 IfModule mod_rewrite.c

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

 /IfModule

 I saw one tutorial that said I needed to find httpd.conf or something
 to that effect, but I don't see anything.  Maybe this config file
 doesn't exist with the Cake setup

 Any help is GREATLY appreciated.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: array dump

2010-05-10 Thread Andy Dirnberger
http://book.cakephp.org/view/1128/debug

On May 10, 9:06 pm, bradmaxs b...@pezzano.com wrote:
 Can anyone tell me how to get:

 Array
 (
     [0] = Array
         (
             [Portfolio] = Array
                 (
                     [id] = 1
                     [user_id] = 0
                     [url] = 29thstreetrep.com
                     [description] = Off-Broadway New York City
 theater company known for its brutal play selections.
                     [domain_start] = 1999-08-02
                     [domain_expire] = 2011-08-02
                     [domain_owner] = David Mogentale
                     [host] = BMCO
                     [category] = theatre
                     [status] = current
                     [img] = portfolio_29thstreetrep.gif
                     [created] =
                     [modified] =
                 )

 IN MY VIEW??

 I have done it in the past and somehow didn't keep the code snippet
 around.

 Has it changed in 1.3 now that debug 3 is gone?

 I do have the echo $this-element('sql_dump'); but it does not have
 the array data.

 thanks

 Brad

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 1.3 omit attribute

2010-05-09 Thread Andy Dirnberger
I agree. While the for attribute is optional, Cake assigns an id
attribute to your inputs so it only makes sense that it would assign a
for attribute to the associated label.

You said you aren't using the label with an input field, which is the
purpose of the label element. If that really is the case then you need
to find a different element for your table column header. Since you
said you are using th elements, I'm not really sure why you need the
label. What is your desired HTML output?

On May 9, 3:32 pm, euromark dereurom...@googlemail.com wrote:
 i dont think the for element should be omitted for labels
 as it is part of it - there are lots of other xhtml elements that
 would be more appropriate if there is no id to refer to

 On 9 Mai, 20:21, Zaky Katalan-Ezra procsh...@gmail.com wrote:





  I use th for column headers, thank you.
  But this wasn't my question.
  How do I omit the automated 'for'  attribute for the $this-Html-label.

  On Sun, May 9, 2010 at 1:01 AM, Andy Dirnberger
  andy.dirnber...@gmail.comwrote:

   Labels are supposed to be used with input fields. You should be using
   th for table column headers.

   On May 8, 4:13 pm, ZAky procsh...@gmail.com wrote:
I am trying to omit the auto generated  'for' attribute for
   $this-Html-label with no success.

I tried:
$this-Form-label('status','Status',array('for'=false [or] null));

and this

$this-Form-label('status','Status',array('label'=array('for'=false
[or] null)));

Just using ?php echo $this-Form-label('status');? produce
label for=statusStatus/label
When I use it for table columns header I have no element with
id=status.
The W3C Validation Service also arise a warning about it.

Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
   with their CakePHP related questions.

You received this message because you are subscribed to the Google 
Groups
   CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c
 omFor more options, visit this group athttp://
   groups.google.com/group/cake-php?hl=en

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
   with their CakePHP related questions.

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

  --
  Regards,
  Zaky Katalan-Ezra
  QA Administratorwww.IGeneriX.com
  Sites.IGeneriX.com
  054-7762312

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

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

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 1.3 omit attribute

2010-05-08 Thread Andy Dirnberger
Labels are supposed to be used with input fields. You should be using
th for table column headers.

On May 8, 4:13 pm, ZAky procsh...@gmail.com wrote:
 I am trying to omit the auto generated  'for' attribute for 
 $this-Html-label with no success.

 I tried:
 $this-Form-label('status','Status',array('for'=false [or] null));

 and this

 $this-Form-label('status','Status',array('label'=array('for'=false
 [or] null)));

 Just using ?php echo $this-Form-label('status');? produce
 label for=statusStatus/label
 When I use it for table columns header I have no element with
 id=status.
 The W3C Validation Service also arise a warning about it.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how to select from subquery result

2010-05-07 Thread Andy Dirnberger
Why use the subquery?

SELECT * FROM mytable WHERE some_id = 1 GROUP BY block_id HAVING
MAX(date)

or:

$Model-find('all', array(
  'conditions' = array('Model.some_id' = 1),
  'group' = ('Model.block_id HAVING MAX(date)'),
);

On May 7, 6:16 am, Eleazar gerrit.kru...@gmail.com wrote:
 Hello
 for the life of me I coudn't find an example of how to do the
 following:
 SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
 DESC) t1 GROUP BY block_id

 The query needs to select the latest entries for each block_id in the
 table (like selecting the latest comment for each blog post would be
 an equivalent scenario).

 I would need to implement this with pagination, but I would just like
 to get it to work with find() for now.

 Is a custom query maybe the only way to do this?

 Thanks!

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how to select from subquery result

2010-05-07 Thread Andy Dirnberger
So you want the block_ids that have the most recent date, not the most
recent date for each block_id?

On May 7, 1:23 pm, Eleazar gerrit.kru...@gmail.com wrote:
 unfortunately that query does not produce the rusult I want. The
 HAVING MAX() seems logical but it doesn't change the results. Problem
 is that the group function groups by seemingly random record, not the
 latest one. If I could sort by date then group that would work, but
 sql does not allow this. Therefore my subquery to fix the problem.

 See this article of what I want to 
 do:http://dev.mysql.com/doc/refman/4.1/en/example-maximum-column-group-r...
 If you look in the comments section you will see the query I'm trying
 to implement.

 A very strange thing occurred. I called my custom query with some
 joins (basically the one generated by a find, and wrapped with a
 select statement as in my first post) model-query(sql). It works fine
 on my localhost but on the online server the array returned from the
 query is in the form of the alias from the query eg
 [0] - [alias] - all values listed here from all tables joined in
 query
 [1] - etc.

 On the localhost it keeps the format of
 [0]-[Original table name]-values,
        [original table name 2]-values
 [1]- etc.

 What on earth could cause this? I have no idea where to begin! Why is
 the returned array not formatted  in the usual way? Why would it work
 on the localhost but not on the online server? Any ideas will be
 appreciated!

 On May 7, 4:08 pm, Andy Dirnberger andy.dirnber...@gmail.com wrote:





  Why use the subquery?

  SELECT * FROM mytable WHERE some_id = 1 GROUP BY block_id HAVING
  MAX(date)

  or:

  $Model-find('all', array(
    'conditions' = array('Model.some_id' = 1),
    'group' = ('Model.block_id HAVING MAX(date)'),
  );

  On May 7, 6:16 am, Eleazar gerrit.kru...@gmail.com wrote:

   Hello
   for the life of me I coudn't find an example of how to do the
   following:
   SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
   DESC) t1 GROUP BY block_id

   The query needs to select the latest entries for each block_id in the
   table (like selecting the latest comment for each blog post would be
   an equivalent scenario).

   I would need to implement this with pagination, but I would just like
   to get it to work with find() for now.

   Is a custom query maybe the only way to do this?

   Thanks!

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
   with their CakePHP related questions.

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

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

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

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cakephp Ajax is not including the javascripts in the view

2010-04-30 Thread Andy Dirnberger
I believe the src attribute of any script tag loaded through an Ajax
call is ignored; all JavaScript needs to be included in the original
page load or embedded directly in the response.

On Apr 30, 3:23 am, Vijay k.vidn...@gmail.com wrote:
 Thanks for reply andrei.

 I am calling the normal javascript functions or any javascript file.
 I have some jquery effects for the text boxes  drop downs. That are
 not including when the ctp get called.

 my code is,

 ?php
 echo $html-css('mycss);

 echo $html-script(array('jquery', 'another script'));?

 rest my html code

 It is including the css but no js is included.
 here i am using jquery with prototype.

 On Apr 30, 12:10 pm, Andrei Mita andrei.m...@gmail.com wrote:





  What type of js do you have in the loaded ctp?

  Maybe you forgot to include something in the layout.

  It's a blind guess without seeing the actual code. At least for me.

  On Fri, Apr 30, 2010 at 9:23 AM, Vijay k.vidn...@gmail.com wrote:
   Hello All,

   I am using the ajax for the internal links in my site.

   When i click on the link  the new ctp loads, it is not including the
   javascripts that are included in that ctp.
   So the effects are not working.

   It includes the css but not including the javascript.

   Any idea.

   Thanks,

   Vijay Kumbhar,
   CTO, Weboniselab.
   9766251100

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
   with their CakePHP related questions.

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

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

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

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: wordpress integration without seperate url

2010-04-29 Thread Andy Dirnberger
I think mex is talking about dropping WordPress right into the webroot
folder with the ultimate goal being to have http://www.example.com/users
going to UsersController in Cake and http://www.examples.com/some-post/
going to WordPress. The problem is, .htaccess would have no easy way
of knowing for which system to rewrite the URL. There needs to be
something in the URL to trigger one system over the other.

The only solution I can think of that isn't a complete nightmare of
rewrite rules is to not use mod_rewrite with WordPress, and put in
rewrite rules for things like p= and s=. And if you wanted to use
WordPress's home page you'd need to add a rule for /.

On Apr 29, 10:18 am, Andrei Mita andrei.m...@gmail.com wrote:
 What do you mean by dont want it to be on a seperate url like /blog?

 You don't want it to be domain.com/blog ?





 On Thu, Apr 29, 2010 at 4:35 PM, meximex meixne...@gmail.com wrote:
  no solutions

  On 23 Apr., 09:19, meximex meixne...@gmail.com wrote:
   hi,
   i would like to include wordpress into my cakephp application but i
   dont want it to be on a seperate url like /blog.

   reasons for that are that the users looses his session inside the
   site, looses the usermenu (i know i could do that by ajax..)

   isnt there a way to just include the blog files?

   btw. i am looking for a forum that can be included very easy
   too... ;-)

   regards,
   mex

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
  with their CakePHP related questions.

   You received this message because you are subscribed to the Google Groups
  CakePHP group.
   To post to this group, send email to cake-php@googlegroups.com
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c
omFor more options, visit this group athttp://
  groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

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

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Validate on

2010-04-22 Thread Andy Dirnberger
Check the Cookbook http://book.cakephp.org/view/127/One-Rule-Per-Field

On Apr 22, 10:10 am, Angelo angelo.maior...@gmail.com wrote:
 Hello,

 I juste discover ina blog article that we can use a on value in
 $validate array.

 Is there somewehere documentation about all value we can put in
 $validate array?

 Thanks!

 Angelo

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Checking multiple columns for duplication checking in model

2010-04-22 Thread Andy Dirnberger
My example does not compare field1 and field2 for uniqueness against
each other, it compares field1 and field2 against the database. When
creating a new record, it will check that the combination of
field1+field2 doesn't already exist in the database. When updating a
record it will check that the combination of field1+field2 doesn't
exist in the database unless the primary key of the submitted data
matches the primary key of the record in the database.

On Apr 22, 3:02 pm, John Andersen j.andersen...@gmail.com wrote:
 Thanks Euromark,

 I actually don't think that PHP code is the correct solution to this
 check :) I think that the correct solution is to let the database
 handle the unique check. The model will then be passed back the error
 and will take action on it (by the code we write). Probably there
 should be a translation of the error codes in between the database and
 the model (datasource?).

 The code that Andy D. (sample) and you posted will, as far as I
 understand, only handle the case of ensuring uniqueness in the
 submitted data, not in both the submitted data and the existing data
 in the table. Correct me if I am wrong :)

 Enjoy,
    John

 On Apr 22, 6:08 pm, euromark dereurom...@googlemail.com wrote:
 [snipped code from euromark]

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Checking multiple columns for duplication checking in model

2010-04-21 Thread Andy Dirnberger
Here's a stripped down example of how I do it:

app_model.php
class AppModel extends Model {

  ...

  function isUniqueMulti($data, $fields) {
if (!is_array($fields)) {
  $fields = array($fields);
}

foreach ($fields as $key) {
  $tmp[$key] = $this-data[$this-name][$key];
}

return $this-isUnique($tmp, FALSE);
   }
}

some_model.php
class SomeModel extends AppModel {
  var $validate = array(
'field1' = array(
  'rule' = array('isUniqueMulti', array('field1', 'field2')),
  'required' = TRUE,
  'message' = 'Error Message',
),
'field2' = array(
  'rule' = 'notEmpty',
  'required' = TRUE,
  'message' = 'Error Message',
),
  );
}

On Apr 21, 8:40 am, Swanny stuarts...@gmail.com wrote:
 Is there a way in a model to verify that a record does not exist
 already that matches a certain criteria. In the database table are
 three columns: id, list_id and product_id. I would like to be able to
 tell if there already exists a record with the same list_id AND
 product_id as the one being added using the form which would then
 produce an error as this would be a duplicate.

 Example: I try to add a product with product_id 23 and list_id 12 but
 the table already contains a record with this information.

 Thanks

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Multi-level Models in CakePHP

2010-04-21 Thread andy
Ah, that's interesting!
Thanks again for the help.

Andy

On Apr 21, 2:19 am, WebbedIT p...@webbedit.co.uk wrote:
  wouldn't one be able to use $this-Model-unbindModel() to take away any 
  unwanted, extra associations?

 Yes, but that's exactly why Containable was written, it's a
 convenience wrapper that binds/unbinds all the relevant models based
 on the info you supply in the contain array of your find call ... no
 need to do it manually?

 HTH

 Paul

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: is it advisable to use jquery on cakephp?

2010-04-19 Thread Andy Dirnberger
Check out JsHelper in 1.3 
http://book.cakephp.org/view/1594/Using-a-specific-Javascript-engine

On Apr 19, 10:17 am, Bryan Lim ytbr...@gmail.com wrote:
 question as above.
 I also want to ask if there's an official jquery helper for cakephp?
 The one at the bakery is kinda outdated.

 thanks!
 Bryan

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Multi-level Models in CakePHP

2010-04-19 Thread andy
Even with recursion, however, wouldn't one be able to use $this-Model-
unbindModel()  to take away any unwanted, extra associations?

http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly

It's all very likely that I didn't have correct associations
earlier... so that Walther's containable way didn't work with the
sample code.  But the A, B, and C associations listed above were the
same pattern as the full-name models.  So I couldn't find out why
containable wasn't including that third level (C) with the rest of the
results.

Thanks for the tip on containable...

Andy


On Apr 19, 12:04 am, WebbedIT p...@webbedit.co.uk wrote:
 Recursive may do the trick, but you should be getting your head around
 containable here and if your associations are correct the code Walther
 provided should have worked.

 Problem with recursive is if ModelA or ModelB are associated to other
 models it will go fetch them too as there is no way with recursive to
 select exactly the models you want.

 Spend some time with containable till you get your head around it, it
 is very much worth it!

 HTH

 Paul

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Multi-level Models in CakePHP

2010-04-16 Thread andy
Walther,

Thanks for the comment... but that line of code also only produces a
result of ATable and BTable.  Still looking for a way...


Sorry about the naming... I only figured that giving simplified model
names would have made it easier to see that I'm just trying to make a
multi-level model relationship.  The real model names get longer as
the level gets deeper.  For example:

ScheduleTemplate hasMany ScheduleTemplateBlocks
ScheduleTemplateBlocks hasMany ScheduleTemplateBlockTableColumns
ScheduleTemplateBlockTableColumns belongsTo ScheduleTemplateBlocks


ATable hasMany BTable
BTable hasMany CTable
CTable belongsTo BTable

I chose that route for readability, but I can keep it in mind for next
time.
Thanks



On Apr 15, 10:20 pm, Walther waltherl...@gmail.com wrote:
 Alan gave the wrong syntax for containable. It is:

 $this-ATable-find('all',
 array('contain'=array('BTable' = array('CTable';

 And Andy, in the future please use real model names, makes it much
 easier to see what is happening and sometimes people make mistakes
 when converting to the alphabet models.

 On Apr 16, 5:12 am, andy sum...@gmail.com wrote:





  Hi Alan,

  Thanks for the idea.  I tried using 'contain' just now and I still am
  just seeing ATable and BTable results in the returned array.  I'll
  keep playing around with containable anyhow...

  Andy

  On Apr 15, 7:16 pm, Alan Asher a...@asteriskpound.com wrote:

   I think you need a contain to include the third table.

   $this-ATable-find('all',
   array('contain'=array('BTable','BTable.CTable')));

   That's just off the hip

   Alan

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

   Of andy
   Sent: Thursday, April 15, 2010 6:25 PM
   To: CakePHP
   Subject: Re: Multi-level Models in CakePHP

   Or maybe I'm trying to go for returned data in this type of format...
   though I don't know if it's possible:

    Array
    (
        [0] = Array
            (
                [ATable] = Array
                    (
                        [id] = 1
                        [name] = A
                        [weight] = 1
                    )

                [BTable] = Array
                    (
                        [id] = 1
                        [name] = B
                        [a_table_id] = 1
                        [weight] = 1

                        Array
                        (
                                 [0] = Array
                                          (
                                                    [CTable] = Array

   (

   [id] = 1

   [name] = C

   [b_table_id] = 1

   [weight] = 1
                                                                          )
                                           )
                        )
                  )

            )

    )

   On Apr 15, 5:38 pm, andy sum...@gmail.com wrote:
Has anyone successfully been able to do something like this?  (I'm
using CakePHP 1.3 RC4)

I have three models:

class ATable extends AppModel {

    var $name = 'ATable';
    var $hasOne = array('BTable' = array( 'foreignKey' = false,
                                            'type' = 'INNER',
                                            'conditions' = array(
                                                'BTable.a_table_id =
ATable.id') )
                        );

}

class BTable extends AppModel {

    var $name = 'BTable';
    var $hasOne = array('CTable' = array( 'foreignKey' = false,
                                            'type' = 'INNER',
                                            'conditions' = array(
                                                'CTable.b_table_id =
BTable.id') )
                        );

}

class CTable extends AppModel {

    var $name = 'CTable';

}

And I have the following MySQL tables:

CREATE TABLE a_tables (
    id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255),
    schedule_template_id INT(11),
    weight INT(11)
);

INSERT INTO a_tables (name, weight)
    VALUES ('A', 1);

CREATE TABLE b_tables (
    id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255),
    a_table_id INT(11),
    weight INT(11)
);

INSERT INTO b_tables (name, a_table_id, weight)
    VALUES ('B', 1, 1);

CREATE TABLE c_tables (
    id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255),
    b_table_id INT(11),
    weight INT(11)
);

INSERT INTO c_tables (name, b_table_id, weight)
    VALUES ('C', 1, 1);

In my a_tables_controller.php file it looks like the following:

class ATablesController extends AppController {

    var $name = 'ATables';

    function index() {
        $this-set('a_var', $this-ATable-find('all'));
    }

}

And I am expecting CakePHP to set

Re: Multi-level Models in CakePHP

2010-04-16 Thread andy
Using recursive seems to be a way to go about it:

$this-set('a', $this-ATable-find('all', array('recursive' =
'2')));


I found this via the following post:

http://stackoverflow.com/questions/137314/three-table-related-model-in-cakephp


Hope that helps someone.

Andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Multi-level Models in CakePHP

2010-04-15 Thread andy
Has anyone successfully been able to do something like this?  (I'm
using CakePHP 1.3 RC4)


I have three models:

class ATable extends AppModel {

var $name = 'ATable';
var $hasOne = array('BTable' = array( 'foreignKey' = false,
'type' = 'INNER',
'conditions' = array(
'BTable.a_table_id =
ATable.id') )
);

}

class BTable extends AppModel {

var $name = 'BTable';
var $hasOne = array('CTable' = array( 'foreignKey' = false,
'type' = 'INNER',
'conditions' = array(
'CTable.b_table_id =
BTable.id') )
);

}

class CTable extends AppModel {

var $name = 'CTable';

}



And I have the following MySQL tables:

CREATE TABLE a_tables (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
schedule_template_id INT(11),
weight INT(11)
);

INSERT INTO a_tables (name, weight)
VALUES ('A', 1);


CREATE TABLE b_tables (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
a_table_id INT(11),
weight INT(11)
);

INSERT INTO b_tables (name, a_table_id, weight)
VALUES ('B', 1, 1);


CREATE TABLE c_tables (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
b_table_id INT(11),
weight INT(11)
);

INSERT INTO c_tables (name, b_table_id, weight)
VALUES ('C', 1, 1);




In my a_tables_controller.php file it looks like the following:

class ATablesController extends AppController {

var $name = 'ATables';

function index() {
$this-set('a_var', $this-ATable-find('all'));
}

}



And I am expecting CakePHP to set a variable that looks like the
following:

Array
(
[0] = Array
(
[ATable] = Array
(
[id] = 1
[name] = A
[schedule_template_id] =
[weight] = 1
)

[BTable] = Array
(
[id] = 1
[name] = B
[a_table_id] = 1
[weight] = 1
)

[CTable] = Array
(
[id] = 1
[name] = C
[b_table_id] = 1
[weight] = 1
)

)

)




But in reality... this is all I am getting back (just the first two
models):

Array
(
[0] = Array
(
[ATable] = Array
(
[id] = 1
[name] = A
[schedule_template_id] =
[weight] = 1
)

[BTable] = Array
(
[id] = 1
[name] = B
[a_table_id] = 1
[weight] = 1
)

)

)



Any idea why CakePHP isn't giving me a complete tree of results?  I
read about something similar happening for someone else at this link:
http://groups.google.com/group/cake-php/browse_thread/thread/2f1922523c17/9b2db4b7a05ce1e8?lnk=gstq=hasmany+hasmany#

And it sounds like something that was addressed with CakePHP 1.3.  So
I'm using 1.3 (RC4)... yet it doesn't seem to allow me to use multi-
level models.

Thanks for any help,
Andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Multi-level Models in CakePHP

2010-04-15 Thread andy
Or maybe I'm trying to go for returned data in this type of format...
though I don't know if it's possible:

 Array
 (
 [0] = Array
 (
 [ATable] = Array
 (
 [id] = 1
 [name] = A
 [weight] = 1
 )

 [BTable] = Array
 (
 [id] = 1
 [name] = B
 [a_table_id] = 1
 [weight] = 1

 Array
 (
  [0] = Array
   (
 [CTable] = Array
 
(
 
[id] = 1
 
[name] = C
 
[b_table_id] = 1
 
[weight] = 1
   )
)
 )
   )

 )

 )



On Apr 15, 5:38 pm, andy sum...@gmail.com wrote:
 Has anyone successfully been able to do something like this?  (I'm
 using CakePHP 1.3 RC4)

 I have three models:

 class ATable extends AppModel {

     var $name = 'ATable';
     var $hasOne = array('BTable' = array( 'foreignKey' = false,
                                             'type' = 'INNER',
                                             'conditions' = array(
                                                 'BTable.a_table_id =
 ATable.id') )
                         );

 }

 class BTable extends AppModel {

     var $name = 'BTable';
     var $hasOne = array('CTable' = array( 'foreignKey' = false,
                                             'type' = 'INNER',
                                             'conditions' = array(
                                                 'CTable.b_table_id =
 BTable.id') )
                         );

 }

 class CTable extends AppModel {

     var $name = 'CTable';

 }

 And I have the following MySQL tables:

 CREATE TABLE a_tables (
     id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
     name VARCHAR(255),
     schedule_template_id INT(11),
     weight INT(11)
 );

 INSERT INTO a_tables (name, weight)
     VALUES ('A', 1);

 CREATE TABLE b_tables (
     id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
     name VARCHAR(255),
     a_table_id INT(11),
     weight INT(11)
 );

 INSERT INTO b_tables (name, a_table_id, weight)
     VALUES ('B', 1, 1);

 CREATE TABLE c_tables (
     id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
     name VARCHAR(255),
     b_table_id INT(11),
     weight INT(11)
 );

 INSERT INTO c_tables (name, b_table_id, weight)
     VALUES ('C', 1, 1);

 In my a_tables_controller.php file it looks like the following:

 class ATablesController extends AppController {

     var $name = 'ATables';

     function index() {
         $this-set('a_var', $this-ATable-find('all'));
     }

 }

 And I am expecting CakePHP to set a variable that looks like the
 following:

 Array
 (
     [0] = Array
         (
             [ATable] = Array
                 (
                     [id] = 1
                     [name] = A
                     [schedule_template_id] =
                     [weight] = 1
                 )

             [BTable] = Array
                 (
                     [id] = 1
                     [name] = B
                     [a_table_id] = 1
                     [weight] = 1
                 )

             [CTable] = Array
                 (
                     [id] = 1
                     [name] = C
                     [b_table_id] = 1
                     [weight] = 1
                 )

         )

 )

 But in reality... this is all I am getting back (just the first two
 models):

 Array
 (
     [0] = Array
         (
             [ATable] = Array
                 (
                     [id] = 1
                     [name] = A
                     [schedule_template_id] =
                     [weight] = 1
                 )

             [BTable] = Array
                 (
                     [id] = 1
                     [name] = B
                     [a_table_id] = 1
                     [weight] = 1
                 )

         )

 )

 Any idea why CakePHP isn't giving me a complete tree of results?  I
 read about something similar happening for someone else at this 
 link:http://groups.google.com/group/cake-php/browse_thread/thread/2f19...

 And it sounds like something that was addressed with CakePHP 1.3.  So
 I'm using 1.3 (RC4)... yet it doesn't seem to allow me to use multi-
 level models.

 Thanks for any help,
 Andy

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

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

Re: Multi-level Models in CakePHP

2010-04-15 Thread andy
Hi Alan,

Thanks for the idea.  I tried using 'contain' just now and I still am
just seeing ATable and BTable results in the returned array.  I'll
keep playing around with containable anyhow...

Andy


On Apr 15, 7:16 pm, Alan Asher a...@asteriskpound.com wrote:
 I think you need a contain to include the third table.

 $this-ATable-find('all',
 array('contain'=array('BTable','BTable.CTable')));

 That's just off the hip

 Alan



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

 Of andy
 Sent: Thursday, April 15, 2010 6:25 PM
 To: CakePHP
 Subject: Re: Multi-level Models in CakePHP

 Or maybe I'm trying to go for returned data in this type of format...
 though I don't know if it's possible:

  Array
  (
      [0] = Array
          (
              [ATable] = Array
                  (
                      [id] = 1
                      [name] = A
                      [weight] = 1
                  )

              [BTable] = Array
                  (
                      [id] = 1
                      [name] = B
                      [a_table_id] = 1
                      [weight] = 1

                      Array
                      (
                               [0] = Array
                                        (
                                                  [CTable] = Array

 (

 [id] = 1

 [name] = C

 [b_table_id] = 1

 [weight] = 1
                                                                        )
                                         )
                      )
                )

          )

  )

 On Apr 15, 5:38 pm, andy sum...@gmail.com wrote:
  Has anyone successfully been able to do something like this?  (I'm
  using CakePHP 1.3 RC4)

  I have three models:

  class ATable extends AppModel {

      var $name = 'ATable';
      var $hasOne = array('BTable' = array( 'foreignKey' = false,
                                              'type' = 'INNER',
                                              'conditions' = array(
                                                  'BTable.a_table_id =
  ATable.id') )
                          );

  }

  class BTable extends AppModel {

      var $name = 'BTable';
      var $hasOne = array('CTable' = array( 'foreignKey' = false,
                                              'type' = 'INNER',
                                              'conditions' = array(
                                                  'CTable.b_table_id =
  BTable.id') )
                          );

  }

  class CTable extends AppModel {

      var $name = 'CTable';

  }

  And I have the following MySQL tables:

  CREATE TABLE a_tables (
      id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
      name VARCHAR(255),
      schedule_template_id INT(11),
      weight INT(11)
  );

  INSERT INTO a_tables (name, weight)
      VALUES ('A', 1);

  CREATE TABLE b_tables (
      id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
      name VARCHAR(255),
      a_table_id INT(11),
      weight INT(11)
  );

  INSERT INTO b_tables (name, a_table_id, weight)
      VALUES ('B', 1, 1);

  CREATE TABLE c_tables (
      id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
      name VARCHAR(255),
      b_table_id INT(11),
      weight INT(11)
  );

  INSERT INTO c_tables (name, b_table_id, weight)
      VALUES ('C', 1, 1);

  In my a_tables_controller.php file it looks like the following:

  class ATablesController extends AppController {

      var $name = 'ATables';

      function index() {
          $this-set('a_var', $this-ATable-find('all'));
      }

  }

  And I am expecting CakePHP to set a variable that looks like the
  following:

  Array
  (
      [0] = Array
          (
              [ATable] = Array
                  (
                      [id] = 1
                      [name] = A
                      [schedule_template_id] =
                      [weight] = 1
                  )

              [BTable] = Array
                  (
                      [id] = 1
                      [name] = B
                      [a_table_id] = 1
                      [weight] = 1
                  )

              [CTable] = Array
                  (
                      [id] = 1
                      [name] = C
                      [b_table_id] = 1
                      [weight] = 1
                  )

          )

  )

  But in reality... this is all I am getting back (just the first two
  models):

  Array
  (
      [0] = Array
          (
              [ATable] = Array
                  (
                      [id] = 1
                      [name] = A
                      [schedule_template_id] =
                      [weight] = 1
                  )

              [BTable] = Array
                  (
                      [id] = 1
                      [name] = B
                      [a_table_id] = 1
                      [weight] = 1
                  )

          )

  )

  Any idea why CakePHP isn't giving me a complete tree

Re: Can I stop the page from re-rendering after a form submission?

2010-04-14 Thread Andy Dirnberger
Cake doesn't insist on anything. The nature of clicking a submit
button in a form is to submit the form. That means the browser sends
the post/get request to the server and loads the response. If you want
different behavior, you need to catch the submit event through
JavaScript and cancel it.

The most basic way is form ... onsubmit=return false;, although
this would block all submissions. You can do onsubmit=return
someFunction(); and have someFunction return true if you want to
submit the form, and return false if you don't. Or you can use a
library, like jQuery, and do something along the lines of $
('form').submit(function(e) { ... }); and conditionally call
e.preventDefault() if you don't want to submit the form.

You can also look into Cake's JavaScript helper.

On Apr 14, 7:02 am, WhyNotSmile sharongilmor...@googlemail.com
wrote:
 I have a question which may be very basic - I'm not sure whether I've
 just tied my brain in knots from thinking about it!  Apologies if so.

 I have a form which has various buttons.  One of them is a 'Preview',
 which pops up a new window (well, a PDF) when clicked.  At the moment,
 there is some javascript going on, which enables and disables various
 buttons when the page is loaded.  However, if the Preview button is
 clicked, I don't want the page to reload afterwards, because it will
 then apply these changes to the buttons, which I don't want...

 Cake seems to insist that I have to go somewhere after form submission
 (and for all the other buttons it does a reload of the current page,
 which is fine), so is there a way to stop this from happening?

 I hope that makes sense; I'm not sure I've explained it very well, but
 as I say, my brain is confused!

 Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: Allowing access to plugin pages

2010-04-09 Thread Andy Dirnberger
Try $this-Auth-allow('*'). I think the addition of array() is what's
tripping you up.

On Apr 9, 4:48 pm, TobyG toby.i.griffi...@googlemail.com wrote:
 Hi there,

 Just wondering how to grant access to a plugin page using Auth.

 Have tried using...

 $this-Auth-allow(array('*'));

 in the before filter for the controller app, which is being called,
 but it doesn't seem to make a difference.

 Any ideas?

 T

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: Yet another HABTM multiple checkbox query, cakePHP 1.3 RC3

2010-04-05 Thread Andy Dirnberger
Why are you trying to save to the relationship table? Cake will do
that for you automatically.

What does your view look like (at least the part that creates the
form)? Provided your HABTM is set up correctly in the models and view,
calling $this-Model-save($this-data) in the controller should be
sufficient.

On Apr 5, 9:12 am, tricky999 param3...@googlemail.com wrote:
 I'll apologise now! There seems to be loads of advice about HABTM in
 cake, but I still can't quite get the answer to my particular problem.

 I have two tables and a join_table.  On my view, I have created a
 form, which has a multiple checkbox.  The problem I am having is that
 this is not returned in a format that I can save it in.

 Using debug($this-data), I get this returned to my edit action:

 Array
 (
     [PortfolioEntry] = Array
         (
             [id] = 78
             [when] = Array
                 (
                     [day] = 04
                     [month] = 04
                     [year] = 2010
                 )

             [title] = Another test
             [description] = H, will this work I wonder?  It
 might, although if you do not include full stops it doesn't!
             [benefit] = Hello mucker.
             [activity_id] = 2
         )

     [KsfDimensionsPortfolioEntry] = Array
         (
             [portfolio_entry_id] = 78
             [ksf_dimension_id] = Array
                 (
                     [0] = 36
                     [1] = 37
                     [2] = 38
                     [3] = 39
                 )

         )

 )

 The PortfolioEntry bit is saved absolutely fine, however, when I try
 to update the join_table with the KsfDimensionsPortfolioEntry part, I
 get an SQL error, since the ksf_dimension_id is an array.
 I am pretty sure that this array should be something like:

 [KsfDimensionsPortfolioEntry] = Array
         (
            [0] = array(
                       [portfolio_entry_id] = 78
                       [ksf_dimension_id] = 36
             (
             [1] = array(
                       [portfolio_entry_id] = 78
                       [ksf_dimension_id] = 36
             )
       etc

 but I can't for the life of me come up with a 'cake' way of doing it!
 Any assistance would be gratefully received.

 Cheers.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: Retrieving objects from the DB instead of arrays

2010-03-30 Thread Andy Dirnberger
Why not perform your manipulations in afterFind? 
http://book.cakephp.org/view/681/afterFind

If you add an 'age' key to the result in the callback (my guess is you
store the date of birth in the database, not the current age), you can
then use $person['Person']['age'] in your view.

On Mar 30, 11:31 pm, paws_galuten jason.galu...@gmail.com wrote:
 I'm new to cakePHP and it seems like the only way to retrieve data
 from the data source is as an array. I'm finding that I am using a lot
 of code in my controller to prepare the arrays for display in the
 view, when I would rather be able to send an object to the view and
 get data from that object.

 For example, if I had a person object, I could have an attribute that
 was their birthdate and in the view I could easily get their age with
 something like $person-getAge(). If I only have the person as an
 array, then I have to do the calculating of the age before I can
 display it.

 Does this make sense? It is a simplistic example, but I can see myself
 having to write a lot of code to manipulate arrays before the raw
 database data is usable.

 Thanks for your insights,
 Jason

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using remove me as the subject.


Re: How use __consruct in model

2010-03-09 Thread Andy Dirnberger
You need to do two things:
1. Accept all of the parent constructor's parameters
2. Call the parent constructor

function __construct($id = false, $table = null, $ds = null) {
  parent::__construct($id, $table, $ds);

  ...

}

That said, I'm not exactly sure what you're doing with parent::$this-
VAR. You don't need parent::, and, if all you're doing to do in the
constructor is assign a few values, you can skip the constructor
altogether:
class TypeDeal extends AppModel {
  var $useTable = null;
  var $general = true;

  ...

}

On Mar 9, 1:10 am, Jets jatin.ger...@gmail.com wrote:
 Hi,  i am trying to use constructor in models. my code is that

 ?php
 class TypeDeal extends AppModel {
         var $name ='TypeDeal';

         var $validate =array(
         'id' = array('rule' = 'notEmpty', 'message' = 'Not Empty')
         );
         function __construct(){
         //      parent::$this-useTable=null;
                 //set the $generic variable for enabling the functions 
 defined in
 AppModel
                 parent::$this-generic=true;
         }

 }

 but its not working. can anyone tell me , how we can use this...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Calling custom methods in related models

2010-03-07 Thread Andy Dirnberger
  What happens if you change SisField::$hasMany to var $hasMany =
  array('SisQueue');?

 pardon for my dumbness but I did not understand what you are asking me
 to do...in the model hasMany is already var hasMany=


I'm asking you to change $hasMany from what you have to the shorter
version I posted.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Calling custom methods in related models

2010-03-06 Thread Andy Dirnberger
What happens if you change SisField::$hasMany to var $hasMany =
array('SisQueue');?

On Mar 6, 9:02 pm, mathaios mathaio...@gmail.com wrote:
 yes Paul this is the problem!

 $this-SisField-SisQueue-belongsTo does return an empty array
 instead of the real one. Clearly Cake is auto-creating the model.
 I have tested all other model related to SisField and none of them is
 the real one: all are re-created by Cake.

 Maybe it's related of this being a plug-in and could be a bug ?

 On Mar 6, 8:41 am, WebbedIT p...@webbedit.co.uk wrote:



  That looks correct to me, to test if the problem is with the function
  name put() I just added a method to one of my models and called it via
  another model from a controller without issue so that's not the
  problem.

  Can you access any of that models attributes/methods?  how about :

  echo debug($this-SisField-SisQueue-belongsTo);

  I think that cake is not finding the model for some reason and is
  therefore creating it's own auto-model which obviously will not
  include the put() method.  Confusing as your model's filename seems to
  be correct, but the above should test this.

  HTH

  Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Calling custom methods in related models

2010-03-04 Thread Andy Dirnberger
What is the actual name of model2 and what is its filename? If the
file isn't being found, model2 is of type AppModel and not model2,
which would explain why you can't access a method defined in model2.

On Mar 4, 12:36 pm, mathaios mathaio...@gmail.com wrote:
 Hallo all bakers! I hope someone can help me...

 I have two models related trough a to many-belongs to relationships.
 I've set in model2 a method called put that do some db manipulation.

 But when I call the put method from the related model1 controller
 (as $this-model1-model2-put() ) the method name get's executed like
 an SQL query!
 But if I call something like e.g. $this-model1-model2-find('all')
 records are correctly fetched.

 What can be the problem? I'm getting mad on this !
 Thanks for any advice

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: file upload with ajax

2010-03-03 Thread Andy Dirnberger
XMLHttpRequest cannot upload files. The two ways to give the
appearance of Ajax are with Flash (e.g., Uploadify, SWFUpload, etc.)
and with an iframe.

Either way, only the data from $_POST ends up in $this-data. To
access any uploaded files, you need to use $_FILES.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Question about relationships, extending the blog tutorial

2010-02-25 Thread Andy Dirnberger
Glad to hear you were able to get that resolved.

Check out the documentation for the Auth component
http://book.cakephp.org/view/172/Authentication, in particular the
user method http://book.cakephp.org/view/387/user.

On Feb 24, 3:04 pm, deek derek.bon...@gmail.com wrote:
 Andy,

 It looks like the debug issue was the problem and everything is now
 working properly.

 My final question is this.  Once a user is logged on (through the
 built-in Auth of CakePHP), what built-in functions should I use to
 determine that user's id number? For that matter what is a good way to
 test of a user is logged on or not? I ask because I would like some
 options/posts to be shown only to logged in (Admin) users.

 Currently this is my form for creating an new post:
 h1Add Post/h1
 ?php
 echo $form-create('Post');
 echo $form-input('title');
 echo $form-input('category');
 echo $form-input('body', array('rows' = '10', 'columns' = '40'));
 echo $form-radio('frontpage', array('1'='Yes','0'='No'));
 echo $form-end('Save Post');
 ?

 I want to thank everyone who has helped out with my questions.

 On Feb 24, 7:21 am, Andy Dirnberger andy.dirnber...@gmail.com wrote:



  If you have debug set to 0 in core.php and added displayname to the
  user table after Cake first saw the it, you need to update the cache
  of the table's layout. (Either set debug to 1, reload the page, and
  set it back to 0 or delete the file in tmp.)

  On Feb 24, 2:36 am, deek derek.bon...@gmail.com wrote:

   Also when I try and add a user with this form
   h1Add User/h1
   ?php
       echo $form-create('User', array('action' = 'register'));
       echo $form-input('username');
       echo $form-input('displayname');
       echo $form-input('password');
       echo $form-end('Add User');
   ?

   the displayname never makes it to the MySQL database. I have no idea
   why not

   On Feb 23, 11:27 pm, deek derek.bon...@gmail.com wrote:

Well everything seems to be working now with var $belongsTo =
array('User'); but I have tried putting ?php echo $post['User']
['displayname']; ? in my index.ctp and the it does not output any of
the information.  If I put ?php echo $post['User']['id']; ? or ?php
echo $post['User']['username']; ? those values will output just fine
but not displayname, what might cause this?

On Feb 23, 8:36 pm, Andy Dirnberger andy.dirnber...@gmail.com wrote:

 Did you try just using var $belongsTo = array('User');? The values
 you are supplying for className and foreignKey should be the defaults.

 If you remove the $belongsTo piece, do your posts show up again? If
 not, what else did you change? What code do you currently have in your
 controller? No special code is needed in your controller to handle
 relationships, and you'd only need to add code to your User model
 (e.g., var $hasMany = array('Post');) if you wanted posts to be
 retrieved every time you query your user table, which you probably
 don't.

 Once you have it working, 'User'] will be added as an index alongside
 'Post' (e.g., $post['User']['displayname']).

 On Feb 23, 5:16 pm, deek derek.bon...@gmail.com wrote:

  So I updated my post model to what you see below and now when I go 
  to
  my index (index.ctp) view that I have listed on my first post 
  nothing
  shows up. Do I need to add anything in the controllers or the user
  model?  Once get it to show properly how would I call the the User
  displayname in my foreach loop in the index.ctp?

  class Post extends AppModel {
      var $name = 'Post';
      var $belongsTo = array (
          'User' = array(
              'className' = 'User',
              'foreignKey' = 'user_id'
          )
      );
      var $validate = array (
          'title' = array(
              'rule' = 'notEmpty'
          ),
          'category' = array(
              'rule' = 'notEmpty'
          ),
          'body' = array(
              'rule' = 'notEmpty'
          ),
          'frontpage' = array(
              'rule' = 'numeric'
          )
      );}

  On Feb 23, 12:01 am, WebbedIT p...@webbedit.co.uk wrote:

   ^^ What @Andy says is right.

   Simple rule of thumb for hasMany/hasOne - belongsTo
   relationships ... whichever model your foreign_key is in, it 
   belongs
   to the other model.

   Welcome to CakePHP, it should make learning complex PHP a lot 
   easier
   for you.  I sometimes wish I hadn't taught myself a lot of bad 
   habits
   by learning raw PHP first :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr

Re: Question about relationships, extending the blog tutorial

2010-02-24 Thread Andy Dirnberger
If you have debug set to 0 in core.php and added displayname to the
user table after Cake first saw the it, you need to update the cache
of the table's layout. (Either set debug to 1, reload the page, and
set it back to 0 or delete the file in tmp.)

On Feb 24, 2:36 am, deek derek.bon...@gmail.com wrote:
 Also when I try and add a user with this form
 h1Add User/h1
 ?php
     echo $form-create('User', array('action' = 'register'));
     echo $form-input('username');
     echo $form-input('displayname');
     echo $form-input('password');
     echo $form-end('Add User');
 ?

 the displayname never makes it to the MySQL database. I have no idea
 why not

 On Feb 23, 11:27 pm, deek derek.bon...@gmail.com wrote:



  Well everything seems to be working now with var $belongsTo =
  array('User'); but I have tried putting ?php echo $post['User']
  ['displayname']; ? in my index.ctp and the it does not output any of
  the information.  If I put ?php echo $post['User']['id']; ? or ?php
  echo $post['User']['username']; ? those values will output just fine
  but not displayname, what might cause this?

  On Feb 23, 8:36 pm, Andy Dirnberger andy.dirnber...@gmail.com wrote:

   Did you try just using var $belongsTo = array('User');? The values
   you are supplying for className and foreignKey should be the defaults.

   If you remove the $belongsTo piece, do your posts show up again? If
   not, what else did you change? What code do you currently have in your
   controller? No special code is needed in your controller to handle
   relationships, and you'd only need to add code to your User model
   (e.g., var $hasMany = array('Post');) if you wanted posts to be
   retrieved every time you query your user table, which you probably
   don't.

   Once you have it working, 'User'] will be added as an index alongside
   'Post' (e.g., $post['User']['displayname']).

   On Feb 23, 5:16 pm, deek derek.bon...@gmail.com wrote:

So I updated my post model to what you see below and now when I go to
my index (index.ctp) view that I have listed on my first post nothing
shows up. Do I need to add anything in the controllers or the user
model?  Once get it to show properly how would I call the the User
displayname in my foreach loop in the index.ctp?

class Post extends AppModel {
    var $name = 'Post';
    var $belongsTo = array (
        'User' = array(
            'className' = 'User',
            'foreignKey' = 'user_id'
        )
    );
    var $validate = array (
        'title' = array(
            'rule' = 'notEmpty'
        ),
        'category' = array(
            'rule' = 'notEmpty'
        ),
        'body' = array(
            'rule' = 'notEmpty'
        ),
        'frontpage' = array(
            'rule' = 'numeric'
        )
    );}

On Feb 23, 12:01 am, WebbedIT p...@webbedit.co.uk wrote:

 ^^ What @Andy says is right.

 Simple rule of thumb for hasMany/hasOne - belongsTo
 relationships ... whichever model your foreign_key is in, it belongs
 to the other model.

 Welcome to CakePHP, it should make learning complex PHP a lot easier
 for you.  I sometimes wish I hadn't taught myself a lot of bad habits
 by learning raw PHP first :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread Andy Dirnberger
Did you try just using var $belongsTo = array('User');? The values
you are supplying for className and foreignKey should be the defaults.

If you remove the $belongsTo piece, do your posts show up again? If
not, what else did you change? What code do you currently have in your
controller? No special code is needed in your controller to handle
relationships, and you'd only need to add code to your User model
(e.g., var $hasMany = array('Post');) if you wanted posts to be
retrieved every time you query your user table, which you probably
don't.

Once you have it working, 'User'] will be added as an index alongside
'Post' (e.g., $post['User']['displayname']).

On Feb 23, 5:16 pm, deek derek.bon...@gmail.com wrote:
 So I updated my post model to what you see below and now when I go to
 my index (index.ctp) view that I have listed on my first post nothing
 shows up. Do I need to add anything in the controllers or the user
 model?  Once get it to show properly how would I call the the User
 displayname in my foreach loop in the index.ctp?

 class Post extends AppModel {
     var $name = 'Post';
     var $belongsTo = array (
         'User' = array(
             'className' = 'User',
             'foreignKey' = 'user_id'
         )
     );
     var $validate = array (
         'title' = array(
             'rule' = 'notEmpty'
         ),
         'category' = array(
             'rule' = 'notEmpty'
         ),
         'body' = array(
             'rule' = 'notEmpty'
         ),
         'frontpage' = array(
             'rule' = 'numeric'
         )
     );}

 On Feb 23, 12:01 am, WebbedIT p...@webbedit.co.uk wrote:



  ^^ What @Andy says is right.

  Simple rule of thumb for hasMany/hasOne - belongsTo
  relationships ... whichever model your foreign_key is in, it belongs
  to the other model.

  Welcome to CakePHP, it should make learning complex PHP a lot easier
  for you.  I sometimes wish I hadn't taught myself a lot of bad habits
  by learning raw PHP first :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Question about relationships, extending the blog tutorial

2010-02-22 Thread Andy Dirnberger
Try $belongsTo instead of $hasOne.

$belongsTo = array('User');

On Feb 22, 7:03 pm, deek derek.bon...@gmail.com wrote:
 First of all let me say I'm very new to CakePHP and complex PHP in
 general.  I based the blog I am working on off the tutorial on the
 CakePHP website. I skipped creating ACL or a more complex management
 of permissions because as of now the only people who will be posting
 content will be Authorized users so using the Auth component in both
 of my controllers with an appropriate beforeFilter() function has done
 exactly what I needed.  What I am trying to do is in my display of
 posted articles have $post['Post']['user_id']; look up the in the
 users post table the display name, I haven't found a simple answer for
 this so that is why I am posting.

 I've looked through the cakePHP book online and thought I might need
 to do something to link models together but I didn't have any success
 with that.  I tried having the Post model include var $hasOne = User
 but that ended up breaking everything.  Any suggestions would be
 greatly appreciated.

 Below are my table structures, models, and view I am working with

 -- Table structure for table `posts`

 CREATE TABLE IF NOT EXISTS `posts` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `user_id` int(11) NOT NULL,
   `title` varchar(50) default NULL,
   `category` varchar(50) default NULL,
   `body` text,
   `frontpage` tinyint(1) NOT NULL,
   `created` datetime default NULL,
   `modified` datetime default NULL,
   PRIMARY KEY  (`id`)
 )
 -- Table structure for table `users`

 CREATE TABLE IF NOT EXISTS `users` (
   `id` int(11) NOT NULL auto_increment,
   `username` char(50) default NULL,
   `password` char(40) default NULL,
   `displayname` varchar(50) NOT NULL,
   PRIMARY KEY  (`id`),
   UNIQUE KEY `username` (`username`)

 Post Model:
 class Post extends AppModel {
     var $name = 'Post';
     var $validate = array (
         'title' = array(
             'rule' = 'notEmpty'
         ),
         'category' = array(
             'rule' = 'notEmpty'
         ),
         'body' = array(
             'rule' = 'notEmpty'
         ),
         'frontpage' = array(
             'rule' = 'numeric'
         )
     );}

 User model:
 class User extends AppModel {
     var $name = 'User';
     var $validate = array(
         'username' = array(
             'rule' = 'notEmpty',
             'message' = 'Please enter your Username'
         ),
         'displayname' = array(
             'rule' = 'notEmpty'
             'message' = 'Please enter the name you wish displayed
 with your posts'
         ),
         'password' = array(
             'rule' = 'notEmpty',
             'message' = 'Pelase enter your Password'
         )
     );}

 index.ctp:  This view is on my main page and loops through all the
 posts that are tagged to be on the front page

     ?php foreach (array_reverse($posts) as $post){if ($post['Post']
 ['frontpage']==true){ ?
         ?php echo $html-link($post['Post']['title'],
 array('controller' = 'posts', 'action' = 'view', $post['Post']
 ['id'])); ?br/
         ?php echo $post['Post']['category']; ?br/
         ?php echo $post['Post']['created']; ?br/
         ?php echo $post['Post']['body']; ?br/
         ?php echo $post['Post']['user_id']; ?br/br/
     ?php }}; ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Keeping State

2010-02-22 Thread Andy Dirnberger
It's still sessions: http://book.cakephp.org/view/173/Sessions

On Feb 22, 9:01 pm, Josh LaMar jola...@umail.iu.edu wrote:
 Hi all,

 This is my first post. I am new to CakePHP but I have experience
 programming in PHP and Python/CGI. Anyways I want to get comfortable
 switching over to CakePHP by developing a simple program that keeps
 state - let's say a counter. The counter can be a button that
 increases the state variable each time it's clicked. From this I want
 to be able to make an addition calculator that adds to input
 variables. Eventually I would be able to be comfortable enough to
 create a hangman program. How would I go about keeping state on the
 server side? In PHP it was with Sessions.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-18 Thread andy
It turned out that at some point in my Javascript I'm appending the
new fields outside of the form/form... I thought I had checked
that before... and I was checking the DOM via Firebug in Firefox.  But
apparently Firebug (or Firefox,) seems to show form and /form as
on the same line... even though I purposely put the closing /form
tag at the very end of my generated HTML (and verified by viewing the
generated HTML source.)

Thanks for the help anyway.  I should have realized I was appending
outside of the form tags.

Andy

On Feb 17, 1:57 am, WebbedIT p...@webbedit.co.uk wrote:
 No, you do not need the single quotes within the fields name, that is
 how I would access the value from the data array.  Sorry for any
 confusion.

 As you rightly say, your form looks exactly as it should so confusing
 as to why it refuses to process the dynamic fields?

 Unfortunately I do not have the time to set up a test case to try and
 resolve this for you :(

 Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-18 Thread andy
For future reference for anyone else having the same issue... it turns
out that the current HTML FORM tag has a certain scope that needs to
be within the same (or within the same,) DIV.

I ended up having one FORM tag inside of a DIV... and then had the
ending /FORM tag outside of the DIV.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-17 Thread andy
No worries about a test case :-)

I'll just keep testing different parts of it until something works...
it seems like it should work but maybe I am forgetting something.

Thanks for your help anyway.

Andy



On Feb 17, 1:57 am, WebbedIT p...@webbedit.co.uk wrote:
 No, you do not need the single quotes within the fields name, that is
 how I would access the value from the data array.  Sorry for any
 confusion.

 As you rightly say, your form looks exactly as it should so confusing
 as to why it refuses to process the dynamic fields?

 Unfortunately I do not have the time to set up a test case to try and
 resolve this for you :(

 Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-17 Thread andy
I wonder if this could be a partial caching issue with the view...

- Any fields in the form at first page view will save.
- Any fields added via jQuery after first page view are not saved.


Does anyone know if CakePHP partially caches a form (view) the first
time it is loaded?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-16 Thread andy
Here is how the form looks with one existing record (event)... and
then with one newly added to the DOM/HTML (before saving... ) using
jQuery:

li id=cs_0 class=ui-state-default
span class=ui-icon ui-icon-arrowthick-2-n-s/span
div class=input text
input type=text id=Event0Title value=First Session
maxlength=255 name=data[Event][0][title]
/div
div class=input textarea
textarea id=Event0Description rows=5 cols=30 name=data[Event]
[0][description]This is the first event./textarea
/div
div class=item_id
input type=hidden id=Event0Id value=1 name=data[Event][0]
[id]
/div
/li


li class=ui-state-default id=cs_1
span class=ui-icon ui-icon-arrowthick-2-n-s/span
div class=input text
input type=text id=Event1Title value=First Session
maxlength=255 name=data[Event][1][title]
/div
div class=input textarea
textarea id=Event1Description rows=5 cols=30 name=data[Event]
[1][description]This is the first event./textarea
/div
div class=item_id/div
/li


I have it just clone an existing form input section and replace the
fields with a new id (using numbers... 1, 2, 3...) so it appears to
have the same name and id form fields as the fields that do get saved.

I was under the same impression (and still am,) as your comment about
the automagic action of the form and saving happening after the form
is finally sent... but somehow it's not picking up these new form
fields.

I've checked to make sure that the fields are indeed within the same
UL tag just in case that made a difference.  It seems like some tiny
little issue is causing this to happen... but I still can't quite find
it.

I noticed that you wrote about how the field name format is
data['Event'][1]['fieldname']  with those single quote marks
included.  In my form, the format without single quotes seems to be
working for the existing entries... but for the newly added (DOM/HTML)
fields, no success.  Do you know if those single quotes matter in this
case?  Thanks,

Andy



Thanks again for your help.

On Feb 16, 12:36 am, WebbedIT p...@webbedit.co.uk wrote:
 In your first two representations of your data array there was no
 second event.  As long as the fields you are inserting for the 2nd
 event follow the data['Event'][1]['fieldname'] format then it should
 all be ok.

 I'm confident that you should be able to submit a form that has been
 built dynamically as all the automagic happens after you submit the
 form, the only thing that would have a problem with the form would be
 the security component if you were using it, but that would reject the
 form all together and give you a white screen.

 If you are truly following the data['Event'][1]['fieldname'] format it
 should work fine, concentrate solely on getting the right data array
 to the contrlller and the rest should fall into place.

 Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Associated model won't load

2010-02-16 Thread andy
Does it work if you try doing a $this-Subject-find() instead of
using paginate?  Just to see if that works...



On Feb 16, 9:37 am, Furuno furunom...@gmail.com wrote:
 Okay, so, I have two models called Program and Subject, here's the
 classes :

 program.php
 ?php
 class Program extends AppModel {
         var $hasMany = 'Subject';}

 ?

 subject.php
 ?php
 class Subject extends AppModel {
         var $belongsTo = 'Program'}

 ?

 And the controllers :

 programs_controller.php
 ?php
 class ProgramsController extends AppController {

         var $paginate = array('limit' = 20);

         function admin_index() {
                 $this-set('programs', $this-paginate('Program'));
         }}

 ?

 subjects_controller.php
 ?php
 class SubjectsController extends AppController {

         var $paginate = array('limit' = 20);

         function admin_index() {
                 $this-set('subjects', $this-paginate('Subject'));
         }

 }

 ?

 The problem is, why the subject controller won't load the associated
 models while all the other controllers (programs and periodes) does it
 just find?

 Here's the SQL debug message from programs controller, it loads the
 associated Subjects :
 DESCRIBE `programs`
 DESCRIBE `subjects`
 SELECT COUNT(*) AS `count` FROM `programs` AS `Program` WHERE 1 = 1
 SELECT `Program`.`id`, `Program`.`code`, `Program`.`name`,
 `Program`.`description` FROM `programs` AS `Program` WHERE 1 = 1 LIMIT
 20
 SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
 `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
 `subjects` AS `Subject` WHERE `Subject`.`program_id` IN (1, 2, 3)

 But in the subjects controller it doesn't load the associated
 Programs :
 DESCRIBE `subjects`
 SELECT COUNT(*) AS `count` FROM `subjects` AS `Subject` WHERE 1 = 1
 SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
 `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
 `subjects` AS `Subject` WHERE 1 = 1 LIMIT 20

 I've tried adding a complete association definition array to the
 models, complete pagination definition array, using var $name but
 still no luck :(

 Where did I went wrong? Have debugged this for the last 2 hours...

 Thanks before...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Associated model won't load

2010-02-16 Thread andy
Do you know what version of CakePHP you are running?



On Feb 16, 10:00 am, Furuno furunom...@gmail.com wrote:
 Nope... :(

 Just to make sure, I tried that once again with :
 $this-set('subjects', $this-Subject-find('all'));

 still no luck...

 On 17 Feb, 00:56, andy sum...@gmail.com wrote:



  Does it work if you try doing a $this-Subject-find() instead of
  using paginate?  Just to see if that works...

  On Feb 16, 9:37 am, Furuno furunom...@gmail.com wrote:

   Okay, so, I have two models called Program and Subject, here's the
   classes :

   program.php
   ?php
   class Program extends AppModel {
           var $hasMany = 'Subject';}

   ?

   subject.php
   ?php
   class Subject extends AppModel {
           var $belongsTo = 'Program'}

   ?

   And the controllers :

   programs_controller.php
   ?php
   class ProgramsController extends AppController {

           var $paginate = array('limit' = 20);

           function admin_index() {
                   $this-set('programs', $this-paginate('Program'));
           }}

   ?

   subjects_controller.php
   ?php
   class SubjectsController extends AppController {

           var $paginate = array('limit' = 20);

           function admin_index() {
                   $this-set('subjects', $this-paginate('Subject'));
           }

   }

   ?

   The problem is, why the subject controller won't load the associated
   models while all the other controllers (programs and periodes) does it
   just find?

   Here's the SQL debug message from programs controller, it loads the
   associated Subjects :
   DESCRIBE `programs`
   DESCRIBE `subjects`
   SELECT COUNT(*) AS `count` FROM `programs` AS `Program` WHERE 1 = 1
   SELECT `Program`.`id`, `Program`.`code`, `Program`.`name`,
   `Program`.`description` FROM `programs` AS `Program` WHERE 1 = 1 LIMIT
   20
   SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
   `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
   `subjects` AS `Subject` WHERE `Subject`.`program_id` IN (1, 2, 3)

   But in the subjects controller it doesn't load the associated
   Programs :
   DESCRIBE `subjects`
   SELECT COUNT(*) AS `count` FROM `subjects` AS `Subject` WHERE 1 = 1
   SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
   `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
   `subjects` AS `Subject` WHERE 1 = 1 LIMIT 20

   I've tried adding a complete association definition array to the
   models, complete pagination definition array, using var $name but
   still no luck :(

   Where did I went wrong? Have debugged this for the last 2 hours...

   Thanks before...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-15 Thread andy
It appears to work when I manually put in a new input form field into
the view... instead of having it being added via jQuery:

[data] = Array
(
[Event] = Array
(
[0] = Array
(
[title] = First Event
[description] = This is the first event.
[weight] = 1
[id] = 1
)

[1] = Array
(
[title] = second
[description] = second event
[weight] =
)

)

[Schedule] = Array
(
[title] = First Schedule
[description] = This is the first schedule.
[id] = 1
)

)




Is there some type of limitation on when something can be added to a
form in CakePHP before the form is saved/sent?



On Feb 14, 1:00 am, WebbedIT p...@webbedit.co.uk wrote:
 Paste a copy of the data array that is getting to your controller
 after a form submit and someone will advise if it's structured
 correctly

 HTH

 Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Redirects from Old URL

2010-02-15 Thread andy
There is an article on this page that may help you redirect the
old .htm pages to the new format... in the article it talks about
using .php at the end of the redirect... but in your case you would
probably just have no extension at the end of your URL.  This is all
assuming that you are using an Apache type of webserver :-)

http://www.isitebuild.com/301-redirect.htm


Hope that helps,
a

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-15 Thread andy
But I am wanting to use jQuery/Javascript to dynamically add a new
form item before saving... I'll keep poking around with it but I am
still curious as to if there is a limitation on form-creation with
CakePHP...



On Feb 15, 12:40 pm, andy sum...@gmail.com wrote:
 It appears to work when I manually put in a new input form field into
 the view... instead of having it being added via jQuery:

 [data] = Array
         (
             [Event] = Array
                 (
                     [0] = Array
                         (
                             [title] = First Event
                             [description] = This is the first event.
                             [weight] = 1
                             [id] = 1
                         )

                     [1] = Array
                         (
                             [title] = second
                             [description] = second event
                             [weight] =
                         )

                 )

             [Schedule] = Array
                 (
                     [title] = First Schedule
                     [description] = This is the first schedule.
                     [id] = 1
                 )

         )

 Is there some type of limitation on when something can be added to a
 form in CakePHP before the form is saved/sent?

 On Feb 14, 1:00 am, WebbedIT p...@webbedit.co.uk wrote:



  Paste a copy of the data array that is getting to your controller
  after a form submit and someone will advise if it's structured
  correctly

  HTH

  Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-14 Thread andy
Array
(
[Event] = Array
(
[0] = Array
(
[title] = First Event
[description] = This is the first event.
[weight] = 1
)

)

[Schedule] = Array
(
[title] = First Schedule
[description] = This is the first schedule.
[id] = 1
)

)



The problem appears to be that I'm not even getting an array item for
the newly-added event (added via jQuery to the DOM/HTML before saving
in CakePHP.)  Has anyone tried dynamically adding something to a form
in the HTML before saving?  When I add a new event... I'm purposely
not putting a new id in the UL's LI for that new event item.  The id
should be added automatically in my database and it would most likely
be a different number.

Thanks,
Andy



On Feb 14, 1:00 am, WebbedIT p...@webbedit.co.uk wrote:
 Paste a copy of the data array that is getting to your controller
 after a form submit and someone will advise if it's structured
 correctly

 HTH

 Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-14 Thread andy
Sorry, that array actually should look like this (I had previously
commented out something...)

Array
(
[Event] = Array
(
[0] = Array
(
[title] = First Event
[description] = This is the first event.
[weight] = 1
[id] = 1
)

)

[Schedule] = Array
(
[title] = First Schedule
[description] = This is the first schedule.
[id] = 1
)

)



On Feb 14, 1:00 am, WebbedIT p...@webbedit.co.uk wrote:
 Paste a copy of the data array that is getting to your controller
 after a form submit and someone will advise if it's structured
 correctly

 HTH

 Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using saveAll to insert new fields, update old fields

2010-02-14 Thread andy
Also, if it helps... here is the HTML output of a newly-added form
event added to the HTML... before saving with CakePHP:

span class=ui-icon ui-icon-arrowthick-2-n-s/span
div class=input text
label for=Event1TitleTitle/label
input name=data[Event][1][title] maxlength=255
id=Event1Title type=text
/div
div class=input textarea
label for=Event1DescriptionDescription/label
textarea name=data[Event][1][description] cols=31 rows=5
id=Event1Description/textarea
/div
div class=input text
label for=Event1WeightWeight/label
input name=data[Event][1][weight] maxlength=11 value=2
id=Event1Weight type=text
/div





On Feb 14, 1:00 am, WebbedIT p...@webbedit.co.uk wrote:
 Paste a copy of the data array that is getting to your controller
 after a form submit and someone will advise if it's structured
 correctly

 HTH

 Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Jquery Popup Form

2010-02-14 Thread andy
Have you tried putting anything like 'onclick' = false?  (I forget if
false needs to be in quotes or not for this type of check...)

?php echo $html-link('Demo',
array('controller'='posts','action'='add'),
array('class'='popupButton', 'onclick' = 'false'));

or

?php echo $html-link('Demo',
array('controller'='posts','action'='add'),
array('class'='popupButton', 'onclick' = false));


Hope that helps,
a


On Feb 14, 10:33 pm, dtirer dti...@gmail.com wrote:
 so I have a popup form that I used JQuery for.  The Popup is not a Div
 within the current back, but is actually a view from another
 controller action. (posts/add).  The problem is, when I submit the
 form, it does store the data.  However, instead of staying there on
 the popup, the whole page redirects to the action of the form. (posts/
 add).

 So I have this:

 ?php echo $html-link('Demo',
 array('controller'='posts','action'='add'),
 array('class'='popupButton'));

 This is the link to the popup.  Popup is generated from the Posts
 Controller, and Add Action.  The popup functionality is based on 
 thewww.yensdesign.comexample.

 I'm then using the JQuery Form Plugin to submit the form.  Right now,
 just a simple function:

 $(document).ready(function() {
             // bind 'myForm' and provide a simple callback function
             $('#theForm').ajaxForm(function() {
                 alert(Thank you for your comment!);

             });
         });

 Below I've also included the YenDesign thing im using to create the
 popup.  Let me know if anyone has any thoughts!

 -- Popup --

 //SETTING UP OUR POPUP
 //0 means disabled; 1 means enabled;
 var popupStatus = 0;
 var close = a id='popupContactClose'x/a;

 //loading popup with jQuery magic!
 function loadPopup(tag){
         //loads popup only if it is disabled
         if(popupStatus==0){
                 $(#backgroundPopup).css({
                         opacity: 0.7
                 });

                 centerPopup();
                 $(#backgroundPopup).fadeIn(400);
                 $('#popup').load($(tag).attr('href') + ' #theForm');
                 $(#popup).fadeIn(400);
                 $(#popup).append(close);

                 popupStatus = 1;
         }

 }

 //disabling popup with jQuery magic!
 function disablePopup(){
         //disables popup only if it is enabled
         if(popupStatus==1){
                 $(#backgroundPopup).fadeOut(400);
                 $(#popup).fadeOut(400);
                 popupStatus = 0;
         }

 }

 //centering popup
 function centerPopup(){
         //request data for centering
         var windowWidth = document.documentElement.clientWidth;
         var windowHeight = document.documentElement.clientHeight;
         var popupHeight = $(#popup).height();
         var popupWidth = $(#popup).width();
         //centering
         $(#popup).css({
                 position: absolute,
                 top: 50%,
                 left:50%,
                 margin-left: popupWidth / -2,
                 margin-top: popupHeight / -2
         });
         //only need force for IE6

         $(#backgroundPopup).css({
                 height: windowHeight
         });

 }

 //CONTROLLING EVENTS IN jQuery
 $(document).ready(function(){

         //LOADING POPUP
         //Click the button event!
         $(.popupButton).click(function(){
                 //centering with css
                 centerPopup();
                 //load popup
                 loadPopup(this);

                 return false;
         });

         //CLOSING POPUP
         //Click the x event!
         $(#popupClose).click(function(){
                 disablePopup();
         });
         //Click out event!
         $(#backgroundPopup).click(function(){
                 disablePopup();
         });
         //Press Escape event!
         $(document).keypress(function(e){
                 if(e.keyCode==27  popupStatus==1){
                         disablePopup();
                 }
         });

         $('#popup a.close').live('click', function () {
             // Fade out the overlayer
             disablePopup();
             return false;
         });



 });

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Inner join querys: two fields from one table

2010-02-03 Thread andy
Hello,

Sorry for the strangely-worded question title.  I've been searching
around for a few days here on the CakePHP doc book, CakePHP group, and
around the Internet but I haven't been able to find a tip on how to do
this.

I have a MySQL database with these tables (names are simplified):

+ school_classes
 id
 grade_from
 grade_to

+ grade_levels
 id
 short_name


So basically I have a table that contains information for different
school-related classes.  And I have another table that has a list of
grade levels that are available to choose when editing (or viewing in
this case,) school classes.


For example:

school_classes
id: 1
grade_from: 1
grade_to: 3

grade_levels
id: 1
short_name: K

id: 2
short_name: 1

id: 3
short_name: 2


would mean that I have a school class with a grade-level range of
Kindergarten (K) to Second Grade (2).


I know what type of MySQL query I am looking for... I am just unclear
about how to create the same behavior in CakePHP as far as my hasMany
or belongsTo behaviors might go.



Here is a query that shows what I'm trying to do here if that helps
(ClassSession = school_classes from example above.  GradeLevel =
grade_levels from example above):

SELECT `ClassSession`.`id`, `ClassSession`.`title`,
`ClassSession`.`session_date`, `ClassSession`.`description`,
`ClassSession`.`speaker`, `ClassSession`.`grade_from`,
`ClassSession`.`grade_to`, `ClassSession`.`room`,
`ClassSession`.`time_block`, `ClassSession`.`owner`,
`ClassSession`.`created_at`, `ClassSession`.`modified_at`,
`Speaker`.`id`, `Speaker`.`first_name`, `Speaker`.`last_name`,
`Speaker`.`mailing_address`, `Speaker`.`city`, `Speaker`.`state`,
`Speaker`.`zip`, `Speaker`.`country`, `Speaker`.`email_address`,
`Speaker`.`phone_number`, `Speaker`.`affiliation`, `Speaker`.`owner`,
`Speaker`.`created_at`, `Speaker`.`modified_at`,
`GradeLevelFrom`.`id`, `GradeLevelFrom`.`short_name`,
`GradeLevelFrom`.`full_name`, `GradeLevelTo`.`id`,
`GradeLevelTo`.`short_name`, `GradeLevelTo`.`full_name` FROM
`class_sessions` AS `ClassSession` INNER JOIN `speakers` AS `Speaker`
ON (`Speaker`.`id` = `ClassSession`.`speaker`) INNER JOIN
`grade_levels` AS `GradeLevelFrom` ON (`GradeLevelFrom`.`id` =
`ClassSession`.`grade_from`) INNER JOIN `grade_levels` AS
`GradeLevelTo` ON (`GradeLevelTo`.`id` = `ClassSession`.`grade_to`)
WHERE 1 = 1;

The results look like this:

| id | title  | session_date|
description | speaker | grade_from | grade_to |
room | time_block | owner | created_at  |
modified_at | id | first_name | last_name | mailing_address |
city | state| zip   | country  |
email_address   | phone_number | affiliation | owner |
created_at | modified_at | id | short_name | full_name| id |
short_name | full_name|
+++-
+-+-++--
+--++---+-
+-+++---+-
+--+--+---+--
+-+--+-+---
++-+++--+
++--+
|  1 | First Session  | 2010-02-02 22:23:56 | This is the first
session.  |   1 |  1 |3 | Room 205 |   NULL
| 1 | 2010-02-02 22:23:56 | 2010-02-02 22:23:56 |  1 | Speaker A
| Smith | 123 SW 1st  | Colorado Springs | Colorado | 80995 |
United States of America | smi...@smitha.com   | 111-222- | A
Middle School | 1 | NULL   | NULL|  1 | K  |
Kindergarten |  3 | 2  | Second Grade |
|  2 | Second Session | 2010-02-02 22:23:56 | This is the second
session. |   2 |  1 |6 | Room 207 |   NULL
| 1 | 2010-02-02 22:23:56 | 2010-02-02 22:23:56 |  2 | Speaker B
| Tuttle| 245 SE 3st  | Colorado Springs | Colorado | 80995 |
United States of America | tutt...@tuttleb.com | 222-333- | B
Middle School | 1 | NULL   | NULL|  1 | K  |
Kindergarten |  6 | 5  | Fifth Grade  |




Is there any way I can do this natively in CakePHP?
Any tips would be appreciated.

Thanks,
andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Inner join querys: two fields from one table

2010-02-03 Thread andy
I think I found an article that fixed this issue.

It can be found here:
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

I had read it before when searching... but didn't realize that it was
what I had been looking for all along.
Sorry for the misspelled querys in the title of this post as well.

Thanks,
andy


On Feb 3, 11:17 am, andy sum...@gmail.com wrote:
 Hello,

 Sorry for the strangely-worded question title.  I've been searching
 around for a few days here on the CakePHP doc book, CakePHP group, and
 around the Internet but I haven't been able to find a tip on how to do
 this.

 I have a MySQL database with these tables (names are simplified):

 + school_classes
  id
  grade_from
  grade_to

 + grade_levels
  id
  short_name

 So basically I have a table that contains information for different
 school-related classes.  And I have another table that has a list of
 grade levels that are available to choose when editing (or viewing in
 this case,) school classes.

 For example:

 school_classes
 id: 1
 grade_from: 1
 grade_to: 3

 grade_levels
 id: 1
 short_name: K

 id: 2
 short_name: 1

 id: 3
 short_name: 2

 would mean that I have a school class with a grade-level range of
 Kindergarten (K) to Second Grade (2).

 I know what type of MySQL query I am looking for... I am just unclear
 about how to create the same behavior in CakePHP as far as my hasMany
 or belongsTo behaviors might go.

 Here is a query that shows what I'm trying to do here if that helps
 (ClassSession = school_classes from example above.  GradeLevel =
 grade_levels from example above):

 SELECT `ClassSession`.`id`, `ClassSession`.`title`,
 `ClassSession`.`session_date`, `ClassSession`.`description`,
 `ClassSession`.`speaker`, `ClassSession`.`grade_from`,
 `ClassSession`.`grade_to`, `ClassSession`.`room`,
 `ClassSession`.`time_block`, `ClassSession`.`owner`,
 `ClassSession`.`created_at`, `ClassSession`.`modified_at`,
 `Speaker`.`id`, `Speaker`.`first_name`, `Speaker`.`last_name`,
 `Speaker`.`mailing_address`, `Speaker`.`city`, `Speaker`.`state`,
 `Speaker`.`zip`, `Speaker`.`country`, `Speaker`.`email_address`,
 `Speaker`.`phone_number`, `Speaker`.`affiliation`, `Speaker`.`owner`,
 `Speaker`.`created_at`, `Speaker`.`modified_at`,
 `GradeLevelFrom`.`id`, `GradeLevelFrom`.`short_name`,
 `GradeLevelFrom`.`full_name`, `GradeLevelTo`.`id`,
 `GradeLevelTo`.`short_name`, `GradeLevelTo`.`full_name` FROM
 `class_sessions` AS `ClassSession` INNER JOIN `speakers` AS `Speaker`
 ON (`Speaker`.`id` = `ClassSession`.`speaker`) INNER JOIN
 `grade_levels` AS `GradeLevelFrom` ON (`GradeLevelFrom`.`id` =
 `ClassSession`.`grade_from`) INNER JOIN `grade_levels` AS
 `GradeLevelTo` ON (`GradeLevelTo`.`id` = `ClassSession`.`grade_to`)
 WHERE 1 = 1;

 The results look like this:

 | id | title          | session_date        |
 description                 | speaker | grade_from | grade_to |
 room     | time_block | owner | created_at          |
 modified_at         | id | first_name | last_name | mailing_address |
 city             | state    | zip   | country                  |
 email_address       | phone_number | affiliation     | owner |
 created_at | modified_at | id | short_name | full_name    | id |
 short_name | full_name    |
 +++-
 +-+-++--
 +--++---+-
 +-+++---+-
 +--+--+---+--
 +-+--+-+---
 ++-+++--+
 ++--+
 |  1 | First Session  | 2010-02-02 22:23:56 | This is the first
 session.  |       1 |          1 |        3 | Room 205 |       NULL
 |     1 | 2010-02-02 22:23:56 | 2010-02-02 22:23:56 |  1 | Speaker A
 | Smith     | 123 SW 1st      | Colorado Springs | Colorado | 80995 |
 United States of America | smi...@smitha.com   | 111-222- | A
 Middle School |     1 | NULL       | NULL        |  1 | K          |
 Kindergarten |  3 | 2          | Second Grade |
 |  2 | Second Session | 2010-02-02 22:23:56 | This is the second
 session. |       2 |          1 |        6 | Room 207 |       NULL
 |     1 | 2010-02-02 22:23:56 | 2010-02-02 22:23:56 |  2 | Speaker B
 | Tuttle    | 245 SE 3st      | Colorado Springs | Colorado | 80995 |
 United States of America | tutt...@tuttleb.com | 222-333- | B
 Middle School |     1 | NULL       | NULL        |  1 | K          |
 Kindergarten |  6 | 5          | Fifth Grade  |

 Is there any way I can do this natively in CakePHP?
 Any tips would be appreciated.

 Thanks,
 andy

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group

Re: Autocomplete inline styles

2009-12-01 Thread Andy
My solution for now is to use the !important qualifier in my css,
which will override any inline styles.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Autocomplete inline styles

2009-11-30 Thread Andy
I'm having problems styling the div that is created by the $ajax-
autoComplete() function. My code is identical to the example in the
book - http://book.cakephp.org/view/632/autoComplete.  The
functionality works great - the callback works and the data gets
filled in properly.  The problem, it appears, is that scriptaculous/
prototype is inserting inline styles that I can't override with a
stylesheet.  So, because the position gets set as absolute, the
autocomplete list overlaps the elements below the box.  So, does
anybody know of a way to override these styles or prevent them from
being inserted in the first place?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problems setting up a simple Authentication

2009-09-16 Thread Andy

Hi all,
I'm new to cake but am starting to pick it quite quickly now. One
thing that has is causing me a bit of a head ache is getting some
simple Authentication to work using Auth.

The problem I seam to be having is that login function on my
UsersController is getting called twice when I click the Submit button
when logging in. At least I do most of the time, on occasions it only
gets called the once and I am logged in successfully.

When the login function gets called for the first time it would appear
that the user details have been checked and verified and the there is
an attempt to redirect to the page I want to go to. However before i
get there the login function appears to be being called a second time,
this time the user credentials are not correct (i don;t think they are
even set) so I'm redirected back to the login page with the message
that You are not authorized to access that location.

As I mentioned, on occasions the second call to the login has not
happened and I am successfully logged in, I can't tell you what is
different to male this happen. I wish I knew.


I'm a bit lost as to where to look next as I seam to be going round in
circles.

Best Regards
Andy

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



Re: Data Formatting Errors

2009-08-19 Thread Andy

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

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

Thanks again!

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

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



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

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

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

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

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

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

          )

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

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

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

          )

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

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



Data Formatting Errors

2009-08-18 Thread Andy

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

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

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

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

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

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

)

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

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

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

)

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

~Andy

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



Re: set not working

2009-06-22 Thread andy

Is 'type' a possible value for $this-params['action']? Rather than
setting the 'test' variable, have you tried to echo something from
that action just to be sure the routing is correctly taking you to
there?

On Jun 21, 6:37 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote:
 When I use $this-set in my controller it doesn't seem to work, I
 think this could be due to my beforeFilter as I have it takes the
 current action, then checks the first variable to determine which view
 to show.

 function beforeFilter() {
                 if (in_array($this-params['action'],$this-actions)) {
                         if ( !( empty($this-params['pass'][0]) ) ) {
                                 $this-render(DS . 'admins' . DS . 
 $this-params['action'] . DS .
 $this-params['pass'][0]);
                         } else {
                                 $this-render(DS . 'admins' . DS . 
 $this-params['action'] . DS .
 'index');
                                                         }
                 }
         }

 My controller action looks like this. When I echo it in the view it
 says undefined variable, so could this be due to the way I have my
 beforeFilter set up?
 function type($load = null,$id = null) {
                 switch ($load) {
                         Case 'add':
                                 if(!empty($this-data)) {
                                         if($this-Type-save($this-data)) {
                                                 
 $this-Session-setFlash('Type has been saved.');
                                                 
 $this-redirect(array('controller'='admins','action'='type'));
                                         } else {
                                                 $this-Session-setFlash('An 
 error has occured in saving
 type.');
                                         }
                                 }
                                 $this-set('test','test');
                         break;
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How setting path for only one layout

2009-06-03 Thread andy

Petr,

Read http://book.cakephp.org/view/428/render.

On Jun 2, 1:40 pm, Petr Vytlačil petr.vytla...@gmail.com wrote:
 APP CONTROLLER

  function beforeRender(){
             if($this-params['controller']=='frontends'){
                  // This do nothing
                  $viewPaths = array(CAKE_CORE_INCLUDE_PATH .'\shared
 items\views');

                  // This do nothing
                  define('LAYOUTS','C:'.DS.'Program
 Files'.DS.'VertrigoServ'.DS.'www'.DS.'projekty'.DS.'klientpenzion'.DS.'app'.DS.'view'.DS);
             }
     }

 please help, how i can set directory for layout, thx.

 On 2 čvn, 13:50, Petr Vytlačil petr.vytla...@gmail.com wrote:

  Hi I develop simple CMS, but it will be multisite system.
  One core (controller, admin, frontend views, models)
  User: (frontend layout, css, images)

  Pleas is any idea how I can chagne path for on layout in any action in
  controller?
  Path must be in some adr for example: /root/cake/layout/frontend.ctp

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



Re: Error Installation CakePHP 1.2.

2009-05-28 Thread andy

If you remove the echo $html-meta('icon');  line, does the page
display correctly?

On May 27, 6:17 am, iammikek mi...@brightstorm.co.uk wrote:
 We're getting the same issue with php5.2.5 using the cake_1.2.3.8166 release
 so suggest the issue doesnt only apply to php4.

 Anyone got any ideas why this happening?



 brian-9 wrote:

  I suggest that you consider upgrading to version 5.x as Cake may not
  support PHP4.x for much longer. This isn't an official announcement,
  only based on the number of people who have been strongly suggesting
  that Cake no longer support it.

  In any case, PHP4.x itself has been discontinued for a very long time now.

  On Wed, May 13, 2009 at 9:49 PM, genobee wid.w...@gmail.com wrote:

   Notice: Undefined offset: 0 in /var/www/vhosts/ideal-weddings.com/
   httpdocs/cakephp/cake/libs/configure.php on line 1185

   Line 1185: unset($this-__paths[rtrim($core[0], DS)]); part of
   destructor method

 --
 View this message in 
 context:http://n2.nabble.com/Error-Installation-CakePHP-1.2.-tp2879433p298038...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: find list distinct

2009-05-26 Thread andy

What error displays?

On May 25, 2:21 pm, fain182 fain...@gmail.com wrote:
  Take a look athttp://book.cakephp.org/view/809/find-count

 i tried:
 $this-set('stati',
      $this-{$this-Singular}-Sito-Stato-find(
                'list',
                array('fields'='DISTINCT stato')
       )
 );

 but results in a SQL error... the query generated is:
 SELECT `Stato`.`id`, DISTINCT `Stato`.` stato` FROM `stati` AS `Stato`
 WHERE 1 = 1

 any suggestion?

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



Re: find list distinct

2009-05-25 Thread andy

Take a look at http://book.cakephp.org/view/809/find-count

On May 24, 3:30 am, fain182 fain...@gmail.com wrote:
 hello,
 i have a table 'posts' like:
 id, author, subtitle, text, other fields..

 i want to make a search with some select(one for author, one for
 subtitle, ecc.), what is the best way? it's possible to use distinct
 in combination with find('list',..) ?

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



Re: how to abort save?

2009-05-25 Thread andy

Why not allow the blank record to save as NULL?

On May 24, 9:01 pm, cakephp101 valenzuela...@gmail.com wrote:
 thanks for the reply but the thing is it's ok for the field to be
 empty but it should not be saved in the database. i'm using foreach
 loop for my saveAll for each of the fields so i want to know how to
 abort the save for the empty ones.

 On May 22, 11:12 pm, forrestgump vikhya...@gmail.com wrote:

  Just follow the links provided by Teh Treag . Basically u need to
  define the validation function in your Model to make sure the field it
  not empty .

  forrestgump

  On May 22, 12:06 pm, cakephp101 valenzuela...@gmail.com wrote:

   how? i'm sorry i just learned cakephp few weeks ago.

   On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

You should use validation for it.

On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com wrote:

 yes, i mean fields in a table. i'm doing a timesheet for a payroll.
 the start sched, end sched, time in and time out of the employee are
 the input. that means i have 4 fields. i have 5 rows of those 4
 fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day.
 when i only put input in 4 of the rows and 1 form is empty, it will
 still save the empty fields with a null value in my database. i'm
 saving it through saveAll. how can i abort the save for the fields
 that are empty? i think it should be done in beforeSave but i don't
 know how.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth component on IIS7

2009-05-21 Thread andy

Has anyone ever had a problem with the Auth component not working
properly on an IIS7 server? I am able to login and am redirected to
the appropriate page. However, if I try to access another protected
page, I am immediately logged out. I have the same code on an Apache
and it works great.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: last_login update

2009-05-19 Thread andy
                     [wbmp] = image/vnd.wap.wbmp
                     [pdf] = application/pdf
                     [zip] = application/x-zip
                     [tar] = application/x-tar
                 )

             [__acceptTypes] = Array
                 (
                     [0] = text/html
                     [1] = application/xhtml+xml
                     [2] = application/xml
                     [3] = */*
                 )

             [__renderType] =
             [ext] =
             [__typesInitialized] =
             [_log] =
         )

 )

 2009/5/18 andy andy.baugh...@gmail.com



  If you print_r($this-Auth), what keys/values are included in the
  array?

  On May 18, 4:09 am, paulos nikolo paulitosthe...@gmail.com wrote:
   Yeah Andy i tried this but still nothing.Dunno what else i have to do.Thx
   anyway for your idea!

   2009/5/18 andy andy.baugh...@gmail.com

I may be wrong, but I believe '$this-Auth-user()' would look for the
function 'user()' within Auth rather than an array value. Have you
tried '$this-Auth-user['id']' before calling saveField?

On May 17, 5:43 am, paulos nikolo paulitosthe...@gmail.com wrote:
 Still nothing Faza.I am wondering if i have to do something else to
  get
it
 work.I think -- if ($this-Auth-user()) doesnt seem to work.If i
  erase
 this line cake save the last_login but in a new row.

 2009/5/16 Faza f...@ansi.pl

  This is the code I'm using, works 100%.

  function login() {
         $this-layout = 'login';
         if ($this-Auth-user()) {
              $this-User-id = $this-Auth-user('id');
              $this-User-saveField('last_visit', 'now()');
             $gr =
  $this-User-Group-findById($this-Auth-user('group_id'));
             $this-Session-write('Auth.User.group',
$gr['Group']['name']);
             $this-Session-write('Auth.User.password', );
             $this-redirect($this-Auth-redirect());
         }
     }

  Paulos23 pisze:
   Hi Cake people,
   I have spent much time in make this work but nothing.I am using
  auth
   which is working ok and i want to update the last_login field in
users
   table.But i can't.Most of my attempts lead to create a new row in
   table with an empty user contained the updated field.I have read
  all
   of the previous  posts here but nothing help me.Can you tell me
  if I
   do something wrong.Here i put my code:

   app_controller:

   class AppController extends Controller {
         var $components = array('Auth');
         function beforeFilter() {
                 $this-Auth-loginAction = array('controller' =
'users',
  'action'
   = 'login');
                 $this-Auth-logoutRedirect = array('controller' =
  'users',
   'action' = 'login');
                 $this-Auth-loginRedirect = array('controller' =
'users',
  'action'
   = 'index');
                 $this-Auth-loginError=__('Invalid username or
  password',true);
                 $this-Auth-authorize='controller';
         }

         function isAuthorized(){
        return true;
         }
   }

   users_controller: login action

   function login() {
                 $this-layout ='user_login';
                         if ( $this-Auth-user() ) {
                           $user = $this-Auth-user();

                                                 $this-User-id =
  $this-Auth-user('id');
                           //$user['User']['last_login'] = date (
  'Y-m-d
   H:i:s' );

  $this-User-saveField('last_login',
  date('Y-m-d
   H:i:s'));
                                 //$this-User-save('$user');

//$this-User-last_login =
  date(Y-m-d H:i:s);
                         }

       }

   When i have  if ( $this-Auth-user() ) {
                           $user = $this-Auth-user();
   in my code nothing happened.If i comment it then the new row will
  be
   added.
   Any help would be so nice!
   ty in advance,Paulos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: last_login update

2009-05-18 Thread andy

If you print_r($this-Auth), what keys/values are included in the
array?

On May 18, 4:09 am, paulos nikolo paulitosthe...@gmail.com wrote:
 Yeah Andy i tried this but still nothing.Dunno what else i have to do.Thx
 anyway for your idea!

 2009/5/18 andy andy.baugh...@gmail.com



  I may be wrong, but I believe '$this-Auth-user()' would look for the
  function 'user()' within Auth rather than an array value. Have you
  tried '$this-Auth-user['id']' before calling saveField?

  On May 17, 5:43 am, paulos nikolo paulitosthe...@gmail.com wrote:
   Still nothing Faza.I am wondering if i have to do something else to get
  it
   work.I think -- if ($this-Auth-user()) doesnt seem to work.If i erase
   this line cake save the last_login but in a new row.

   2009/5/16 Faza f...@ansi.pl

This is the code I'm using, works 100%.

function login() {
       $this-layout = 'login';
       if ($this-Auth-user()) {
            $this-User-id = $this-Auth-user('id');
            $this-User-saveField('last_visit', 'now()');
           $gr =
$this-User-Group-findById($this-Auth-user('group_id'));
           $this-Session-write('Auth.User.group',
  $gr['Group']['name']);
           $this-Session-write('Auth.User.password', );
           $this-redirect($this-Auth-redirect());
       }
   }

Paulos23 pisze:
 Hi Cake people,
 I have spent much time in make this work but nothing.I am using auth
 which is working ok and i want to update the last_login field in
  users
 table.But i can't.Most of my attempts lead to create a new row in
 table with an empty user contained the updated field.I have read all
 of the previous  posts here but nothing help me.Can you tell me if I
 do something wrong.Here i put my code:

 app_controller:

 class AppController extends Controller {
       var $components = array('Auth');
       function beforeFilter() {
               $this-Auth-loginAction = array('controller' =
  'users',
'action'
 = 'login');
               $this-Auth-logoutRedirect = array('controller' =
'users',
 'action' = 'login');
               $this-Auth-loginRedirect = array('controller' =
  'users',
'action'
 = 'index');
               $this-Auth-loginError=__('Invalid username or
password',true);
               $this-Auth-authorize='controller';
       }

       function isAuthorized(){
      return true;
       }
 }

 users_controller: login action

 function login() {
               $this-layout ='user_login';
                       if ( $this-Auth-user() ) {
                         $user = $this-Auth-user();

                                               $this-User-id =
$this-Auth-user('id');
                         //$user['User']['last_login'] = date ( 'Y-m-d
 H:i:s' );
                               $this-User-saveField('last_login',
date('Y-m-d
 H:i:s'));
                               //$this-User-save('$user');

  //$this-User-last_login =
date(Y-m-d H:i:s);
                       }

     }

 When i have  if ( $this-Auth-user() ) {
                         $user = $this-Auth-user();
 in my code nothing happened.If i comment it then the new row will be
 added.
 Any help would be so nice!
 ty in advance,Paulos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   >