302 redirects of 404 pages

2013-12-17 Thread Jason Page
Hi gents,

I've inherited a site doing something SEO suicidal, but I can't for the 
life of me find where it is doing this, and I'm not even that familiar with 
PHP, so it's turning out to be a nightmare. It probably doesn't help that 
the site is 4 years old or so and has barely been updated in that time.

Every non existent page is 302 redirecting to the homepage.

Where should I be looking for a problem like this? I started with the 
htaccess but it doesn't seem to be there. I then found /cake/libs/error.php 
but after completely replacing that file with the standard core file the 
redirect is still happening and I assume that isn't basic functionality.

I would really appreciate the help of some folks that know the system in 
identifying this..

-- 
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/groups/opt_out.


consoleShell Sanitize class

2013-08-13 Thread Jason Bramley
Hi,

I see from the 2.4.0-rc1 release notes that these two items are deprecated 
and will be removed in 3.x

Two questions come to mind:

1) Why?
2) What are the recommended replacements?

Thanks
Jason

-- 
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/groups/opt_out.




CSS in CakeEmail

2013-05-14 Thread Jason Ellis
In my CakePHP website I have added my css file to 
app/View/Layouts/default.ctp
  $this-Html-css('myapp');

I use this to add colors to rows in tables on my website.

I have a controller which sends a weekly email to staff with the contents 
of a table on my website.

My problem is the table in the email does not have colors.  Is there any 
way I can have my CSS applied to my CakeEmail in the same way it is applied 
to pages on the website?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Subquery in join clause in CakePHP 2.2

2013-01-30 Thread Jason Chen
There is a problem, if set table prefix in database config, it will also 
add the prefix to subquery. 



在 2012年8月29日星期三UTC+8上午1时27分47秒,Mark Wratten写道:

 Glad to. After some reading I was able to take it a step further and turn 
 it into a custom find method, which nicely encapsulates the code in the 
 model. In our app we 'broadcast' articles to a number of different towns, 
 but because we also do a radius search that can result in duplicate rows 
 being returned. So I needed a function that does a SELECT DISTINCT on the 
 joining table to get unique ids, in the form of -

 SELECT ... FROM articles Article JOIN (SELECT DISTINCT article_id FROM 
 articles_towns WHERE town_id IN (...)) ArticleTown ON 
 ArticleTown.article_id = Article.id

 I decided to create a custom find method named broadcast.

 In the Article model -

 public $findMethods = array('broadcast' = true);

 protected function _findBroadcast ($state, $query, $results = array()) {
 if ($state == 'before') {
 $query['joins'] = array(
 array(
 'table' = sprintf((SELECT DISTINCT article_id FROM articles_towns WHERE 
 town_id IN (%s)), TownsComponent::neighbors()),
 'alias' = 'ArticleTown',
 'type' = INNER,
 'conditions' = array('ArticleTown.article_id = Article.id')));
 return $query;
 }
 return $results;
 }

 In the Controller -

 $this-Article-find('broadcast', $options);

 or

 $this-paginate = ('broadcast', $options);
 $this-paginate('Article');

 In my case the list of town is in a static component, but could easily be 
 passed in with the options. I think you will agree it can be done in a very 
 tidy way with Cake. With older versions of Cake I used to see example code 
 that was much longer than the SQL it generated and thought, what's the 
 point, why not just use SQL? But I'm growing to like the new abilities of 
 Cake and you can really minimize the amount of SQL you need to put in your 
 code.

 Disclaimer - there may be better ways to do the same thing that I have not 
 thought of.

 Mark

 On Tuesday, August 28, 2012 12:08:38 PM UTC-4, ceap80 wrote:

 Hi Mark, could you post a code sample of how you solved?

 I'm always interested in querying the db the cakephpway.

 Thanks.

 On Monday, August 27, 2012 10:30:55 PM UTC-4:30, Mark Wratten wrote:

 Figured it out for myself, the subquery just goes in place of the table 
 name.

 On Monday, August 27, 2012 6:17:05 PM UTC-4, Mark Wratten wrote:

 Is there a 'Cake' way of including subqueries in join clauses of SQL 
 select statements?

 I'm looking to generate something in the form of -

 SELECT ... FROM table1
 JOIN (SELECT DISTINCT key FROM table2 WHERE ...) table2 ON table2.key = 
 table1.key

 I have been looking at joining tables in the docs, but it only seems to 
 support joining tables rather than expressions. I could move the DISTINCT 
 to the main query, but that does not perform as well, and also messes up 
 pagination.

 Thanks

 Mark



-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Error: Index.phpController could not be found

2012-08-05 Thread Jason Nightingale
That could be it... I am reading this post to figure what's happening, and 
I'm reading on that link where it says that IIS 7 natively doesn't support 
.htaccess files. I am running on IIS 7, perhaps you are too?

On Wednesday, March 7, 2012 7:53:35 AM UTC+2, amg55nj wrote:

 Ok so I used this guide to check my implementation:

 http://book.cakephp.org/2.0/en/installation/advanced-installation.htmlhttp://book.cakephp.org/2.0/en/installation/advanced-installation.html#apache-and-mod-rewrite-and-htaccess

 Do you suggest anything else?


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


cakephp 1.3 with javascript

2011-11-22 Thread jason for
Hi folks,
I'm almost done with my 1st cakephp site and it's looking good, but
could look better with a bit of javascript dynamically changing my
view.
Here's my code;

$(document).ready(function()
{
$(#event_id).change(function()
{
$.post(
manualpayment,
{value: 12 });
});
});

class AccountsController extends AppController {

var $name = 'Accounts';
var $helpers = array('Js' = array('prototype', 'scriptaculous.js?
load=effects'), 'Ajax', 'Form', 'Html');
public $components = array('RequestHandler');

SNIPPED

function manualpayment()
{

SNIPPED

if ($this-RequestHandler-isAjax())
{
$players = $this-Account-Player-find('list');
$this-set(compact('players', 'events'));

echo $this-render('/accounts/manualpayment', 'ajax');
   CakeLog::write('debug', isAjax is true);
}
else
{


I'm trying to handle the ajax request in function manualpayment(). The
request does reach here as I can see the 'isAjax is true' in the debug
log. However, I don't get the a new view rendered, in fact, the call
to render appears to have no effect. I've stored the output from the
render call in the debug log and it contains a bunch of HTML.

I've done plenty of digging into other articles about AJAX and cakephp
and the majority of the problems appear to be getting duplicate HTML
into the view, my problem is the opposite, nothing appears to change!

EDIT: Just checked firebug and it looks like there is a duplicate set
of view data returning to the browser, but it's still not being drawn
on the browser (either firefox or IE)

Hopefully someone out there can help. I'm pulling my hair out!

Thanks,

Jason.

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


Am I Violating MVC?

2011-05-18 Thread Jason Mitchell
I have in a controller an array containing data used on the view to populate 
a drop down. I put it on the controller, so the array could be used by 
multiple views associated with that controller (create, edit). Additionally, 
it means that if I do ever have to change it, I just have to change it once 
(yup, lazy).

Because the data is relatively static, and is used in only isolated 
instances, it didn't seem to be worth the effort of creating a model for 
that data, and establishing a relationship between models. And, putting it 
on the controller, worked.

Admittedly, I'm new to MVC, but this really doesn't seem to jive definition. 
Am I doing something wrong?  If so, how would one but this on the model, 
short of some sort of association with another model?


--
J. Mitchell

-- 
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: NEW video tutorial on form searching mysql w/ pagination in CakePHP (very helpful!)

2011-01-25 Thread Jason Wydro
Hi Larry,

It's a privilege to hear from you :-) Had no idea about the contest. But I
will certainly put it up there! : ) Thanks a lot. I plan on creating more
tuts with this plugin.

And sorry about the name! I am going to put a few sub-titles on the video
and I'll note the correct spelling.

Jason Wydro
(503) 482-9321
ja...@jasonwydro.com
www.jasonwydro.com


On Tue, Jan 25, 2011 at 12:44 PM, Larry E. Masters php...@gmail.com wrote:

 You should upload your video to http://tv.cakephp.org you know there is a
 contest for the initial launch?

 http://tv.cakephp.org/launch-competition

 --
 Larry E. Masters


 On Tue, Jan 25, 2011 at 2:41 PM, OldWest jason.wy...@gmail.com wrote:

 For any of you who have been looking for a search plugin in CakePHP,
 CakePHP DC has released that and a video has been created it about it (video
 is NOT from CakePHP DC), but I had my search form working up and running
 within an hour!

 Hope it helps!

 Here is the link:
 http://www.youtube.com/watch?v=FAVuLXFVaCw

 If you have any questions, let me know.

 --
 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php


  --
 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php


-- 
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: Baffling blank screen problem

2010-11-23 Thread jason miyashiro
It could be you are missing the cake log file in
/cake/libs/cake_log.php. Check to see that the file is
there. It has happened to me before because the way
I had my .gitignore set up, it ignored the cake_log.php
file when I pulled from git. That might be the problem.

On Nov 24, 9:02 am, Jules fattyju...@gmail.com wrote:
 Using version 1.3.5, is working now with 'log' set to false in
 config.php. Not ideal, but is working for now.

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: Setting arrays for a complicated HABTM relationship

2010-03-22 Thread Shantam Jason Galuten
Yes, thanks so much. I still feel like there could be more complicated
things that I wouldn't know how to do, but I'll cross that bridge when I get
to it   ;)


On Mon, Mar 22, 2010 at 1:21 AM, WebbedIT p...@webbedit.co.uk wrote:

 Glad I set you on the right path, Set::combine is a handy and powerful
 tool when playing with arrays :P

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 To unsubscribe from this group, send email to cake-php+
 unsubscribegooglegroups.com or reply to this email with the words REMOVE
 ME as the subject.


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 from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Cannot get Cake 1.2x or 1.3 to work on OS X 10.6 Snow Leopard

2010-03-02 Thread Jason T.
Hi all--

I was playing with Cake last summer on my old Powerbook.  I haven't
touched it in awhile, and decided to start again on my new Macbook Pro
running 10.6 (built-in PHP 5.3).  I have so far been unsuccessful
either with older versions of cake or the new 1.3 beta.

Initially I was able to get the default page to load, but I could not
get any colors to work and the routing appeared broken--kept getting
404 errors.  Everything said it was fine on the default page--tmp
permissions correct, database could be connected to, etc. etc., but I
get no graphics, styles, or layout.

I checked mod_rewrite and everything seemed okay.  I read that Cake
didn't play nice with PHP 5.3 so I tried to downgrade to 5.2.x but
that caused problems with any PHP files loading.

I did try and disable the line in the Cake core.php file to have Cake
not use mod_rewrite.  That got me colors and layouts on the default
page.  However I'm still getting 404s when I try and do anything
else.  I have tried both manually making models, controllers, views,
etc. and also baking them.

Can anyone give me any new leads?

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: Debug = 2 changes the response context type

2009-11-11 Thread jason m
when using ajax i always set the debug to 0 before rendering the view.
You can do that
in the controller by doing Configure::write('debug', 0). That will
only set the debug temporarily
so it should solve your problem.

On Nov 12, 6:38 am, Alberto Dominguez
alberto.doming...@egresados.uniandes.edu.co wrote:
 Hi,

 I'm using CakePHP to generate JSON responses. I'm also using FirePHP
 to debug and log the application execution. It works pretty well,
 however when I set the DEBUG level to 2 o higher -i.e. when I need to
 monitor the DB query executions- it suddenly changes the response
 header content type to HTML (Content-Type: text/html).

 I'm looking at several files, but I cannot find where it is being
 changed.

 Implementation Notes

 1. My JSON implementation is really close to match the one presented
 at  http://www.pagebakers.nl/2007/06/05/using-json-in-cakephp-12/
 2. CakePHP is successfully debugging and logging to FirePHP -even when
 I change the debug level from 1 to 2.
 3. FireBug is the tool I use to monitor the HTTP communication
 4. I'm setting the JSON content type at RequestHandlerComponent
 5. I'm using JSONView extension at Firefox to validate the output
 (obviously it doesn't work when content type is set to text/html

--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: PHP IDEs

2009-09-10 Thread jason m

I have used textmate, coda, eclipse, netbeans, and aptana on Mac. For
me,
textmate has worked the best with the cakephp bundle. Although it is
not free,
I feel that I am the most productive on textmate because it uses a
fraction of
the memory of the Java based editors and is faster than coda. The real
power
of textmte is all of the different bundles which makes coding faster
and more
enjoyable. The only downside of textmate is that it doesn't really
support any
other encodings besides UTF8.

Jason

On Sep 10, 12:18 am, Bob Albert b...@superstan.com wrote:
 I've been doing my PHP coding in BBedit on the Mac, but thinking that  
 it would be better if I started to use an IDE for PHP. Can anyone  
 recommend a good free or low cost one that works well on Mac and with  
 CakePHP framework? I've briefly looked at Zend Studio but it's too  
 expensive for me right now and looks to be geared toward Zend framework.

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



Re: PHP IDEs

2009-09-10 Thread jason m

For me, I work with Japanese (EUC-JP, SHIFT-JIS, etc), so I really
don't know
about encodings in different languages. Some sites that I work with
are in those
encodings and it would be very difficult to convert all the files to
UTF8. Free
programs like Eclipse, TextWrangler, Smultron, etc can open the the
files in
the encodings I need but with Textmate it is impossible. I also
remember a blog
post from the Textmate developer that said they have no intentions of
adding
support for these encodings anytime soon. If almost every other free
texteditor/IDE
can open these can support many encodings, I wonder why textmate,
which is not
free, cannot.

On Sep 10, 11:45 pm, Martin Westin martin.westin...@gmail.com wrote:
 On Sep 10, 1:05 pm, jason m ippatsu.ya...@gmail.com wrote:

  The only downside of textmate is that it doesn't really
  support any
  other encodings besides UTF8.

  Jason

 Say what? How do you mean Textmate doesn't support any other encoding?
 It works quite happily in 8859-1 (aka latin1) and Mac roman, and I am
 Swedish and frequently have documents containing problematic
 characters like åäö. It does lac the myriad of encodings some editors
 support (like all the different iso variations) so I guess to some
 language-specific documents there might be a problem.

 Textmate is a bit obscure on how to convert encodings. It involves re-
 opening documents with a new encoding and then save as and setting
 the new one which is not as flexible as SubEthaEdit for example.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



.htaccess and mime-types

2009-08-25 Thread jason m

I have a cakephp 1.2 app (1.2.2.8120) and I am trying to change the
mime-type for Japanese cell phones on certain pages with this one line
of code in the app/webroot/.htaccess file:
AddType application/xhtml+xml .xhtml

This works for .xhtml files uploaded directly to the webroot folder,
but regular cakephp pages don't work.

I have tried to add the same .htaccess line of code to the
app/.htaccess and /.htaccess files but it did not work.
I also added the line: header('Content-type: xhtml+xml');  to the
beforeFilter() method of the app_controller, but that also did not
work.

Thanks ahead of time for any help you can provide.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Syntax errors running console script on production server

2009-05-18 Thread Jason

I have a working app that runs with no errors on my local machine.
When I upload it to my production server (DreamHost) the app works
fine in the browser, but I have a shell script that I run through the
console that gives me errors on the production server.

The errors I'm getting seem to have to do with class object syntax.
For example - this function declaration in my shell file:

private function _checkRules($text, $author_type, $rules) {

Produces this error

Parse error: syntax error, unexpected T_STRING, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/jasford/
feedmagnet.com/app/vendors/shells/import.php on line 72

but if I remove the word private from the front of the line it does
not return a syntax error.

Does anyone have any idea what could be going on here? I'm running PHP
5.2.9 locally (Entropy release 7) and PHP 5.2.6 on the remote server.

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



Re: Syntax errors running console script on production server

2009-05-18 Thread Jason

I've found a few other posts where people are having similar problems,
but all of them seem to be solving their problems by realizing that
they are running PHP4 on the production server. In my case, I am
definitely running PHP5 - and I don't have any errors using Cake
classes and methods through the browser interface. The issue only
surfaces when I'm running my shell script. In fact - one of my models
is being used by the shell script and a few standard controllers and
it is only throwing an error when run through the shell script.

- Jason

On May 18, 3:15 pm, Jason jasf...@gmail.com wrote:
 I have a working app that runs with no errors on my local machine.
 When I upload it to my production server (DreamHost) the app works
 fine in the browser, but I have a shell script that I run through the
 console that gives me errors on the production server.

 The errors I'm getting seem to have to do with class object syntax.
 For example - this function declaration in my shell file:

 private function _checkRules($text, $author_type, $rules) {

 Produces this error

 Parse error: syntax error, unexpected T_STRING, expecting
 T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/jasford/
 feedmagnet.com/app/vendors/shells/import.php on line 72

 but if I remove the word private from the front of the line it does
 not return a syntax error.

 Does anyone have any idea what could be going on here? I'm running PHP
 5.2.9 locally (Entropy release 7) and PHP 5.2.6 on the remote server.

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



Recursive delete not working

2009-05-11 Thread Jason

I can't figure out what I'm doing wrong here. I'm fairly new to
CakePHP and have been having a lot of success getting a new app set
up, but I'm running up against a brick wall trying to get recursive
delete working.

Here is my Account model:

class Account extends AppModel {
var $hasMany = array(
'Searchfeed' = array(
'order'  = 'Searchfeed.created DESC',
'dependant'  = true,
'exclusive'  = true
),
'Author' = array(
'order'  = 'Author.created DESC',
'dependant'  = true,
'exclusive'  = true
),
'Rule' = array(
'order'  = 'Rule.created DESC',
'dependant'  = true,
'exclusive'  = true
),
);
}

I am running this in the controller:

$this-Account-del($id);

Cake generates SQL to delete from the accounts table, but it does not
even attempt to touch the other tables that are dependent. I even
tried forcing the $cascade variable (which default to true) like this:

$this-Account-del($id, true);

But I get the same result. It only deletes from the primary model, not
from the dependent models. What am I doing wrong?

- Jason

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



Re: Recursive delete not working

2009-05-11 Thread Jason

Wow - so I feel dumb about that mistake! I updated my code and it is
working now. I was going crazy trying to figure that out!

Now I'm having an issue where bindings that are established in the
model are recursively deleting, but bindings I set on the fly in the
controller are not deleting. Here's the code from my controller:

$this-Account-bindModel(array('hasMany' = array(
'Update' = array('dependent' = true, 'exclusive' = 
true),
'Feed' = array('dependent' = true, 'exclusive' = 
true)
)));
$this-Account-delete($id);

The Searchfeed, Author, and Rule models are recursively deleting based
on my model code from above (with the spelling error fixed) but the
Update and Feed models are not deleting.

Is there some trick for getting on-the-fly bindings to work with
recursive deletion?

Thanks!
- Jason

On May 11, 3:00 am, schneimi michael.schne...@arcor.de wrote:
 Hi,

 just a misspelling, try 'dependent' instead of 'dependant' ;-)

 Michael

 Jason schrieb:

  I can't figure out what I'm doing wrong here. I'm fairly new to
  CakePHP and have been having a lot of success getting a new app set
  up, but I'm running up against a brick wall trying to getrecursive
 deleteworking.

  Here is my Account model:

  class Account extends AppModel {
     var $hasMany = array(
             'Searchfeed' = array(
                     'order'          = 'Searchfeed.created DESC',
                     'dependant'      = true,
                     'exclusive'      = true
             ),
             'Author' = array(
                     'order'          = 'Author.created DESC',
                     'dependant'      = true,
                     'exclusive'      = true
             ),
             'Rule' = array(
                     'order'          = 'Rule.created DESC',
                     'dependant'      = true,
                     'exclusive'      = true
             ),
     );
  }

  I am running this in the controller:

  $this-Account-del($id);

  Cake generates SQL todeletefrom the accounts table, but it does not
  even attempt to touch the other tables that are dependent. I even
  tried forcing the $cascade variable (which default to true) like this:

  $this-Account-del($id, true);

  But I get the same result. It only deletes from the primary model, not
  from the dependent models. What am I doing wrong?

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



Re: Recursive delete not working

2009-05-11 Thread Jason

I figured it out. For the recursive delete to work, you have to set
the second parameter of bindModel to true, which makes the binding
still until the end of the request. Otherwise it only sticks for the
next Model operation and then reverts back to not existing before it
gets a chance to do the other recursive delete Model operations.

Here's my revised controller code:

$this-Account-bindModel(
array('hasMany' = array(
'Update' = array('dependent' = true, 'exclusive' = true),
'Feed' = array('dependent' = true, 'exclusive' = true)
),
true
));
$this-Account-delete($id);

- Jason

On May 11, 3:52 pm, Jason jasf...@gmail.com wrote:
 Wow - so I feel dumb about that mistake! I updated my code and it is
 working now. I was going crazy trying to figure that out!

 Now I'm having an issue where bindings that are established in the
 model are recursively deleting, but bindings I set on the fly in the
 controller are not deleting. Here's the code from my controller:

                 $this-Account-bindModel(array('hasMany' = array(
                         'Update' = array('dependent' = true, 'exclusive' = 
 true),
                         'Feed' = array('dependent' = true, 'exclusive' = 
 true)
                 )));
                 $this-Account-delete($id);

 The Searchfeed, Author, and Rule models are recursively deleting based
 on my model code from above (with the spelling error fixed) but the
 Update and Feed models are not deleting.

 Is there some trick for getting on-the-fly bindings to work 
 withrecursivedeletion?

 Thanks!
 - Jason

 On May 11, 3:00 am, schneimi michael.schne...@arcor.de wrote:

  Hi,

  just a misspelling, try 'dependent' instead of 'dependant' ;-)

  Michael

  Jason schrieb:

   I can't figure out what I'm doing wrong here. I'm fairly new to
   CakePHP and have been having a lot of success getting a new app set
   up, but I'm running up against a brick wall trying to getrecursive
  deleteworking.

   Here is my Account model:

   class Account extends AppModel {
      var $hasMany = array(
              'Searchfeed' = array(
                      'order'          = 'Searchfeed.created DESC',
                      'dependant'      = true,
                      'exclusive'      = true
              ),
              'Author' = array(
                      'order'          = 'Author.created DESC',
                      'dependant'      = true,
                      'exclusive'      = true
              ),
              'Rule' = array(
                      'order'          = 'Rule.created DESC',
                      'dependant'      = true,
                      'exclusive'      = true
              ),
      );
   }

   I am running this in the controller:

   $this-Account-del($id);

   Cake generates SQL todeletefrom the accounts table, but it does not
   even attempt to touch the other tables that are dependent. I even
   tried forcing the $cascade variable (which default to true) like this:

   $this-Account-del($id, true);

   But I get the same result. It only deletes from the primary model, not
   from the dependent models. What am I doing wrong?

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



Add additional field in a hasandbelongstomany association

2009-05-04 Thread Jason T.

Hello--
I am building a site where there will be customers and products.  I
built a customers_products table and set up all the
hasandbelongstomany associations correctly.

My table is:

*  id
*  customer_id
*  product_id

Very simple, and it works fine.  I want to have the notion of a large
or small version of the product however.  It's a food box for a local
organic farm--so you can choose a fruit box, or a food box, etc.  The
items you can choose from are the same, you just happen to either get
X or Y quantity depending on the size of the box you order.  I want
the person from the farm to only have to set what is available that
week for a generic fruit/food/flower/etc box, and not separate items
for a large vs. small box.

Would I add this box size field in the customers_products table, or
somewhere else? Such as:

table customers_products
*  id
*  customer_id
*  product_id
*  size

Thanks in advance for any help.  I tried to find this answer but I
wasn't coming up with the right terms to search for I guess.

Jason



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



Re: Views in CakePHP

2009-04-20 Thread Jason Wydro
But you can use the .thtml convention in 1.2 if you wish. I would not though
for the sake of convention.

On Mon, Apr 20, 2009 at 3:03 PM, brian bally.z...@gmail.com wrote:


 The .thtml extension is from the Cake1.1.x series. The newer 1.2.x
 releases use .ctp.

 On Mon, Apr 20, 2009 at 5:31 PM, brian futurahardw...@gmail.com wrote:
 
  Which is the diffrerence between .thtml and .ctp in views?
 
  Thanks,
 
  Fernando
 
  
 

 



-- 
All the best,

Jason Wydro
w3developing, LLC

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



Call a function right before execute any other function

2009-03-27 Thread Jason

Hi all,

I'm writing a facebook app, using flash  PHP. I need to verify that
the flash is called inside facebook, therefore I need to call a
function verify() in PHP which do something to verify that the request
is legit. I don't want to use

if ($this-verify()) {
//do stuff
}

for every single version. I believe I need to change something in the
core of CakePHP but don't know where to begin. Anyone who familiar
with the core could help me?

Thanks,
Jason

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



Call a function right before execute any other function

2009-03-27 Thread Jason

Hi all,

I want to call a check function before the bootstrapping starts. I
believe I need to change in the core of cakePHP, but don't know where
to begin. Anyone who familiar with the core could help me?

Thanks,
Jason

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



Re: How to create models for complex database designs like this?

2009-03-11 Thread jason m

assuming your relations are setup correctly in the models, you
probably
just need to use the recursive in the movies controller.
$movies = $this-Movie-find('all', array('recursive'=2));

that should give you a list of celebs data for each cast. then just
use a
pr($movies) to see what is in the array.

On Mar 8, 9:40 pm, Rajesh rajesh.mukk...@gmail.com wrote:
 I am working on movie site. Client have movie records in following
 structure.

 CREATE TABLE IF NOT EXISTS `movies` (
   `id` int(50) NOT NULL AUTO_INCREMENT,
   `movieName` varchar(500) NOT NULL,
   `year` int(11) DEFAULT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `celebrities` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `name` varchar(250) NOT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `casts` (
   `movie_id` int(50) NOT NULL,
   `role` varchar(200) DEFAULT NULL,
   `celebrity_id` int(11) NOT NULL DEFAULT '0',
   KEY `movieid` (`movie_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

 As you can see movies has casts, casts table contains movie_id and
 celebrity_id. celebrities master table is for storing all master
 celebrity names.

 Now my problem is i have created models for movie and celebrity like
 movie hasmany cast. In movie page aim getting movie details along
 related casts. But celebrity_is is showing id instead of name how
 can i get celebrity name instead of id. Please help me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Converting SQL query to Cake query

2009-03-07 Thread jason m

I think you should look into one of the methods using the Set class
when
combining results from a count query like this. I'm not sure exactly
which
set method you should use but maybe Set::combine.

http://book.cakephp.org/view/662/combine

I think there is nothing wrong with using a foreach to combine the
array,
but it seems like the best practice is to use the Set class in place
of for/foreach
loops. I came across this kind of problem before, and sometimes if
it's too
complicated to do it the cake way, I end up just using regular php and
sql
queries. Nothing wrong with that.


On Mar 7, 2:33 am, RyOnLife ryan.mckil...@gmail.com wrote:
 Here's the afterFind(). It works. Would just like some comments on whether
 this is a sound approach.

   function afterFind($results) {
     if(!empty($results[0]['Page']) 
 !empty($results[0][0]['total_view_count'])) {
       $i = 0;
       foreach($results as $result) {
         $results[$i]['Page']['total_view_count'] =
 $result[0]['total_view_count'];
         unset($results[$i][0]);
         $i++;
       }
     }
     return $results;
   }

 I'm much more unsure about the latter question of whether there is a place
 in the Page model to do the bind. And now I'm wondering if it would be
 possible and make sense to create a total_view_count.php file in the models
 folder.





 RyOnLife wrote:

  @grigri: Thanks. Just what I was looking for. I hadn't used bindModel()
  before, but now makes total sense on getting from the SQL to Cake query.

  This does lead me to two follow up questions...

  The $results array looks like this:

  Array
  (
      [0] = Array
          (
              [Page] = Array
                  (
                      [id] = 1
                      [user_id] = 1
                      [title] = test
                      [slug] = test
                      [created] = 2009-02-19 12:58:14
                  )

              [0] = Array
                  (
                      [page_view_count] = 10
                  )
          )
  )

  If I want page_view_count in the Page array, is the best approach to
  manipulate it to my liking in the afterFind() callback in the Page model?

  Since I am always going to want this 'page_view_count' data, I tried
  moving the bindModel() code to the beforeFind() callback in the Page
  model. Caused all sorts of problems, I imagine because beforeFind() gets
  triggered numerous times through the various associations between all the
  models. Should I stick to binding over and over in my controllers, or is
  there a way to do it in the models?

  I ask both these questions because I'm anticipating a lot of redundant
  code with the array manipulation and binding. Something tells me there is
  a better way.

  grigri wrote:

  Try this:

  $this-Page-bindModel(array(
    'hasOne' = array(
      'PageViewTotal' = array(
        'className' = 'PageView',
        'type' = 'inner'
      )
    )
  ));
  $results = $this-Page-find('all', array(
    'fields' = array('Page.*', 'COUNT(PageViewTotal.id) AS
  page_view_count'),
    'group' = 'Page.id',
    'order' = 'page_view_count DESC',
    'limit' = 10
  ));

  hth
  grigri

  On Mar 6, 3:36 pm, RyOnLife ryan.mckil...@gmail.com wrote:
  This doesn't work because 'view_count' is not a field. All of the view
  data
  is contained in the 'View' model, keyed to the 'Page' model (Post in
  your
  example).

  Maybe it would help if I share the full details of my models, tables and
  the
  SQL query/result I would like to create in Cake:

  Page hasMany PageView:

  CREATE TABLE IF NOT EXISTS `pages` (
    `id` int(11) NOT NULL auto_increment,
    `user_id` int(11) NOT NULL,
    `title` varchar(100) NOT NULL,
    `slug` varchar(100) NOT NULL,
    `created` datetime NOT NULL,
    PRIMARY KEY  (`id`),
    FULLTEXT KEY `title` (`title`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

  PageView belongsTo Page:

  CREATE TABLE IF NOT EXISTS `page_views` (
    `id` int(11) NOT NULL auto_increment,
    `page_id` int(11) NOT NULL,
    `user_id` int(11) default NULL,
    `user_ip` int(10) unsigned default NULL,
    `created` datetime NOT NULL,
    PRIMARY KEY  (`id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;

  SQL query:

  SELECT Page.*, COUNT(*) AS views FROM
  pages AS Page
  INNER JOIN page_views AS PageView ON Page.id = PageView.page_id
  GROUP BY Page.id
  ORDER BY COUNT(*) DESC  
  LIMIT 10 OFFSET 0;

  Returns these fields:

  id, user_id, title, slug, created, views

  The first five fields are those from the Page model and the sixth field,
  views, is a count of how many times the Page.id primary key is used as a
  PageView.page_id foreign key.

  Thanks for the help. I know Cake is supposed to make SQL easier, but I
  am
  having trouble making the jump from SQL to Cake queries where the SQL is
  more involved than simple SELECT statements.

  Stu-2 wrote:

   $topTen = $this-Post-find('list',
   array(
   'fields' = array('Post.id', 

Re: Wordpress and cakephp

2009-01-25 Thread jason m

+1 for wildflower. I'm not sure if it's done yet but I think the
wildflower developer wanted to make it into a plugin so you could just
pop it into your plugin folder and use it right away, while the rest
of your app is separate.

On Jan 24, 6:15 pm, ache...@gmail.com ache...@gmail.com wrote:
 You might look into using something like wildflower (http://
 code.google.com/p/wildflower/) to handle this. It has a blog and basic
 CMS as well as some other really nice features. Just an idea though.
 That way no one is reinventing the wheel.

 On Jan 23, 6:21 am, ross.hagg...@googlemail.com



 ross.hagg...@googlemail.com wrote:
  Hi

  I'm looking to use wordpress and cakephp to develop a site.  I would
  like to use wordpress for basic cms functionality i.e. administration,
  news  events, uploading publications etc. with cakephp being used for
  functionality on the site, registration, members area etc.  I could
  attempt all in cakephp, but wordpress would cut down a lot of work.
  Can anyone give me advice on this, experience, am i going down the
  wrong path?

  Many thanks

  Ross
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Rails 2 CakePHP

2009-01-18 Thread jason white
I'm wondering the same. I have been using rails for about a year, and enjoy
it. But there is not much of a desire for it in my area, and i'm looking at
moving to PHP.

jason

On Sun, Jan 18, 2009 at 1:43 PM, vlain rudi.ver...@gmail.com wrote:


 I worked with Rails for one year and I found it a good framework and
 Ruby a brilliant language.
 But now I have to come back to PHP. My choice is CakePHP.

 What is the main differences between Cake and Rails? Similarities?

 Does anyone know cheatsheets or tutorials that shows methods and
 methodologies between the twos?

 Thanks,

 


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



Re: API

2009-01-04 Thread jason m

Also, the first line of the find method description says that it
returns a single row as a resultset array. That might have been true
for cake 1.1 but for 1.2 I generally use the find method for basically
any kind of read from the model, and this method if probably the one I
use most and therefore needs a short, concise, understandable
description.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: API

2009-01-04 Thread jason m

One of the most confusing areas of the API when pre-release versions
of cake 1.2 came out was probably the Model::find method. I think the
cookbook covers it very well, but just by looking at the api, you
wouldn't really know how to use it. A simple link to the cookbook in
the commend will probably do the trick and would help out many new
cake users as well as people who might be converting their 1.1 apps.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: findCount different then find('count')

2008-12-30 Thread jason m

i think it should be

return $this-find('count', array('conditions'=$conditions));

On Dec 30, 2:59 pm, gearvOsh mileswjohn...@gmail.com wrote:
 All I did was this:

 return $this-find('count', $conditions);
 return $this-findCount($conditions);

 $conditions = array('OR' = array(
  'Friend.user_id'        = $user_id,
  'Friend.friend_id'      = $user_id
  ));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: findCount different then find('count')

2008-12-30 Thread jason m

i think all of the new find methods like 'count', 'all', 'first', etc
take a second parameter which is an array with all the options.
See api.cakephp.org.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: css is not caling

2008-12-30 Thread jason m

usually you would include the css in the head tag. also the things i
would try are:
1) set the debug level to 2 in config/core.php if it's not already.
2) there might be an error somewhere else in your code
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple table access from within a model

2008-11-25 Thread Jason

I have the following tables,

events
+-id
+-offering_id
...

offerings
+-id
+-program_id
+-start_date
...

programs
+-id
+-name
...

One program could have many offerings, but each offering is tied to
one program.  I have the $belongsTo and $hasMany set up via Bake.  I
would like to regularly be able to grab the associated row from
`programs` and use the afterFind function to dynamically create the
offering name (which will be a concatenation of the program name and
the offering start date.)  However, only sometimes does the associated
Program appear in the results.  Specifically, when accessing the
offerings_controller, associated events and programs appear in the
results.  But when I use the events_controller, Program is not in the
results array.  I have defined $uses = Array( 'Event', 'Offering',
'Program' ) in the events_controller, but still no dice.  Is there a
way to tell a model that I need it to pull the associated Program
record EVERY TIME?


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



Re: Help needed for inline WISIWYG editor...

2008-11-14 Thread jason m

I have had a lot of luck with fckeditor in my cake projects. There is
also a tutorial for it in the bakery.

On Nov 14, 5:30 pm, Aneesh S [EMAIL PROTECTED] wrote:
 thanks, but i need more options yahoo would be my choice...
 Aneesh S
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



More HABTM questions

2008-11-10 Thread Jason

Sorry to beat what is certainly a very uncomfortable horse...

The db is as follows
Users HABTM Groups HABTM Reports  (using Group_Users and Group_Reports
tables to manage relationships)

I want to have conditions on both users and reports while returning a
particular report only once. Basically I'm using groups for access
control. Session gives user id, which is a member of one or more
groups, each giving access to one or more reports. The problem is that
just about any query I build using 'the framework' gives me multiple
copies of the report (because a report can be in more than one group
and a user could be in more than one of those groups.). I can do this
with a SQL query, but then I lose all that paginate magic and
potential future magic. I could also run a array_unique on the
resultset, but that too has it's problems.

Here's an example of what I was attempting to use.

$this-paginate = array(
'fields'= 'id',
'conditions'= $userConditions,
'contain'   = array(
'Group' = array(
'fields'= array(),
'Report'= array(
'conditions'= $reportConditions,
'fields'= $reportFields
)
)
)
);

Where among other things userConditions includes User.id =
Session['User']['id']
and Reports are filtered by type

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



Re: Forum instead of Mailing List?

2008-10-29 Thread Jason Qualkenbush

On Oct 29, 4:42 am, AD7six [EMAIL PROTECTED] wrote:
 On Oct 28, 11:45 pm, 703designs [EMAIL PROTECTED] wrote:

  Just an idea. I think that the Bakery's in a good position right now
  (as the heart of the Cake community), and that the CakePHP knowledge
  base and its usability would improve if discussions took place in a
  regular web forum rather than on a mailing list. Thoughts?

 I've always been curious as to whether people asking for a forum have
 used the group web interface or 
 not?http://groups.google.com/group/cake-php/topics

 What concrete advantage is there in using a forum.

 AD

I agree.  Just take a look here:
http://groups.google.com/group/cake-php/topics

It's just like a forum without the animated avatars.

-Jason

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



How do I query after baking?

2008-10-29 Thread Jason Qualkenbush

I created the database, then the models.  I tried out the scaffolding,
and that worked great.  Then I was able to cake bake to get
controllers and views.  Now I'm working on modifying this thing.  I
don't want to select all from the table, just items that don't have a
comment.

?php
class PatchesController extends AppController {

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

function index() {
$this-Patch-recursive = 0;
#$this-set('patches', $this-paginate());
$sql = SELECT patches.* FROM patches,responses WHERE
responses.patch_id  patches.id;
$this-set('patches', $this-Patch-query($sql));
}

(The commented part is what bake gave me)

I tried doing the above, but I just get a blank page.  I added LIMIT
0, 30 to the query (because there are 3,000 rows) and just get an
error.  Is this a custom query?  Do I need a custom query?

I keep searching for cakephp and query, but all I end up with is how
to paginate a custom query.  I just want to know how to do a query at
all.

-Jason

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



Cakephp Conference Japan

2008-10-27 Thread jason m

I attended the cakephp conference in tokyo last saturday. Many
different people presented various things about cakephp such as
cakephp testing, and general information about cakephp. Also Garrett
Woodsworth presented about the state of cakephp and about the cakephp
roadmap. One interesting point I learned was every release of cakephp
is not released unless there are no bugs in the bug database. Also
that a good cake application has a lot of code in the model and less
in the controller. I learned this recently by looking at this group
but have never heard it directly from the cakephp team.

All in all, I was very impressed with the presence cakephp has in
Japan. When I signed up for the cakephp event on their website, within
40 seconds after the signup period started, about 20 other people had
already signed up. I'm so glad I started learning cakephp two years
ago.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Mocking the redirect function of a controller.

2008-10-06 Thread Jason Schadel

I'm having problems setting up a mocked controller for testing.

I generated the partial mock with the following:

Mock::generatePartial('AccountsController',
  'MockAccountsController',
  array('redirect'));

Then in the startTest method of the CakeTestCase, I did this:

$this-Accounts =  new MockAccountsController();
$this-Accounts-autoRender = true;
$this-Accounts-__construct();
$this-Accounts-constructClasses();

This still redirects me to another page when the redirect method is called.

Can anyone shed any light on testing controllers that contain calls to
redirect functions?

Does anyone have any examples of testing their controllers using this
method or any other way?

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



MySQL Error on the first tutorial (blog)

2008-06-05 Thread Jason Ourscene

Set up cake without a hitch. Moving onto the first part where we
create the blog database i am getting this error:

Here is the command:
CREATE TABLE posts (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(50),
  body TEXT,
  created DATETIME DEFAULT NOT NULL,
  modified DATETIME DEFAULT NOT NULL
);

And here is the error:
ERROR 1064 (42000): 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 'NOT NULL,
modified DATETIME DEFAULT NOT NULL)' at line 5


I cant figure this one out. Thanks!

Jason

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



MySQL Error on the first tutorial (blog)

2008-06-05 Thread Jason Ourscene

This is my second time posting, so if it shows up again i apologize, I
refreshed during the last post.

So the command im sending is.
# CREATE TABLE posts (
# id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
# title VARCHAR(50),
# body TEXT,
# created DATETIME DEFAULT NOT NULL,
# modified DATETIME DEFAULT NOT NULL
# );

without the comments
and the error im getting is.

ERROR 1064 (42000): 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 'NOT NULL,
modified DATETIME DEFAULT NOT NULL
)' at line 5

im new to all this and have been trying to figure it out, but no avail

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



Dispatcher Fatal Error when going through the blog tutorial.

2008-06-05 Thread Jason Ourscene

Following along the tutorial and when i get past the part where you
build your first view and hit the url localhost/posts/index

I get this error.

Fatal error: Class 'PostsController' not found in /Users/jasoncalleiro/
Sites/cakeblog/cake/dispatcher.php on line 157


Any clue?

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



Dispatcher Fatal Error when going through the blog tutorial.

2008-06-05 Thread Jason Ourscene

Fatal error: Class 'PostsController' not found in /Users/jasoncalleiro/
Sites/cakeblog/cake/dispatcher.php on line 157

Thats what im getting after i create the index.thml file for my post.

Any idea.
Here is the code in my controller.

?php

Class Posts_Controller extends AppController
{

var $name = 'Posts';

function index()
{
$this-set('posts', $this-Post-findAll());
}

}


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



Re: MySQL Error on the first tutorial (blog)

2008-06-05 Thread Jason Ourscene

Thanks, got it working.. got a new error now that im posting in a
seperate post.

On Jun 5, 1:02 pm, leo [EMAIL PROTECTED] wrote:
 Delete the two occurrences of the word DEFAULT and try again.

 On 5 Juny, 18:26, Jason Ourscene [EMAIL PROTECTED] wrote:

  Set up cake without a hitch. Moving onto the first part where we
  create the blog database i am getting this error:

  Here is the command:
  CREATE TABLE posts (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(50),
    body TEXT,
    created DATETIME DEFAULT NOT NULL,
    modified DATETIME DEFAULT NOT NULL
  );

  And here is the error:
  ERROR 1064 (42000): 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 'NOT NULL,
  modified DATETIME DEFAULT NOT NULL)' at line 5

  I cant figure this one out. Thanks!

  Jason

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



Newcomer with feedback and question with a concern

2008-05-15 Thread Jason Carlson
Old time programmer (since 1979) and fan of PHP (since '97) who decided to
venture out and see what all the fussing over the OS frameworks was all
about.  I was enticed by a PHP Magazine article on CakePHP and after reading
a lot of the pros and cons of different frameworks this seemed like the best
fit so what I wanted to try out.  For my first project I decided to take a
database from an older site I was thinking of revamping anyways.  Turns out
I ran into problems right away because Cake does not support a multi-column
primary index.  Ouch, I use these a lot and so do a lot of programmers I
know.  Rather than just deleting Cake and moving on to try another
framework.  my curious nature got me interested as to why this was.

I found a number of discussions on this and honestly what I found disturbed
me.  A number of the responses were very obvious that the poster has a very
limited understanding of relational databases, they had no clue as to the
difference between a key and an index, and could not grasp why anyone would
want this and thus deemed it as unimportant.  My concern is these posters
were posing as CakePHP experts.  Being an old timer in the greater
programming community (since '79) I do fully realize that upon entering a
new community (CakePHP) that there are going to be experts and the usual
vocal wannabes and so I took this with a grain of salt.

However then I came to https://trac.cakephp.org/ticket/1293

Here this feature was requested by a couple of folks.  The developer nate
responds to the first requester by saying this is definitely not the
direction they want to take CakePHP in but gives no other reason why.  The
second requester sees what I see in that it doesn't look like they think it
is important so he re-opens it mentioning that it is important enough that
ZF supports this.  The same developer not only shuts it down but minimizes
it to trivial and warns the guy about ever mentioning ZF.  I've not looked
at ZF personally but is it not open source and if there are good ideas in it
is it not okay to adopt them, after all isn't CakePHP isn't original but
based strongly on Ruby on Rails from what I understand.

So from the outside, what am I to assume?  No real reason is given for
CakePHP not supporting this and by the way it is closed down it is like they
don't even want to ever consider supporting a database table's multi-column
primary index as a key, even though the SQL databases CakePHP supports do
support this and recommend it for optimized SQL setups.  Shutting it down
without an explanation gives the impression it was beyond the developers
comprehension as otherwise why wouldn't they explain it.  Who knows, perhaps
the developer did explain it offline and had a very good reason, perhaps he
was having a bad development day and couldn't handle someone comparing his
software to a competitors, or perhaps the person requesting this was
annoying to the group and they were tired of answering them.

With what is posted however, I hope you can understand why as a newbie to
CakePHP I have my concerns.

I can only take it as I read it posted by the developer where they are not
interested in taking CakePHP in this direction.  So now I'd like to know why
before I throw any real support behind CakePHP.  Database development years
ago worked hard to add this ability for performance and integrity purposes
so why would CakePHP not take advantage of that strength in the supporting
database.  The suggestions I found on the various CakePHP posts I could find
was to add a new field to these tables and make it the primary index/key and
then take the other existing tables (that used to make the primary
multi-column index) and make them into a unique key.  To a database a
primary index is always a unique key whether it is multi-column or not so it
seems like a huge waste of resources to have an extra redundant resource.
It'd be like adding a birthdate and age column to the same database only
with a bigger performance hit.

This got me curious, I know it used to be significantly faster using
multi-column indexes (thus why databases added this ability) but having not
tested that in years I ran some benchmarks just now.  Inserting 1 billion
records took only 1 second longer on average when having the two indexes as
the CakePHP posts suggested I convert them too.  Yet they all took exactly
twice the amount of disk/ram space. Thus as I expected, SELECT queries on
the other hand did see a performance hit compared to data stored with one
multi-column primary index.  But it wasn't a huge hit.  Having not looked
into the bowels of CakePHP and how it does it's object relational mapping I
can only guess it is not being done because it is either too much work for a
small performance gain, or the extra overhead the CakePHP model objects need
to handle this out weight the performance gains.

If anyone has the actual reason of why CakePHP won't consider this I'd
greatly appreciate it.

I only felt it important to 

Re: installing cakephp on a subdomain

2008-05-15 Thread jason m

There are many different server configurations and I too have had
problems installing cakephp. I guess the first step would be to see if
php is working. You could do that by placing a php file there with the
code ?php phpinfo(); ?. That should print out a bunch of your php
settings.

If you httpdocs is your webroot for the subdomain and you placed the
cakephp files directly into the httpdocs folder, then the directory
structure would look something like httpdocs/app for the app root.
Then, assuming that the mod_rewrite module is enabled in apache, you
should be able to just go to http://dev.domain.com and cake should
appear. This requires that the .htaccess files be there. If you cannot
see them, it may be because files that begin with . are hidden by
default in osx so you wouldn't be able to see them in your ftp client
unless you adjust your settings.

If the apache mod_rewrite module is not enabled (you can check that
with the test php file created earlier), then the url should be
something like http://dev.domain.com/index.php/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: looking for a hosting company

2008-03-27 Thread jason m

I've had success with media temple dedicated virtual servers. They are
about $50/month (a little less if you pay a year in advance) and I
setup cake many times with no problems so far. Speed is pretty good
and also the support was always quick and helpful. It was also easy to
manage clients and setup auto backups with their plesk software.

On Mar 26, 9:53 pm, Zoltan [EMAIL PROTECTED] wrote:
 Just wondering if anyone has a hosting company they'd recommend.
 I've personally hosted a few sites on DreamHost, speed is ok, but
 getting Cake sites up and running is problem-free. On the other hand,
 I've used Rackspace, which is faster, but keep on running into
 problems.

 If anybody has a hosting company they'd recommend, I'd appreciate it.

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



Re: Unit Testing Controller using fixture in test_suit config

2008-03-08 Thread Jason

I've spent the last two days working with this and whilst I have had
some success I eventually came to the conclusion that it's not really
the best way to test controllers, at least not for me. I don't think
that's the way they intended it to be used and I'm starting to agree
with them. Either that or they've just beaten me down *until* I agree
with them...

Here's one way I got it to use the test suite settings in my
controller:

function testTest()
{
$controller = new MembersController();
$controller-Member = new MemberTest();
$controller-MemberProfile = new MemberProfileTest();
$controller-Project = new ProjectTest();

$controller-get(1);

debug($controller-viewVars);

/* assert things here */
}

It's really naff which is why I eventually decided on another course
of action, but it does force my controller to use the test suite
Models (obviously you need to declare those test Models somewhere so
that they use the test suite tables set up by your fixtures).
$controller-viewVars should contain any of the things which have been
set in your Controller for passing to the View, and I assume that's
what you'd be wanting to inspect.

Trouble is that this isn't strictly unit testing since you're not
testing the Controller in isolation, you're testing the Controller and
the Model (and the View if you use testAction). The way I'm now trying
to work it is to put a lot of the logic from my Controllers into the
Model so it can be tested. To be honest I should have done it that way
in the first place since things like login validation for passwords
and the like probably belong there. That means I can test more of the
application with the test suite doing what it is best at and testing
of the Controllers is much less of an issue.

I suggest that if you want to test the Controller then you create
mocks for your Models, i.e. Models that don't really interact with the
database but have predefined data in them. That isolates the
Controller for testing and means the database is no longer an issue.
Even then you may have problems with Model associations should you
want to test anything that uses that.

Probably not what you wanted to hear and if anyone else does have a
good (and simple - if it ain't simple then people won't do it) way of
doing it then I'd be very interested. But for now I rather write code
than struggle to actually test it in a repeatable way!


Jason.


On Mar 6, 1:16 am, Micro [EMAIL PROTECTED] wrote:
 Does anyone know how to test controller in CakePhp 1.2 using the
 test_suit controller?  I am using the testAction function to test my
 controller.  However, it goes to the non-test_suit database.  Any idea?

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



Re: multiple submit buttons in a form

2008-03-08 Thread Jason

Check out the $param array in your Controller when the submit occurs:

Array
(
...

[form] = Array
(
[b] = Submit
)

...
)

BTW, I changed the 'name' for your submit button to 'b', so it is
different to the edit button. Obviously if the edit button was clicked
you'd see [a] = Edit.


On Mar 8, 8:47 am, bob [EMAIL PROTECTED] wrote:
 How can I have multiple submit buttons in a form?

 echo $form-create('Form', array('url'=$url));

 echo $form-submit('Edit',array('div'=false,'name'='a','value'='edit'));
 echo
 $form-submit('Submit',array('div'=false,'name'='a','value'='submit'));

 echo $form-end();

 in the above, how do i determine which button i clicked on?

 thanks

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



Find page title?

2008-03-04 Thread Jason

I am getting no where with the documentation.

function view($name = null) {
$this-PageControl-name = $name;
$this-set('post', $this-PageControl-read());
}

This outputs the following...

WHERE `PageControl`.`id` = 'index' LIMIT 1

I want it to output

WHERE `PageControl`.`title` = 'index' LIMIT 1


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



CSS and images?

2008-03-04 Thread Jason

More noob questions.

Where do I put my CSS in relation to the app folder?

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



URL mapping?

2008-03-03 Thread Jason

I am pretty new to cakephp.

Currently I have the following URL.

http://localhost/cake/PageControl/add/

How would I change this url to..

http://localhost/cake/admin/add/

while still using the PageControl. The reason for this is logically it
makes a lot more sense.




My second question.. is it possible map several controllers to a
single URL?

For example above the controller is page_controller. Would it be
possible to map category_controller to the same 'admin' URL assuming
that the functions were different.

As I said above I am new, I hope this makes sense and I hope I will be
enlightened.

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



Re: Edit Records - Select menus and checkboxes?

2008-03-02 Thread Jason

I have tried the following and it works. However I am getting a
warning..

Controller.

function edit($id = null) {
if (empty($this-data)) {
$this-Content-id = $id;
$this-data = $this-Content-read();
} else {
if ($this-Content-save($this-data['Content'])) {
$this-flash('Your post has been updated.','/posts');
}
}
}

edit.ctp

echo $form-select('page', $page, $data['Content']['page'], '', TRUE);

Warning

Notice (8): Undefined variable: data [APP/views/content/edit.ctp, line
17]


How do I get rid of this warning?

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



define() and app_controller

2008-02-21 Thread jason m

I have a method that runs a bunch of define statements for
localizations stored in a database.

function loadAll($language = 'english',$group=null){
$localizations = $this-Localization-findAll(,array('name',
$language));
foreach($localizations as $localization){
define({$localization['Localization']
['name']},{$localization['Localization'][$language]});
}
}

I want this to run on every page that loads but I am having trouble
with where to call the method from. Calling it from a page works like
from index.ctp $this-requestAction('localizations/loadAll/japanese').
However, I don't want to do that on every page. I tried making an
app_controller.php in the app folder and using the beforeRender
function but that didn't work. I also tried the requestAction from the
default layout and that also didn't work. Please tell me what the best
practice is for doing this.

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



Re: generateList deprecated ... how to find a list with conditions?

2008-01-14 Thread jason m

How about if you want a list with two fields like Post.id =
Post.title?

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



RE: Using PHP 5 Functionality In Your App

2007-12-07 Thread Jason Burgess

For the sites we're doing, we've switched to using PHP5.  Since the software
isn't going to be released we weren't worried about anyone trying to run it
using PHP4.

About 6 or 8 months ago, when we started adding support for users to see
times in their local time zone, I started looking for solutions.  The only
one I found that wasn't hugely complicated or flaky at best was the new date
functions in PHP 5.1.  The next day, I upgraded our web servers to PHP5.

I think we're one or two other features that are new in PHP5 but I can't
recall what they are off the top of my head.

Jason Burgess

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Sliv
Sent: Thursday, December 06, 2007 12:22 PM
To: Cake PHP
Subject: Using PHP 5 Functionality In Your App

I was wondering if developers out there who are writing CakePHP apps
in a PHP 5 environment are using PHP 5 functionality in their app(s)
or are choosing to stick with functionality available in 4 or 5?

Since Cake is compatible with both versions, developed apps may want
to be compatible with both as well for portability.  However, perhaps
there are (dis)advantages to using new functionality and I wondered if
folks would share their experiences...


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



RE: Username availabilty check

2007-12-07 Thread Jason Burgess

I've had pretty good luck doing it this way.  Below are the important
snippets of code.  I've left off the actual checking code since that is very
specific to my application.  You can see it in action here:
http://www.area50four.com/signup

From the Signup page:

div id=validationHolder/div
?php echo $html-input(User/username, array('onChange' =
'validateUsername(this.value)')); ?

script
function validateUsername(username)
{
new Ajax.Updater('validationHolder', '/users/checkUsername/' +
username, { evalScripts : true });
}
/script


The entire check_username.thtml:
?php if ($isinvalid): ?
script type=text/javascript
alert('Your username contains invalid characters.  It can only
contain alphanumeric characters and the underscore. It cannot contain
spaces.  For example: A-Z, 0-9 and _');
$('UserUsername').focus();
/script
?php elseif ($isuser): ?
script type=text/javascript
alert('The username you have entered has already been taken.  Please
choose another.');
$('UserUsername').focus();
/script
?php endif; ?


-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Anoop
Sent: Friday, December 07, 2007 8:42 AM
To: Cake PHP
Subject: Username availabilty check


Hi All ,

Can anyone provide me a username availability check script using ajax
helper of cake php.. I am facing the problem that in ajax-link I am
not able to get the username , the user just placed into the form.

?php echo $ajax-link('check',Check,array( 'url'=/registration/
checkUserExists/, 'update'=user_exist));?

How can I include the username the user entered recently to the url??

Please help..Very urgent

Thanks in advance
Anoop


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



Re: Model dependancies based on other relationship

2007-09-22 Thread Jason

I hate to do this, but I gotta give this a bump. No one has any
suggestions? :(

On Sep 21, 6:25 am, Jason [EMAIL PROTECTED] wrote:
 I have an interesting issue with mymodelrelationships that I'm
 attempting to figure out how to take care of in the most elegant
 fashion.

 Basically, I have a Usermodel, a Profilemodel, and then multiple
 extended Profile models (ex: AdminProfile, etc.) which have
 information specific to that type of user.

 The user table has a type column which is an enum and designates
 what type of user I have.

 My relationships are setup so that

 User HAS ONE Profile
 Profile BLEONGS TO User
 AdminProfile BELONGS TO Profile
 XProfile BELONGS TO Profile
 YProfile BELONGS TO Profile

 How can I get this extended profile information linked to my User or
 Profile models on the fly? I know about bindModel and unbindModel, but
 I'm not sure where best to use it.

 One thing I tried was modifying the afterFind() callback for User and
 Profile to grab the user type and do an extra query for the extended
 information. This feels dirty, however. It also breaks scaffolding
 which is kind of annoying because I'm at the beginning stages of this
 project.

 Any suggestions? I saw someone in another similar post mention a
 factormodel. I am familiar with thefactorydesign pattern, however
 I'm not familiar with how to implement it seamlessly within Cake.

 Any help would be greatly appreciated :)


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



Model dependancies based on other relationship

2007-09-21 Thread Jason

I have an interesting issue with my model relationships that I'm
attempting to figure out how to take care of in the most elegant
fashion.

Basically, I have a User model, a Profile model, and then multiple
extended Profile models (ex: AdminProfile, etc.) which have
information specific to that type of user.

The user table has a type column which is an enum and designates
what type of user I have.

My relationships are setup so that

User HAS ONE Profile
Profile BLEONGS TO User
AdminProfile BELONGS TO Profile
XProfile BELONGS TO Profile
YProfile BELONGS TO Profile

How can I get this extended profile information linked to my User or
Profile models on the fly? I know about bindModel and unbindModel, but
I'm not sure where best to use it.

One thing I tried was modifying the afterFind() callback for User and
Profile to grab the user type and do an extra query for the extended
information. This feels dirty, however. It also breaks scaffolding
which is kind of annoying because I'm at the beginning stages of this
project.

Any suggestions? I saw someone in another similar post mention a
factor model. I am familiar with the factory design pattern, however
I'm not familiar with how to implement it seamlessly within Cake.

Any help would be greatly appreciated :)


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



Re: Complex table relationship within one model

2007-09-06 Thread Jason



On Sep 6, 4:02 am, AD7six [EMAIL PROTECTED] wrote:
 Hi Jason,

 Sorry, somethings (How do I keep coders from using these models to
 edit the tables?) lead me to believe you were asking a (internal?)
 security question. And sorry if that tainted the tone of my reply.


Aye, I could have been more clear. :)

  It's not so much a security thing as it is a confusion thing. Cake
  really should have a read only model structure.


The reason for why in my mind is bloat. Why go through the process
of loading an entire ORM object when all you want is read-only access?
I think a read only model type with all the fat trimmed would be a
nice addition. Maybe I'm alone there..


 Irrespective of the behind the scenes stuff, what you want is a (data
 manipulation object) model not a (reusable controllererette)
 component. To access it everywhere you would put var $uses =
 array(NameOfModel); in your app controller

 Even if it was setup like this:

 class GeoModel extends AppModel {
  var $useTable = false;
 ...
   // Define $this-City etc to be an instance of the correct model.
 ...
  function citiesByZip($zipCode) {
   // Seehttp://groups.google.com/group/cake-php/web/frequent-discussions
   // How to handle tricky HasAndBelongsToMany situations?
   ...
   $this-City-zipCode-recursive = -1;
   $zipData = $this-City-ZipCode-findByZipCode($zipCode);
   $zipCodeID = $zipData['Zipcode']['id'];
   $this-City-recursive = 0;
   return $this-City-findAll(Array('CityZip.zip_id' = $zipCodeId));

 }

I agree. $usesTable was not something I was aware existed. RTFM, eh?
In that case I can write my own custom SQL and not have to rely on
Cake for these relationships. It's not that Cake CAN'T do this, I just
know that what I want out of these tables is very specific and Cake's
ORM is way too bloated for it with its internal reflection and
relationships. It just isn't efficient. Being able to use a model
without Cake automatically associating it  to a table, however, is
pretty much what I want. As I said previously, being able to have a
trimmed down read-only version of this would be more ideal, this will
certainly suffice.


Using it this way, which model would I then use? How do I keep coders
from using these models to edit the tables?

 You need only define beforeSave and beforeDelete to return false in
 either the behavior they are all using, or in the models themselves or
 in the abstract class they all inherit from.


Aye, the behavior works nice for this implementation now that I
understand it a bit more.


 You don't need the $uses declaration. but your controller /should/ be
 called ZipCodesController



  4 models
   ZipCode (HABTM City)
   City (HABTM ZipCode, BelongsTo State)
   State (HasMany City, BelongsTo Country)
   Country (HasMany State)


Actually, I mistyped here. The controller was setup correctly and
$uses is there because I was experiementing with differnet models and
didn't feel like creating a new controller just for the scaffolding
while I was trying to track down why Apache was exploding.

  That's it. If I navigate to /ZipCode Apache explodes. Any
  suggestions?

 Do you have a full db and are using 1.1? If so the reason is the
 initial index lists with no limit.

 You'd need to know the reason for the exploding. Probably there is a
 loop somewhere, and if there is it's either (just guesses)
 1) A loop somewhere, possibly due to (incorrect) model definitions
 2) You have all your data in place and have not put a limit in the
 model definition for the number of associated objects to return, as
 such apache is returning a list of zip codes for the index, all
 associated Cities, all secondary associated ZipCodes with no limit
 etc.

 First ensure that your code is following 
 conventionshttp://manual.cakephp.org/appendix/conventions
 Try commenting all your association definitions in the models and
 uncomment them one by one to find the reason. Although frustrating
 that sort of problem always has a tangible and fixable reason.


It seems to be specific to the PHP and Apache version I had. I am
runnig this for now on a WAMP install (wampserver.com) and I just
upgraded to the newest version. After doing that the scaffolding is
working. :)


 Retrieving data - Model. Custom functionality - model functions.
 Which model however is up to you and your design.

 A component would be the wrong place for your data retrieval logic IMO
 (since for one, you would need to then instantiate a model of some
 kind or another to get the data).

 Anyway, hth,

 AD

I appreciate the advice (all of you).. I'll simply define a Geo model
that doesn't have any automatic associations to tables.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group

Re: Complex table relationship within one model

2007-09-05 Thread Jason

Even if I don't create the CRUD functionality, it's still there for
another developer to totally mess things up. To add some level of
protection I've created an AppReadOnlyModel that extends AppModel
which has overridden save and delete functionality. It was easier than
editing the beforeSave and beforeDelete callbacks of every model I
wanted to make readonly.

Copong,

Could you elaborate a little bit on the bind,unbind functionality and
how it could be used here? Or point me in the direction I need to go
in the vast internets to find said functionality? Unfortunately I'm
using cake 1.2 which, while it does have an api, does not have any
contextual manual written for it yet (to my knowledge). I don't
remember this functionality being in 1.1.

Thanks again!


On Sep 5, 6:22 am, Copongcopong [EMAIL PROTECTED] wrote:
 first, do the 1 table 1 model as suggested.

  I need a way to have an object talk to these tables ...

 A Component will surely help on this. have this component (e.g.
 GeoComponent) load the Models during initialization
 Component::__construct().
 You may create different methods/functions for accessing the
 information from the Models.
 You may also prefer to use Model::bindModel()/Model::unbind() feature
 so that you can dynamically alter the tables' association to minimize
 table joins/queries.


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



Re: Complex table relationship within one model

2007-09-05 Thread Jason



On Sep 5, 12:01 pm, Ketan Patel [EMAIL PROTECTED] wrote:
 You were on right track for creating a AppReadOnlyModel which extends
 AppModel and overwrite the beforeSave, beforeDelete methods.

 There are mistakes with your relations. I think the right relations
 are:
 ZipCode hasOne City
 City hasMany ZipCode


You would think so, huh? ;)

In actuality, some zip codes have multiple city names - especially in
rural areas. So, it truly is HABTM.

Some examples:

16617 = Bellwood, PA and Antis, PA
27616 = Raleigh, NC and Brentwood, NC

I was also surprised to learn this.

 Now, that you have all your zipcode, city, state and country model
 extend AppReadOnlyModel, the only thing missing is the distance
 calculation. How are you going to calculate the distance? Is it going
 to be based on the zipcode inputs (11211 to 19232) or city input
 (Austin to Houston). Then depending on this, you have to decide which
 model the function would go for calculateDistance(). I would be
 interested in knowing your implementation as I might do something
 similar in future.


I've done the radius calculation before. I would be doing it from zip
code to zip code. I would also have other function hooks such as
getZipCodesByCity(), getCitiesByZipCode(), getStateByCity(), etc.

If you want to know how to do the calculation itself I could help you
out there. I will most likely be implementing some caching mechanism
for these calculations, as well, since they are rather intensive. I
just want to setup the object model properly before I worry about
that, however.

If I can make this a component that is portable, I would be more than
happy to throw it up on the bakery.

 Ketanhttp://www.eclassifieds4u.com

 Jason wrote:
  This is my first post to this group, so I'd like to say hello
  first. :) This post seems long, but the question is pretty simple -
  not sure about the answer.

  My question revolves around models. I have 5 tables that represent
  geographic information. I want to use this to do radius searches among
  other things.

  My problem is I'm not sure how to represent this data within Cake. My
  tables are setup as follows:

  zip_codes
  zip_code
  latitude
  longitude
  dst (daylights saving - boolean)
  timezone

  cities
  id
  state_id
  name

  cities_zip_codes
   city_id
   zip_code

  states
  id
  country_id
  name

  countries
  id
  name

  I would like to be able to access this data through one object that is
  locked down. There will be no reason for my application to ever add or
  delete from these tables. I was hoping that I could create something
  sort of like a Component is to a controller or a helper is to a view
  for a model. Nothing like this seems to exist, however.

  If I were to use Cake's built in ORM, it would be as follows:

  zip_code has and belongs to many city
  city has and belongs to many zip_code, city belongs to state
  state has many city, state belongs to country
  country has many state

  Using it this way, which model would I then use? How do I keep coders
  from using these models to edit the tables? Isn't this a LOT of
  queries everytime I instantiate one of these models? And scaffolding
  totally blows up (spikes my Apache process to 100% and doesn't let go)
  when I attempt to use this type of ORM.

  I need a way to have an object talk to these tables and provide me
  with the few functions I need (distance between two zip codes, radius
  searching, etc.) without providing full ORM. I also need to be able to
  access this object from within any controller and it needs to use the
  DB connection that Cake sets up.

  What is the best way to accomplish this while staying within the
  constraints and guidelines of the Cake system?

  Any suggestions are GREATLY appreciated!

  Thanks,

  Jason


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



Re: Complex table relationship within one model

2007-09-05 Thread Jason



On Sep 5, 5:17 pm, AD7six [EMAIL PROTECTED] wrote:
 On Sep 4, 5:32 pm, Jason [EMAIL PROTECTED] wrote:
 snip



  I would like to be able to access this data through one object that is
  locked down. There will be no reason for my application to ever add or
  delete from these tables.

 You cannot do anything within Cake to prevent the code 
 $this-Model-query(Update other_table SET x = y) from working, or if 
 someone

 wanted to really cheat from using native PHP db functions.

 Why don't you just remove privileges for the application's database
 user to update or delete from (or truncate) these tables once set up?


It's not so much a security thing as it is a confusion thing. Cake
really should have a read only model structure. Why give the developer
the gun if all he can do is aim it at his head? The argument you're
giving me reminds me of arguments people have given me against public/
private/protected name spaces - some people think they aren't worth
anything. It's not SECURITY, but it does prevent mistakes and it does
implicitly provide clarity on how something should be used.

  I was hoping that I could create something
  sort of like a Component is to a controller or a helper is to a view
  for a model. Nothing like this seems to exist, however.

 Behaviors ;) you could create one with beforeDelete and beforeSave
 returning false. But this is the wrong place for such logic imo.


You're taking the comment ouf of context a bit. I don't want a
component/helper/behavior to create a read only model. That is clearly
the wrong implementation. I want something to act as a single object
that I can call upon to get the information I need out of this
grouping of tables. I want it to be something more specialized than a
general model. I want to be able to instantiate some sort of Geo
object and ask it questions such as what cities are in this zip code
or what is the distance between these two zip codes. I don't want to
have to manage multiple models for one main task - geography. This
normalized table structure does not lend itself too nicely to Cake's
conventions for ORM and really doesn't need all the overhead the ORM
implementation has if I really only need to read from it.

  If I were to use Cake's built in ORM, it would be as follows:

  zip_code has and belongs to many city
  city has and belongs to many zip_code, city belongs to state
  state has many city, state belongs to country
  country has many state

  Using it this way, which model would I then use? How do I keep coders
  from using these models to edit the tables?

 The model methods acts upon it's own table only with a few notable
 exceptions (cascading deletes but most importantly query() can be used
 for anything).


I realize that, but this is confusing. I now have 4 models to choose
from in order to provide the functionality I need instead of one
compact object that does everything Geo-related. Unlike typical Cake
implementations where the complex ORM makes sense, in this case it
makes no sense. The rest of my project fits perfectly within the Cake
conventions, however.

  Isn't this a LOT of
  queries everytime I instantiate one of these models? And scaffolding
  totally blows up (spikes my Apache process to 100% and doesn't let go)
  when I attempt to use this type of ORM.

 Then something isn't set up correctly.


I HOPE I have something setup wrong, but it just doesn't seem to play
well with this setup.

Cake 1.2 (latest build)

1 controller
 ZipCodeController - scaffolding turned on, $uses ZipCode

4 models
 ZipCode (HABTM City)
 City (HABTM ZipCode, BelongsTo State)
 State (HasMany City, BelongsTo Country)
 Country (HasMany State)

That's it. If I navigate to /ZipCode Apache explodes. Any
suggestions?


  I need a way to have an object talk to these tables and provide me
  with the few functions I need (distance between two zip codes, radius
  searching, etc.) without providing full ORM. I also need to be able to
  access this object from within any controller and it needs to use the
  DB connection that Cake sets up.

 That's explained in the manual (var $uses in the model chapter).


$uses is a controller property, not a model property. $useTable is the
model property, and it is a string not an array. It's meant to allow
the use of a table that doesn't follow cake naming conventions, not
for allowing a model to talk to more than one table at once.


  What is the best way to accomplish this while staying within the
  constraints and guidelines of the Cake system?

 By following conventions and putting your you can't touch these
 tables logic in the right place: the database.

 hth,

 AD

Once again, I agree that when it comes down to actual security the
database is the place. But just to reiterate, it's for clarification
from a code cleanliness standpoint - much like properly using private/
public/protected namespaces - that is my intention here. Also, the
intention of having it be compact.

Maybe

Complex table relationship within one model

2007-09-04 Thread Jason

This is my first post to this group, so I'd like to say hello
first. :) This post seems long, but the question is pretty simple -
not sure about the answer.

My question revolves around models. I have 5 tables that represent
geographic information. I want to use this to do radius searches among
other things.

My problem is I'm not sure how to represent this data within Cake. My
tables are setup as follows:

zip_codes
zip_code
latitude
longitude
dst (daylights saving - boolean)
timezone

cities
id
state_id
name

cities_zip_codes
 city_id
 zip_code

states
id
country_id
name

countries
id
name

I would like to be able to access this data through one object that is
locked down. There will be no reason for my application to ever add or
delete from these tables. I was hoping that I could create something
sort of like a Component is to a controller or a helper is to a view
for a model. Nothing like this seems to exist, however.

If I were to use Cake's built in ORM, it would be as follows:

zip_code has and belongs to many city
city has and belongs to many zip_code, city belongs to state
state has many city, state belongs to country
country has many state

Using it this way, which model would I then use? How do I keep coders
from using these models to edit the tables? Isn't this a LOT of
queries everytime I instantiate one of these models? And scaffolding
totally blows up (spikes my Apache process to 100% and doesn't let go)
when I attempt to use this type of ORM.

I need a way to have an object talk to these tables and provide me
with the few functions I need (distance between two zip codes, radius
searching, etc.) without providing full ORM. I also need to be able to
access this object from within any controller and it needs to use the
DB connection that Cake sets up.

What is the best way to accomplish this while staying within the
constraints and guidelines of the Cake system?


Any suggestions are GREATLY appreciated!

Thanks,

Jason


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



Cake not working on secondary domain

2007-08-04 Thread Jason

I have Cake up and running just fine on my primary domain but cannot
get it to work properly on my secondary domain (by this I mean that I
have a second domain hosted on the same account- it is within a
subfolder of my main HTTP folder).  I have godaddy hosting.  When I
install cake on the secondary domain, I have no problem accessing it
via: http://primarydomain.com/secondarydomain/cake/controller .  But,
when I access it via: http://secondarydomain.com/cake/controller it
says No input file specified.  I have modified the .htaccess files
in order to get to this point, which I feel is a step forward because
before I was getting 404 errors.  Even if I disable mod-rewrite
(delete the .htaccess files and uncomment a peice of code in the
core.php file) I still get the same error.  I have a feeling that the
file information cake is getting from the server is incorrect.  Any
help would be greatly appreciated.

Thanks in advance,

Jason


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



Re: need help with linking models

2007-07-26 Thread Jason

On 7月27日, 上午9时06分, rtanz [EMAIL PROTECTED] wrote:
 ok finally got most of it to work, the only problem i still have is
 the task management bit.

 currently i have

 Roles
 var $hasMany = array('Task');
 var $belongsTo = array('Module','User');

 Tasks
 var $belongsTo = array('Role');

 Users
 var $hasMany = array('Role');

 What i need is that when i view the user i will also get displayed
 what tasks he needs to do for each role in each module. Also i need to
 add some information about this such as whether the task is complete
 or not. Such a variable does not currently fit in either roles or
 tasks, so im unsure how to make this association.

Use task as a mediate table. It must include 3 columns: roles_id,
users_id, id.

The table role:

Roles:
var $hasManyAndBelongsTo = array('Task');
var $hasMany = array('User');

Tasks:
var $belongsTo= array('User');

Users:
var $belongsTo= array('Role');

I think the relationship between the 3 Modules is :

Role 1:N User
Role N:N Task

User 1:N Task
User N:1 Role

Task N:1 User
Task N:N Role

Hope it will help you.


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



CakePHP, mod_rewrite and mod_vhost_alias

2007-04-04 Thread Jason

I am running into some issues regarding mod_rewrite, mod_vhost_alias
and cake. I am using the latest stable CakePHP and ran through the
Blog tutorial. Basically, when I setup an explicit VirtualHost, it
works. When I try to have mod_vhost_alias manage the vhost, it does
not work. Here is the explicit vhost config:

VirtualHost *
Directory /Users/jwalker/dev/test
AllowOverride All
/Directory
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /Users/jwalker/dev/test
ServerName test.jwalker.coolbluebeta.com
/VirtualHost

If I remove the above config and enter the following, I get a 500
error:

VirtualDocumentRoot /Users/%2/dev/%1
Directory /Users/*
AllowOverride All
/Directory

Here is the error:

mod_rewrite: maximum number of internal redirects reached. Assuming
configuration error. Use 'RewriteOptions MaxRedirects' to increase the
limit if neccessary.

Can anyone shed some light on this issue?


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



Re: What editor do you use for CakePHP?

2007-02-16 Thread Jason Huebel

Emacs is evil. And it's nowhere close to lightweight or clean.  Let the
flaming begin! :-)

Leonardo Varuzza wrote:
 Emacs, the one true editor ;-)
 
 On Feb 13, 2:08 pm, Jason Huebel [EMAIL PROTECTED] wrote:
 For those poor souls who can't use TextMate because you're on Windows,
 you might want to take a look at InType (http://intype.info/). It's
 still in alpha (and will eventually be commercial software), but it
 includes a CakePHP bundle. Bundles are plugins that include code
 snippets and keyboard shortcuts for a particular language.

 It's a very lightweight and extremely clean (almost to a fault)
 interface. Hope you like it.

 Jason Huebel

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



Re: What editor do you use for CakePHP?

2007-02-16 Thread Jason Huebel

I do programming for a living and there's another programmer in my shop
who uses PSPad almost exclusively. He really likes it.  I have to say I
like the simplicity of it. I'm mainly interested in an editor that
provides syntax highlighting and the gets out of my way. PSPad does fit
the bill in that regard.

theman wrote:
 I have gone through tons of editors trying to find the best balance of
 features and I've found PSPad to be a great little text editor that
 supports PHP (as well as many other languages), Direct FTP transfer,
 and a bit of project managment.  It's all I use now!
 
 
  
 

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



Re: What editor do you use for CakePHP?

2007-02-13 Thread Jason Huebel

For those poor souls who can't use TextMate because you're on Windows,
you might want to take a look at InType (http://intype.info/). It's
still in alpha (and will eventually be commercial software), but it
includes a CakePHP bundle. Bundles are plugins that include code
snippets and keyboard shortcuts for a particular language.

It's a very lightweight and extremely clean (almost to a fault)
interface. Hope you like it.

Jason Huebel

[EMAIL PROTECTED] wrote:
 G'day all,
 
 Matt from Australia here.  In the past I've done all my PHP coding
 using a text editor such as Wordpad, and then a few years back I've
 begun using Dreamweaver.
 
 Currently I'm using Dreamweaver 8 and I've found it to be quite good
 when dealing with .php files.  It's not great when editing .thtml
 files though, since it doesn't recognize them as code, and so doesn't
 give you all the nice code colouring and auto-closing of tags, etc...
 At least the automated uploading/downloading is nice.
 
 What do you use for Cake cooking?
 
 
  
 

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



Re: What editor do you use for CakePHP?

2007-02-13 Thread Jason Huebel

As a followup, be sure you also get InTypePM, which is a project manager
wrapper around InType. InTypePM is a user-contributed app written in
Delphi. You can find it in this thread:

http://intype.info/forums/discussion/256/1/intype-project-manager-alpha/

The latest version is 1.0.0.35, which can be found on the second page of
the thread.

Jason Huebel wrote:
 For those poor souls who can't use TextMate because you're on Windows,
 you might want to take a look at InType (http://intype.info/). It's
 still in alpha (and will eventually be commercial software), but it
 includes a CakePHP bundle. Bundles are plugins that include code
 snippets and keyboard shortcuts for a particular language.
 
 It's a very lightweight and extremely clean (almost to a fault)
 interface. Hope you like it.
 
 Jason Huebel
 
 [EMAIL PROTECTED] wrote:
 G'day all,

 Matt from Australia here.  In the past I've done all my PHP coding
 using a text editor such as Wordpad, and then a few years back I've
 begun using Dreamweaver.

 Currently I'm using Dreamweaver 8 and I've found it to be quite good
 when dealing with .php files.  It's not great when editing .thtml
 files though, since it doesn't recognize them as code, and so doesn't
 give you all the nice code colouring and auto-closing of tags, etc...
 At least the automated uploading/downloading is nice.

 What do you use for Cake cooking?


 
  
 

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



Re: Finally a good Editor for Windows

2007-01-24 Thread Jason Huebel

All I can say is, WOW. I've been using TextMate on my Mac Mini and 
Ultraedit on my Windows box. I think I just found the replacement for 
Ultraedit. Great find!

Jason

Mandy wrote:
 Well, this post is not about asking a question, but about sharing an
 editor that I recently found.

 You can read more about it here:
 http://mandysingh.blogspot.com/2007/01/finally-good-editor-for-windows-intype.html

 This is going to be having CakePHP support very soon and is really
 kickass (trust me - it's TextMate for windows).
   

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



RE: webroot issue (i think)

2007-01-19 Thread Jason Huebel


There are my unmodified .htaccess files:

path_to_app/.htaccess:

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


path_to_app/app/.htaccess

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


path_to_app/app/webroot/.htaccess

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


Jason Huebel

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of internettitan
Sent: Friday, January 19, 2007 4:11 PM
To: Cake PHP
Subject: Re: webroot issue (i think)


what should the 3 files look like?

how do i avoid the 500 error?

On Jan 19, 9:51 am, milliseconds [EMAIL PROTECTED] wrote:

This one had me going for about three hours last night. It turns out
there are three .htaccess files in the Cake file structure which need
to exist. Some operating systems hide them and are not copied to the
server.

Make sure there is a .htaccess file in the following locations:

First:
../path_to_cake_install/.htaccess

Second:
../path_to_cake_install/app/.htaccess

Third
../path_to_cake_install/app/webroot/.htaccess

Once I finally got the .htacccess files installed in the proper places
it worked fine.

Good Luck

Mac

On Jan 18, 3:56 pm, internettitan [EMAIL PROTECTED] wrote:

 Hey all,

 I am trying to migrate an existing cake php site to a new hosting
 provider and am running into a problem (probably due to my own
 inexperience).

 I took a zip of the site sent to me by the original developer and
 plopped it into the html directory of the new host (where html is the
 webroot).

 I setup and populated a mySQL database and changed the files to
 correctly point to this database.

 The homepage comes up fineBUT none of the links work!

 3 other symptoms that may be associated:

 1) at first the site gave an error 500 which according to the hosting
 support team was due to the contents of the htaccess file...

 Thank you for contacting technical support regarding your issue. We
 apologize for the inconvenience. An .htacess file in your FTP root
 directory contained some mod_rewrite rules that were causing a redirect
 loop:

 [Tue Jan 16 16:56:44 2007] [error] [client 66.223.59.30] mod_rewrite:
 maximum number of internal redirects reached. Assuming configuration
 error. Use 'RewriteOptionsMaxRedirects' to increase the limit if
 neccessary.
 [Tue Jan 16 16:56:44 2007] [error] [client 66.223.59.30] Request
 exceeded the limit of 10 internal redirects due to probable
 configuration error. Use 'LimitInternalRecursion' to increase the limit
 if necessary. Use 'LogLevel debug' to get a backtrace.

 I have renamed the .htaccess file to .htaccess.old and your site and
 admin page are accessible now.

 Please note that the document root directory of your web site is the
 /html directory under your FTP account. At this time, it appears your
 web files have been uploaded to your FTP root directory instead, where
 they will not be accessible via a browser. Please re-upload your web
 contents to the /html directory under your FTP site. This may be why
 your mod_rewrite rules are not functioning properly, but as we cannot
 provide technical support for custom code like mod_rewrite rules, we
 recommend having your web developer or programmer check them before
 re-enabling your .htaccess file.

 2) After the .htaccess was removed the home page still had problems in
 that it could not access the images referenced on the page. I moved the
 rest of the app/webroot files to the html directory and viola!

 3) I am even a little stumped as to how the site is working at all. I
 have made several changes to the thtml files and cannot see any update
 to the page at all

 Thanks for any help you can give!





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



Re: Download Sexy Movies

2006-08-26 Thread Jason Lee

On 8/26/06, John Zimmerman [gmail] [EMAIL PROTECTED] wrote:
 Someone should write a screenplay based on spam and phishing letters.  Sex,
 drugs, money, deception, travel, exotic locations, hardship, and your
 possible dream job.

This isn't video, but usually pretty funny:

http://spamusement.com/

A word of warning, though.  Given the nature of some spam, some the
comics are more than just a bit off color...

-- 
jason lee

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



Re: $this-flash() Problem

2006-08-26 Thread Jason Lee

OK.  Mystery solved.  The root cause was a hole in my understanding of
the API, and a stupid typo.  In AppController, I overrode render() to
set some variables in the view for each request.  After digging
through the API source, I was reminded of beforeRender() which does
what I was trying to do in overriding render().  Once I changed the
method to that, things started working again.  At that point, I
realized that in my render() method, when I called the method on the
parent class, I failed to pass along the three parameters.

So.   User error.  Thanks to all that helped. :)

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Re: $this-flash() Problem

2006-08-26 Thread Jason Lee

On 8/26/06, Samuel DeVore [EMAIL PROTECTED] wrote:

 Which brings to mind one of my favorite acronyms
 PEBKAC

 http://en.wikipedia.org/wiki/PEBKAC

 ;)  glad you found your problem

Exactly.  Or the ID-10-T error.  ;) I feel pretty dumb now, but I
finally got it solved, so I can move on. :)

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: $this-flash() Problem

2006-08-25 Thread Jason Lee

On 8/25/06, AD7six [EMAIL PROTECTED] wrote:
 Are you sure that line of code is being executed ;), try putting die
 before the flash statement, if you still get your view rendered, the
 bit of code with the flash in it isn´t being called.

The odd thing is that I put something like die('hello'), iirc, before
and after the flash line, and I got my view rendered with the word
'hello' in the middle of it:

public function test() {
//die('before');
$this-flash('This is only a test!', '/users/showAll');
die('after');
}

Gets me:

after
0 query took ms Nr  Query   Error   AffectedNum. rows   Took 
(ms)

If I uncomment the before line I get

before
1 query took 1910 ms Nr Query   Error   AffectedNum. rows   Took 
(ms)
1   DESC `users`8   8   1910

I tried rolling back to 1.1.6 and got the same result.

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: $this-flash() Problem

2006-08-25 Thread Jason Lee

On 8/25/06, AD7six [EMAIL PROTECTED] wrote:
 Have you created your own views/layout/flash.thtml?

I did, but, just for testing, I've removed it with no effect.  The
file, though, was basically the same as default.thtml, but with the
requisite php changes to display the flash message and the link.

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: $this-flash() Problem

2006-08-24 Thread Jason Lee

On 8/24/06, Mikee Freedom [EMAIL PROTECTED] wrote:
 if you're using anything above debug = 1 in the core config then the
 flash doesn't automatically redirect. caught me out for a while as
 well.

Right, but it's not even displaying the message.  Say, for example,
I'm on /users/add.  I fill out the form, click submit.  In theory, it
should say something like The user has been added. then either
automatically or manually, redirect me to /users/index if I have

$this-flash('The user has been added.', '/users/index');

Instead, it's rerendering /users/add.  Does that make sense?

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Re: $this-flash() Problem

2006-08-24 Thread Jason Lee

On 8/24/06, Samuel DeVore [EMAIL PROTECTED] wrote:

 Can you post the code in your controller?

Here's the relevant snippet:

http://cakephp.org/pastes/show/2ec3cd97a310e0ff524105a02a3339f2

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Running HTML files through index.php

2006-07-29 Thread Jason Lee

On 7/28/06, nate [EMAIL PROTECTED] wrote:
 You could always allow people to upload files to webroot (say
 'page.html'), then access them as '/page', so when the request gets
 send to Cake, just have it read the file out of webroot.  Otherwise,
 upload to some external directory, and apply some additional routing or
 controller logic when reading files.  Just be careful you don't open a
 hole that allows people to indiscriminately access any file via the URL.

Let's say I use the routes approach.  What would that route look like.
 I have this:

$Route-connect('*.html', array('controller' = 'pages', 'action' =
'view', 'firstparam'));

PagesController::view() reads the contents of the file from
webroot/files and sets that value in the view.  I'm not sure the
syntax for the route if correct though for two reasons.  I'm not sure
the URI mask is what it needs, and 'firstparam' is supposed to be the
name of the file, but that syntax seems odd.  It's literally the only
thing I've managed to find that seems to address what I'm trying to
do, so I gave it whirl.  The bottom line is, though, for whatever
reason, that's not working.  I get the message:

The requested address index.html was not found on this server.

when I hit http://foo.com/index.html.  Any pointers?

Thanks!
-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Running HTML files through index.php

2006-07-28 Thread Jason Lee

On 7/28/06, AD7six [EMAIL PROTECTED] wrote:
 Not entirely sure what you mean but why not put your html files in a
 folder under pages, and follow a similar approach to this:

I'm hoping to allow a user of mine to put a HTML file in webroot/.
When the file is requested, i want my cake app's controller to wrap it
in my layout and spit it out to the browser.  This will allow the
users to create just the content portion and let me (as the app
admin) to control the final appearance.  Sort of a poor man's CMS.
Does that make sense?

 Re excluding stats,
 one solution is to just create a .htaccess file in that folder to turn
 off mod rewrite, this should be pretty close:

Well, stats/ is, for lack of a better word, a virtual URI provided
by by provider.  The static didn't work, but this did:

RewriteCond %{REQUEST_URI} !^/stats*

But only under Apache 2.  Apache 1.3 doesn't like that, so I'll just
have to wait for all my hosts to be updated...

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Running HTML files through index.php

2006-07-27 Thread Jason Lee

Slightly OT, but I'd like to be able to run .html files in webroot/
through the cake lifecycle, but the current .htaccess will let
existing files be handled directly via the server.  Unfortunately, I'm
pretty horrible with .htaccess, so I can't figure out how to tell it
to alter the exisiting file exception if the request URI ends in
.html.  Are there any mod_rewrite gurus that can give me some
pointers?  I'd also like to exlude /stats* and am having mixed results
on that.

Thanks a lot!

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Hosting (i.e. Dreamhost)

2006-07-18 Thread Jason Lee

On 7/18/06, John Zimmerman [gmail] [EMAIL PROTECTED] wrote:
 Is anyone else here using Dreamhost to host CakePHP projects?

I currently host three applications on Dreamhost and will probably add
at least 2 or 3 more by the end of the year if development goes as
planned.  Recent hardware debacle notwithstanding, I've been pretty
happy with them.  You can play with the public portion of one of the
apps (I have the same app on two (sub)domains, and a third app on my
family website, which I don't advertise too much publically for
obvious reasons ;) at

http://early.qsbc-ym.org

I'll grant that it's no eBay, but performance has been good enough for
me.  For what that's worth... ;)

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com

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



hasMany/finderQuery/fields not working?

2006-07-10 Thread Jason Botwick
I'm having some trouble with hasMany relationships. I pretty much baked this whole application so far, I'm using a release I downloaded yesterday. When I view a User in this model, it gives me a list of all the associated rows in the paths_privileges_users table, which is great . . . but I don't want to look at a bunch of IDs and foreign keys, I want to retrieve some values from the paths table. I thought the simple way to do that would be to define a custom finderQuery/finderSql (by the way, what's the difference between these two?), and then a custom 'fields' value in the model, so that the scaffolding generated by the 
bake.php program would spit out the fields I want. The interesting part is that both 'finderQuery' and 'fields' work as I expected--but only when I only specify one or the other. If I specify BOTH 'finderQuery' (or 'finderSql') and 'fields', NEITHER works. Is that expected? If so, is there a rationale for that?
Here's my database model:CREATE TABLE `users` ( `id` smallint(5) unsigned NOT NULL auto_increment, `login` varchar(128) NOT NULL default '', `name` varchar(128) NOT NULL default '', `created` datetime default NULL,
 `modified` datetime default NULL, PRIMARY KEY (`id`)) ;CREATE TABLE `paths_privileges_users` ( `id` smallint(6) NOT NULL auto_increment, `user_id` smallint(6) NOT NULL, `path_id` smallint(6) NOT NULL,
 `privilege` enum('','r','w','rw') NOT NULL default 'r', `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`)) ;CREATE TABLE `paths` ( `id` smallint(6) NOT NULL auto_increment,
 `repository_id` smallint(6) NOT NULL default '0', `name` text NOT NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`)) ;And here are the relevant models:
class User extends AppModel{ var $name = 'User'; var $hasMany = array( 'PathsPrivilegesUser' = array('className' = 'PathsPrivilegesUser',
 BEGIN ATTEMPTED CUSTOMIZATION  'finderQuery' = 'SELECT `PathsPrivilegesUser`.`id`, `PathsPrivilegesUser`.`path_id`, `paths`.`name`, `PathsPrivilegesUser`.`privilege`, `PathsPrivilegesUser`.`created`, `PathsPrivilegesUser`.`modified` FROM `paths_privileges_users` AS `PathsPrivilegesUser` INNER JOIN `paths` ON `PathsPrivilegesUser`.`path_id` = `paths`.`id` INNER JOIN `repositories` ON `paths`.`repository_id` = `repositories`.`id` WHERE `PathsPrivilegesUser`.`user_id` = {$__cakeID__$}',
   'fields' = '`paths`.`name`', END . . . THIS IS WHAT DOESN'T WORK 'counterSql' = ''),
 );}class PathsPrivilegesUser extends AppModel{ var $name = 'PathsPrivilegesUser'; var $belongsTo = array( 'User' = array('className' = 'User',
 'conditions' = '', 'order' = '', 'foreignKey' = '', 'counterCache' = ''),
 'Path' = array('className' = 'Path', 'conditions' = '', 'order' = '',
 'foreignKey' = '', 'counterCache' = ''), );}class Path extends AppModel{ var $name = 'Path';
 var $validate = array( 'id' = VALID_NOT_EMPTY, 'repository_id' = VALID_NOT_EMPTY, 'name' = VALID_NOT_EMPTY, ); //The Associations below have been created with all possible keys, those that are not needed can be removed
 var $belongsTo = array( 'Repository' = array('className' = 'Repository', 'conditions' = '', 'order' = '',
 'foreignKey' = '', 'counterCache' = ''), ); var $hasMany = array( 'GroupsPathsPrivilege' =
 array('className' = 'GroupsPathsPrivilege', 'conditions' = '', 'order' = '', 'foreignKey' = '',
 'dependent' = true, 'exclusive' = '', 'finderSql' = '', 'counterSql' = ''),
 'PathsPrivilegesUser' = array('className' = 'PathsPrivilegesUser', 'conditions' = '', 'order' = '',
 'foreignKey' = '', 'dependent' = true, 'exclusive' = '', 'finderSql' = '',
 'counterSql' = ''), );}Incidentally, here is the SQL that gets generated by default in the place where I'm trying to stick a finderSql:
SELECT `PathsPrivilegesUser`.`id`, `PathsPrivilegesUser`.`user_id`,
`PathsPrivilegesUser`.`path_id`, `PathsPrivilegesUser`.`privilege`,
`PathsPrivilegesUser`.`created`, `PathsPrivilegesUser`.`modified` FROM
`paths_privileges_users` AS `PathsPrivilegesUser` WHERE
`PathsPrivilegesUser`.`user_id` = '1'As you can see, it only pulls from the paths_privileges_users table, which contains just a bunch of IDs, and why I'm trying to join it to table with some meaningful data.
I suspect my models are right (or at least good enough), because the data that gets dumped in debug mode says that the data I'd like to display is available in the data array that gets returned. If I'm wrong in that assumption, let me know.
Any ideas what I'm missing? Is there a workaround for this problem?Thanks,Jason

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


Re: Google Maps + CakePHP Recipe

2006-05-26 Thread Jason Lee

On 5/25/06, tom [EMAIL PROTECTED] wrote:
 Quite a few of the things I expected to be very difficult with CakePHP
 have actually been a breeze. Well, not a breeze, but doable. Anyway,
 no fanfare. Here's how to integrate mapping with your application.

gwoo and I have a solution for Google Maps as well (gwoo did most of
the work.  I just upgraded things to use v2 of the Google Maps API and
wrote the Yahoo! Geocoder component).   Here are some links:

gecoder comp:  
https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/CakeMap/controllers/components/yahoo_geocoder.php?rev=112root=rdosview=markup

map helper: 
https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/CakeMap/views/helpers/google.php?rev=112root=rdosview=markup

layout (look for the JS here):
https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/CakeMap/views/layouts/default.thtml?rev=112root=rdosview=markup

usage: 
https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/CakeMap/views/maps/index.thtml?rev=112root=rdosview=markup

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Google Web Toolkit - Easy AJAX for CakePHP?

2006-05-17 Thread Jason Lee

On 5/17/06, sudonim [EMAIL PROTECTED] wrote:
 Im a newcomer to cake and spend way more time than I should reading /.
 and digg. There is an article today on slashdot that links to a new
 google framework for ajax - http://code.google.com/webtoolkit . How
 does something like this fit in to CakePHP? Is this a great way to
 handle building AJAX into a cakephp app? or does this compete with
 CakePHP on some level? Thanks!

Unless I've missed something, GWT is Java-only, and has license
restrictions that would prevent porting it to PHP.  There are several
AJAX toolkits, such as dojo, that several have used with great success
with CakePHP, though.

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: Helpers not available in my layout

2006-05-12 Thread Jason Lee

On 5/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Anytime I have this problem I either have tables missing in the
 database or the database file is misconfigured (typo).  You can do an
 if(isset($browser)) before calling the helper.  If you do that then you
 should see the error that CakePHP is trying to give you.  It just can't
 because there is code in there that relies on CakePHP and it has
 already bombed out.

Ah!  That was it!  If you're ever in Oklahoma City, I'll buy you a Slurpee :P

-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Helpers not available in my layout

2006-05-11 Thread Jason Lee

I'm a bit confused as to why my helpers are no longer available to my
layout.  I've asked a couple times on the IRC channel, but I've not
been able to stay around long enough to work through the issue, so
here I am. :)

Here's part of my app/app_controller.php:

  1 ?php
  2 uses('sanitize');
  3 class AppController extends Controller {
  4 var $beforeFilter = array('checkAccess');
  5 var $components = array('sscpAuth','Output', 'SystemNotice');
  6 var $uses = array ('Member', 'Portal');
  7 var $helpers = array('Html', 'Sscp', 'Time',
'Javascript', 'Browser');
  8 // snip!
  9 }

and here's top of my layout:

  1 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
  2 html
  3 head
  4 title?php echo $title_for_layout?/title
  5 !-- base href=?php echo $html-base ? / --
  6 link rel=stylesheet type=text/css href=?php echo
$html-url('/style/'); ? /
  7 link rel=stylesheet href=?php echo
$html-url('/pngHack/pngHack.css'); ? type=text/css
  8 ?php
  9 if ($browser-browser_is_ie()) echo $html-css('iehack');

which gets me this error:

Notice: Undefined variable: browser in
/tmp/sscp2/views/layouts/default.thtml on line 9

Fatal error: Call to a member function browser_is_ie() on a non-object
in /tmp/sscp2/views/layouts/default.thtml on line 9

though the page title says Missing Database Table which has to be a bug.

Does anyone see why that would be failing? I'm REALLY stumped.  It
works fine on 0.10. :|

Thanks!



-- 
jason lee
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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



Re: pretty URL's problem

2006-05-02 Thread Jason Lee

On 5/2/06, ivan [EMAIL PROTECTED] wrote:
 I'm working locally, running Apache 2.x.x.x. The httpd.conf file reads
 All for AllowOverride but, since the mod_rewrite module is commented,
 I'm using the .httaccess files

Is .httaccess (note the two t's) a typo?  Just making sure... :)

 In my core.php file I have uncommented the line 42,
 define ('BASE_URL', env('SCRIPT_NAME'));

I think that needs to be commented out.

--
jason
http://www.steeplesoft.com
http://blogs.steeplesoft.com
http://littlezoper.livejournal.com

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