Re: What's wrong with this model?

2008-07-20 Thread Grant Cox
Is apache dying? Sounds like a Zend Optimizer issue - if you have the Zend Optimizer installed try disabling it. https://trac.cakephp.org/ticket/2059 On Jul 20, 11:54 am, Ryan [EMAIL PROTECTED] wrote: As soon as I add this, it craps everything else out that I've done - i.e white screens

Re: Filemaker and CakePHP

2008-07-16 Thread Grant Cox
A few years ago I had to work with Cake and Filemaker - but thankfully I convinced them that the website could use it's own database, and their internal Filemaker database would just synchronise from this live site with a Filemaker script (one way synch only). There was just a cake action that

Re: The First CakePHP Book is out!

2008-07-16 Thread Grant Cox
I'd also be very interested in knowing which revision it is current to - for example the change in r7075 about condition operators moving from the value to the key, is quite an important one. I guess that's the difficulty with writing any book for a non-stable release - the API can change...

Re: Test Suite: parsing a CSV file, where to store file?

2008-07-14 Thread Grant Cox
I do the same, and keep the file in fixtures. Makes sense to me :) On Jul 15, 8:33 am, aranworld [EMAIL PROTECTED] wrote: I need to create a test case for the parsing of a tab delimited file. Would it make sense to put the test version of this CSV file in the fixtures directory of my test

Re: Model

2008-07-08 Thread Grant Cox
$db = ConnectionManager::getDataSource('default'); $result = $db-query('SELECT * FROM ...'); On Jul 9, 8:38 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi. Is there anyway to call query() from a controller that has no model? --~--~-~--~~~---~--~~ You

Re: Using mysql now() on save() in 1.2 RC2

2008-07-07 Thread Grant Cox
You cannot use array syntax for these any more, you have to use string syntax (where escaping falls to you, rather than Cake). $conditions = array( 'FooModel.foo_important_type = NOW()' ); On Jul 8, 7:50 am, vb13 [EMAIL PROTECTED] wrote: HI all, there is already a

Re: Escaping quotes in SQL

2008-07-07 Thread Grant Cox
What is your save query, and what is the SQL generated? When saving using the standard Model-save() syntax, the data provided is assumed to be unquoted - and will automatically be made safe for SQL. $this-Model-save( array('Model'=array( 'field1' = 'value',

Re: display var from view in layout

2008-07-06 Thread Grant Cox
For anyone else wondering, just have a $this-set('layout_var', 'content') in your view, then in the layout file you can use $layout_var . On Jul 6, 6:15 am, bmgz [EMAIL PROTECTED] wrote: I managed to figure this out, however it wasnt as elegant or simple as it could be..

Re: Validation

2008-07-02 Thread Grant Cox
Make sure you are using Cake 1.2 var $validate = array( 'categoryName' = array( 'too_short' = array('rule' = array('minLength', 1), 'message'='Category Name cannot be empty'), 'unique' = array('rule' = array('isUnique'), 'message'='That Category Name is

Re: BelongsTo at DatabaseTable

2008-07-02 Thread Grant Cox
No, just make a model file. Seriously, what's the problem with having: ?php class Engine extends AppModel { var $name = 'Engine'; } ? On Jul 2, 5:00 pm, Ben [EMAIL PROTECTED] wrote: Hello World, i just tried to search, but can't find what i'm looking for. I want to bind a table

Re: Newbie Question: conditions on a find('all') for hasMany?

2008-06-30 Thread Grant Cox
The documentation you are referring to is misleading - a join is only used across a belongsTo association (and hasOne), never for hasMany. Basically, you can't have query conditions across a hasMany association. You will have to either query the other way (as you saw, the Course belongsTo Term,

Re: Good coding

2008-06-25 Thread Grant Cox
Don't forget you can also use $javascript = END ...all your js here... END; On Jun 25, 4:43 pm, Daniel Hofstetter [EMAIL PROTECTED] wrote: Hi Federico, Hi all, I'm working in a helper that has to output lot of JS code. The thing is that I really dislike coding JS as string (ie

Re: Cake, my though about the missing bit

2008-06-23 Thread Grant Cox
It requires more work for you to code, because it's a more complex query situation, and Cake doesn't currently have the functionality to hide this complexity. As you mentioned, I'm sure the Cake devs are aware of this. But can post an enhancement ticket on trac if you like. On Jun 23, 7:55

Re: cake perfomance

2008-06-22 Thread Grant Cox
See ticket 4855, it sounds quite similar https://trac.cakephp.org/ticket/4855 And update to the newest SVN (a revision number isn't mentioned in the fix for that ticket) to see if the issue persists On Jun 23, 6:23 am, francky06l [EMAIL PROTECTED] wrote: Depends the conditions and your

Re: 2 Applications shared/seperate databases.

2008-06-19 Thread Grant Cox
You could just have a second database connection - to the same database but with a different prefix. Then in the models for the beta site application set the appropriate var $useDbConfig to point to the beta tables. On Jun 20, 2:54 am, Siebren Bakker [EMAIL PROTECTED] wrote: I have a website

Re: Overriding Table Prefix

2008-06-17 Thread Grant Cox
You could always have a second database connection for the legacy application - without a prefix set. I would have expected that your legacy app would be in a different database than this new one, anyway? Not sure about the password hashing, I haven't used the inbuilt Cake authentication. On

Re: Installing CakePHP - Missing PrivatController

2008-06-13 Thread Grant Cox
Because you don't have mod_rewrite (apache module) set up properly on your second computer. The first issue is that something is requesting http://yourapp.localhost/privat , which Cake assumes to be the index action of the privat controller. I'm not sure what this is - it's something in your

Re: Number helper bug

2008-06-11 Thread Grant Cox
Create an account at https://trac.cakephp.org/register Then read https://trac.cakephp.org/wiki/bugreport and you will be able to add a ticket :) On Jun 12, 6:23 am, Eriky [EMAIL PROTECTED] wrote: I can't find a way to report a bug on the site (maybe I'm stupid) so I'm posting it here.

Re: RC1 Condition Syntax Changes

2008-06-10 Thread Grant Cox
You have to use string based conditions for that - not the array key = value. $where['AND'][] = 'DATE(Table.datefield) = CURDATE()'; On Jun 10, 3:54 pm, Mr-Yellow [EMAIL PROTECTED] wrote: Still puts quotes around CURDATE. $where['AND']['DATE(Table.datefield)'] = '= -!CURDATE()';

Re: Entry data with a . dot sign

2008-06-10 Thread Grant Cox
There is no such limit in Cake by default, it'll be in your application code. Are you sure that the model is passing validation? If you have the alphaNumeric validation rule, it'll fail on a period, as it explicitly only allows alphabetic and numeric chars. What is the SQL being generated?

Re: Build #s for CakePHP Applications

2008-06-09 Thread Grant Cox
I have the major and minor numbers hardcoded in my application configuration file, and the actual revision appended using AD7Six's snippet http://bakery.cakephp.org/articles/view/using-your-application-svn-revision-number On Jun 9, 5:22 am, Ken [EMAIL PROTECTED] wrote: Like a good developer I

Re: Tools for merging directories

2008-06-05 Thread Grant Cox
? Doesn't seem a whole lot better than going through your working copy with a decent File/Folder Merger utility. I might give it a shot once next time, not sure if I'll stick with it though. And unfortunately WinMerge won't work for me, I'm on a Mac. :o) On 5 Jun 2008, at 12:46, Grant Cox

Re: Misconfigured CSS Directory

2008-06-05 Thread Grant Cox
/css/cake.generic.css is correct - you should never see the webroot in the url If mod_rewrite is enabled, are you sure you haven't removed any .htaccess files? If mod rewrite is disabled, are you sure you haven't removed any index.php files? if you have /var/www/html/cake/app/webroot then

Re: Tools for merging directories

2008-06-05 Thread Grant Cox
I was about to reply with something glib - since all you want to do is list all files in the folder (recursively), select them and delete (trivial with Windows Explorer). However I had a chat with one of our Mac guys here, and we couldn't figure it out in Finder / Spotlight. How do you list all

Re: Tools for merging directories

2008-06-04 Thread Grant Cox
I use Subversion vendor branching ( http://bakery.cakephp.org/articles/view/vendor-branching ) to maintain all third party code, as you really need something that can compare three targets. But if you do want to do it manually, WinMerge works well for me on Windows, using the CVS/SVN Loose

Re: PHP Benchmark

2008-06-03 Thread Grant Cox
I agree, these artificial benchmarks are useless. The modify loop benchmark showing foreach being 80x slower than while surprised me, so I gave it a quick test here. I found quite the opposite, with foreach($data as $key = $val) $data[$key] .= 'a'; being 5x faster than the while loop. But

Re: Recursive option not working?

2008-06-03 Thread Grant Cox
HABTM are never done with a JOIN, so you can't use conditions across the query. You can only do this with belongsTo, so in your example you would be able to use Service fields in the conditions, but not Event, Group or User. The options that I see you have. 1. Create models for the join

Re: Performance question

2008-05-27 Thread Grant Cox
Well, you haven't given us any indication of what is taking 9 seconds - is it a SQL query, and if so what is it? Anyway, some suggestions: 1. Unbind any of those associations that you don't need for any particular query. While belongsTo associations are done with a JOIN (comparatively fast),

Re: Strange query being generated by CakePHP

2008-05-14 Thread Grant Cox
What database are you using? MySQL, or something else? What database connection options are you using - perhaps post the $design configuration from your /app/config/database.php (remove your username/ password of course :P) Also, what version of Cake? On May 15, 6:21 am, TracyB [EMAIL

Re: cook up web sites fast

2008-05-13 Thread Grant Cox
When your site is published it won't be shared with these other packages will it? Your development platform should replicate the server as close as possible, which is why a virtualhost is usually a very good idea. But I've got Cake installations just in a folder in my webroot with no problem.

Re: This is more of a general application design question than a CakePHP question...

2008-05-12 Thread Grant Cox
Making the remote service API requests for every one of your page requests is a bad idea - you have to use some kind of caching (save locally). Otherwise your page load times could be completely unstable (what if there is a 5 second delay between your server and one of the services?), plus you

Re: Query Question

2008-05-12 Thread Grant Cox
City belongsTo State Assuming Cake 1.2: $cities = $this-City-find('list', array('fields'=array('City.id', City.name', 'State.name'), 'recursive'=1) ); Then you can have a form select with cities as the data source, you should get exactly what you want. On May 12, 9:00 am, Kyle Decot [EMAIL

Re: find('all') combine problem

2008-05-08 Thread Grant Cox
$teams = $this-Team-find('all', array('fields' = array('Team.id','Team.firstName','Team.lastName'))); $team_list = Set::combine($teams, '{n}.Team.id', array('%s %s', '{n}.Team.firstName', '{n}.Team.lastName')); On May 8, 3:48 pm, jwerd [EMAIL PROTECTED] wrote: I always follow the CakePHP

Re: Getting Cake build version?

2008-05-08 Thread Grant Cox
Use vendor branching - then every revision of your app has the appropriate Cake core, and you can easily handle updates / deletes to Cake core files, even those in the app folder. Felix has a good screencast for using vendor branching.

Re: Bug: Saving HABTM relationship, Column in where clause is ambiguous

2008-05-07 Thread Grant Cox
Can you post your $hasAndBelongsToMany variable definition? I think you'll be able to fix your issue by just using the model alias prefixes in the 'foreignKey' and/or 'associationForeignKey' values. On May 7, 2:25 pm, David Christopher Zentgraf [EMAIL PROTECTED] wrote: Hi, I'm stumbling

Re: Warning: imagejpeg(): Unable to open

2008-05-06 Thread Grant Cox
I agree it is probably permissions (or case sensitivity). However, why are you using imagejpeg() to write a .gif file ? On May 7, 8:52 am, francky06l [EMAIL PROTECTED] wrote: Story of writing permissions on folder maybe ? --~--~-~--~~~---~--~~ You received

Re: Unique ID that could be referencing more than one model

2008-05-01 Thread Grant Cox
That's the way I do it, and have had no problems. It is quite trivial to set up conditions on your associations, so that the associated rows are loaded automatically. On May 2, 9:52 am, validkeys [EMAIL PROTECTED] wrote: Quick question.. I have a conversation going on between users and

Re: Combine and compress js / css..

2008-04-23 Thread Grant Cox
Check out the following links: http://bakery.cakephp.org/articles/view/jsmin-helper-compress-and-cache-javascript http://bakery.cakephp.org/articles/view/automatic-javascript-and-css-packer https://trac.cakephp.org/ticket/2233 http://blog.bradleyboy.com/2007/07/28/assetpackager-for-cakephp/

Re: belongsTo relationship killing my app

2008-04-22 Thread Grant Cox
You're not using the Zend Optimizer are you? Sounds kind of like my issue ( https://trac.cakephp.org/ticket/2059 ), removing the Zend Optimizer PHP extension fixed it. On Apr 22, 4:18 pm, Langdon Stevenson [EMAIL PROTECTED] wrote: I have a very strange problem appeared with a site that I have

Re: Four sites using same database, but only their own records

2008-04-22 Thread Grant Cox
http://bin.cakephp.org/view/1178242700 This is the behaviour I use for this purpose. Basically it looks at every query, and if you haven't already set any conditions that look at the owner id (or artist_id in your case), then it automatically appends a condition to only retrieve those owned by

Re: Session ID

2008-04-22 Thread Grant Cox
Can you explain why you want to do this? For what circumstance do they need a persistent unique value? The only thing I can think of is to store data on a persistent medium - ie database or file. And in both of these cases you can easily generate a unique one (file / row), and just store the

Re: Function in view ....

2008-04-20 Thread Grant Cox
I'd be more inclined to use the existing TimeHelper timeAgoInWords() function. On Apr 21, 6:51 am, jonknee [EMAIL PROTECTED] wrote: So - where should I put the function and how can I call it? Any ideas? Unless I'm missing something, that would ideally be a helper. You could call it like

Re: CakeAMF on a shared host?

2008-04-15 Thread Grant Cox
I ran into the same issue today - I forgot that a little project for a friend will need to be hosted on cheap shared hosting. I have reworked the CakeAMF plugin to use SabreAMF instead, and it seems to be working fine for this small app. Email me if you would like a copy. On Apr 15, 4:21 am,

Re: What part of Cake handles the records-to-array?

2008-04-13 Thread Grant Cox
/cake/libs/model/datasources/dbo/* so for mysql, you want to look in /cake/libs/model/datasources/dbo/dbo_mysql.php specifically at the resultSet and fetchResult functions (where it converts the result to an array). These functions are called by fetchRow function in

Re: Calling Controllers With Variables From The Command Line

2008-04-09 Thread Grant Cox
No, stick with the dispatcher. You can easily pass data just as a second parameter: $result = $Dispatcher-dispatch($url, array('cli'=true, 'source'= $mime_source)); then in your controller action you can just access $this-params['source'] to get the data passed. Let me guess, you're writing

Re: Model find() to return object; instead of array (?)

2008-04-03 Thread Grant Cox
I'm not sure of any method - but why do you think that all your rows as arrays will use up more memory than the same amount of data wrapped in objects? Is it just a pass by reference vs pass by copy issue? At the heart of it the dbo_source.php file takes the data from the database query as an

Re: Model find() to return object; instead of array (?)

2008-04-03 Thread Grant Cox
We have some large reports for our application - often involving ~250K rows from 8 different tables. The problem is, if your reporting needs to do any kind of collating or comparison, as ours does, you really can't avoid having all the data loaded somewhere. You may be able to do much of it in

Re: Is cakePHP alive?

2008-03-31 Thread Grant Cox
I'll bet that what is actually crashing apache is the Zend Optimizer extension for PHP. On Apr 1, 11:17 am, Vangel [EMAIL PROTECTED] wrote: The topic sounded like a troller post, I guess it served its purpose. Hack the cake core if you believe its messing up. Thats what Open Source is for.

Re: about cakephp 1.2.0.6311: Model::updateAll()

2008-03-31 Thread Grant Cox
Tickets go on https://trac.cakephp.org However, if you search there you will find a few tickets on the same topic, such as: https://trac.cakephp.org/ticket/3029 The purpose of updateAll() is to allow updating of fields based on calculated values of other fields. Hence, strings are not supposed

Re: Question about finding last record in the database

2008-02-10 Thread Grant Cox
1. None of the methods mentioned are thread safe - if you get multiple concurrent executions you will run into conflicts. You should always rely on the database's auto-increment primary key, don't create the PK yourself. So if you want to use the Client primary key in the client's account

Re: Version 1.2 mostly-ready or not?

2008-02-04 Thread Grant Cox
We have a large web application that has 5000 visitors a day, that has been running in production on the 1.2 branch (then alpha, now beta) for more than six months now. 1. We have lots of unit tests - these tell us if the code is stable more than any stable / beta label on the framework does.

Re: Change FCK Editor Background Color

2008-01-30 Thread Grant Cox
It's no different than without Cake. In your fckconfig.js set FCKConfig.EditorAreaCSS FCKConfig.BodyId FCKConfig.BodyClass as appropriate. On Jan 31, 5:04 am, mbavio [EMAIL PROTECTED] wrote: Hi folks, I have an app where i´m using FCK Editor with Cake, and I want to change the background

Re: Can't find any services through AMF plugin

2008-01-20 Thread Grant Cox
Well, I've never used the service browser, but the AMF plugin works fine from Flex. Perhaps get on #cake-amf and check that the service browser is supported - perhaps it uses something that is AMFPHP specific? On Jan 21, 1:57 am, kiang [EMAIL PROTECTED] wrote: Environments: PHP Version 5.2.4

Re: Fairly simple beforeSave() question

2007-12-30 Thread Grant Cox
The beforeSave looks ok, except that '--' is not empty, so the unset() won't be called. Perhaps you want to do a regex check instead of empty() ? On Dec 31, 10:44 am, Jamie [EMAIL PROTECTED] wrote: Apologies as I'm new to cake, as well as MVC. I have a table with a field called

Re: help with my httpd.conf

2007-12-30 Thread Grant Cox
First, you shouldn't request /app/views/posts/index.thtml - maybe that was a typo above? If http://localhost/cakeBlog/posts/index doesn't work, but http://localhost/cakeBlog/index.php/posts/index does, then you are correct it is a mod_rewrite issue. To enable mod_rewrite, all you should need to

Re: changing model being used by form

2007-12-19 Thread Grant Cox
You should be setting all required data in your controller. If you have $this-data = $this-User-read( null, $user_id ); in your controller, then your form will automatically populate. On Dec 20, 7:41 am, jon [EMAIL PROTECTED] wrote: Is there any way to force change the model that helpers

Re: select sql statement is purposely dump by the cakephp model.

2007-12-19 Thread Grant Cox
Try putting $this-YourTable-cacheQueries = false; before the affected queries. On Dec 20, 12:35 am, kane [EMAIL PROTECTED] wrote: I have written a program which to update credit in an account. When I run once, it work fine. When I run more than once, the problem come. It seems not to

Re: Problem while saving in CakePHP 1.2

2007-12-19 Thread Grant Cox
As I see it the problem is - you are not calling $this-User-set($this-data) before the $this- User-validates() check, so it's not actually validating your data - you are not checking the $this-User-save($this-data) return value - which would indicate whether it was actually saved correctly. So

Re: help with cake

2007-12-19 Thread Grant Cox
/app/webroot is the main web folder Any file you put in there can be accessed directly - if you put a file in /app/webroot/files/yourdoc.pdf then you will be able to access it at http://yoursite.com/files/yourdoc.pdf On Dec 20, 1:09 pm, effour [EMAIL PROTECTED] wrote: Hi, I had a developer

Re: Model Cake Conventions Table Id

2007-12-19 Thread Grant Cox
In your Event model, have var $primaryKey = 'event_id'; Now you weren't clear about the table name, is it singular or plural? If it is singular (e.g. not matching the convention), then also add var $useTable = 'event'; On Dec 20, 12:01 pm, Fabian [EMAIL PROTECTED] wrote: Hi I'm trying to

Re: Thanks for your replies

2007-12-19 Thread Grant Cox
: This is from my core.php * Set a random string of used in session. * */ define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'); On Dec 17, 6:12 pm, Grant Cox [EMAIL PROTECTED] wrote: You shouldn't need to change a single file for Cake to work (to see

Re: Thanks for your replies

2007-12-17 Thread Grant Cox
You shouldn't need to change a single file for Cake to work (to see the default cake has been installed page). For your application to work, you will need to provide the appropriate database connection details (/app/config/database.php), and set a unique session key (/app/ config/core.php).

Re: Id in table is named prj_id

2007-12-16 Thread Grant Cox
var $primaryKey = 'prj_id'; in your model file. On Dec 17, 7:51 am, situator [EMAIL PROTECTED] wrote: I am in trying to make the edit page of my app to call the field name 'prj_id' as opposed to 'id' in the WHERE clause. There is no 'id', it is only 'prj_id'. I need the read() and other

Re: Complex find queries: conditions in the assoc model

2007-12-16 Thread Grant Cox
You have to put the conditions in the association itself. var $hasMany = array('InvoiceItem' = array( 'className' = 'InvoiceItem', 'conditions' = 'InvoiceItem.invoice_id IS NULL', ) ); If you need to do this dynamically, then look at bindModel /

Re: chaging default model

2007-12-16 Thread Grant Cox
For the form helper - if you have $form-create('YourModel'); then the form helper will automatically use the YourModel model for the form. However, you can also create each form item with $form- input('OtherModel.somefield') to use any other model. The data that prepopulates these fields is

Re: Show All Errors on submit

2007-12-16 Thread Grant Cox
To ensure that both models show validation errors, just call validates() manually (which will in turn invalidate() each field that does not match). $this-User-set( $this-data ); $this-Profile-set( $this-data ); $user_validates = $this-User-validates(); $profile_validates =

Re: Preserve other params using paginator

2007-12-16 Thread Grant Cox
Or you can just have ?php $paginator-options(array('url' = $this-passedArgs));? directly in the view, without anything in your controller. It works fine for me without the connectNamed stuff. On Dec 16, 7:36 am, Matjaz Drolc [EMAIL PROTECTED] wrote: Thanks, it works. On 15 dec., 22:15,

Re: Render a blank Page (Don't show the form)

2007-12-16 Thread Grant Cox
Use $this-flash() from your controller. http://manual.cakephp.org/chapter/controllers On Dec 17, 12:08 pm, oracle411 [EMAIL PROTECTED] wrote: When a user submits a form successfully, I would like to display my setFlash message on a blank page. I can redirect it to another page and display

Re: want to call function in default ctp from app model

2007-12-16 Thread Grant Cox
Please be more clear in your question. You cannot call model functions from a view. You must call the model function from your controller, and set() the data for the view. On Dec 17, 3:09 pm, manuj bansal [EMAIL PROTECTED] wrote: my code is as follows

Re: Will CakePHP be able to survive as the Zend Framework matures?

2007-12-16 Thread Grant Cox
I'm sure you'll get a number of responses from people familiar with both systems, professing that CakePHP is better / smaller / faster, whatever. I haven't used Zend, so I can't comment on that. However, the reason I am going to stick with CakePHP is because I know it, and trust its direction.

Re: A question about MVC

2007-12-13 Thread Grant Cox
It should be in the model - as should all data retrieval functions. Put as much stuff in the model as you can - the controller should just parse the request to see what model functions should be called, then set() this for the view. While some processing in the controller is inevitable, models

Re: DESCRIBE happening too often

2007-12-13 Thread Grant Cox
How are you checking that you are getting a lot of DESCRIBE queries with DEBUG set to 0? On Dec 14, 7:09 am, Olexandr Melnyk [EMAIL PROTECTED] wrote: Hello bakers, in one of applications I'm working on, I have noticed DESCRIBE queries being executed on every page for all used models. With a

Re: CakePHP 1.2. pre-beta with CakeAMFPHP

2007-12-12 Thread Grant Cox
Yes, we use CakeAMFPHP with the 1.2.x svn branch. We have made some modifications to CakeAMFPHP though - making it use the cake dispatcher rather than executing the controller actions directly. These modifications were not necessary to get it working though, just to fit in with the rest of our

Re: Stop Users From Going Back After Logout

2007-12-04 Thread Grant Cox
What kiger was getting at is that the user can only see what is in their browser's cache - which is what they were allowed to see a second ago anyway... They won't be able to click any links, or perform any actions. But regardless, what you really want is browser history management. Search

Re: html

2007-12-03 Thread Grant Cox
What is a pure html tag ? If you mean a form element that is not named with cake conventions, look in $this-params['form'] in your controller. On Dec 4, 2:18 am, firefox [EMAIL PROTECTED] wrote: how can i get a value from a pure html tag to my controller?

Re: How do I install Mcrypt in Cake?

2007-12-03 Thread Grant Cox
Mcrypt is a PHP module - and its installation is quite independent from Cake. http://au.php.net/mcrypt There is a newer Cookie component on the bakery ( http://bakery.cakephp.org/articles/view/encrypted-cookie-component ) which also uses mcrypt. On Dec 4, 6:14 am, skoggins [EMAIL PROTECTED]

Re: Xml layout name

2007-12-03 Thread Grant Cox
I expect it will work with $this-layout = 'xml'.DS.'default'; On Dec 4, 4:15 am, Andreas [EMAIL PROTECTED] wrote: Hi I've been trying to use the xml layout but it's not going too well since the layout file itself is located within a subfolder called xml (xml/default.ctp) and I'm not sure

Re: Xml layout name

2007-12-03 Thread Grant Cox
Or actually, try: $this-layoutPath = 'xml'; $this-layout = 'default'; obviously that second line is optional - as 'default' is what should be used anyway. On Dec 4, 7:48 am, Grant Cox [EMAIL PROTECTED] wrote: I expect it will work with $this-layout = 'xml'.DS.'default'; On Dec 4, 4:15 am

Re: Easy referential data integrity?

2007-12-03 Thread Grant Cox
Set 'dependent'=true in your $hasMany definition. See http://manual.cakephp.org/chapter/models for more details. On Dec 4, 2:56 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm new to cakePHP and I'm wondering if there is an easy way to setup automatic referential data integrity so

Re: Getting information from an external database

2007-12-02 Thread Grant Cox
Connecting to multiple databases is easy. Just add the extra connection to your /app/config/database.php, and have the appropriate var $useDbConfig in your Student model class. On Dec 3, 4:54 am, Greg Baker [EMAIL PROTECTED] wrote: How would one go about gathering information from an external

Re: Don't see related tables in view (newbie)

2007-11-29 Thread Grant Cox
' = 'Person') ); } On Nov 29, 2:31 pm, powtac [EMAIL PROTECTED] wrote: On Nov 29, 5:18 am, Grant Cox [EMAIL PROTECTED] wrote: 1. Follow the cake conventions - it makes life easier (http://manual.cakephp.org/appendix/conventions). Ok, Ill have a look at it. 2. In your example

Re: Best practices for organizing tables?

2007-11-29 Thread Grant Cox
I'm not familiar with Postgres or schemas, but I think a prefix is suitable. The table name does not need to affect the MVC names - just set var $useTable = 'whatever_long_table_name' in your model. On Nov 30, 6:33 am, BravoFoxtrot [EMAIL PROTECTED] wrote: What are the best practices for

Re: Getting 404 error after moving to production server

2007-11-28 Thread Grant Cox
When you say 404, is it a Cake 404, or an apache 404? Cake 404: Set your Debug to 1 in /app/config/core.php, this will let you know what the error really is. Delete all the files out of /tmp/cache (leave the folders). Apache 404: Make sure mod_rewrite is enabled in your httpd.conf. Make sure

Re: How do I access variables set in App Controller in View?

2007-11-28 Thread Grant Cox
Because your app controller is attempting to access the User model. Models are not loaded by default - only if they are included in the $uses array of a controller (or, if they are the primary model for the controller, and there is no $uses). http://manual.cakephp.org/chapter/controllers On

Re: Don't see related tables in view (newbie)

2007-11-28 Thread Grant Cox
1. Follow the cake conventions - it makes life easier ( http://manual.cakephp.org/appendix/conventions ). 2. In your example above, you want: Person belongsTo Position, with foreign_id 'position' Position hasMany Person, with foreign_id 'position' 3. Make sure you are using scaffold for your

Re: Getting 404 error after moving to production server

2007-11-28 Thread Grant Cox
, then i would restrict permissions). I have provided full permission to the tmp folder, do i need to do anything else? Thanks for your help. Rohit On Nov 29, 12:22 pm, Grant Cox [EMAIL PROTECTED] wrote: When you say 404, is it a Cake 404, or an apache 404? Cake 404: Set your Debug to 1

Re: Display Dynamic Images in Cake??

2007-11-27 Thread Grant Cox
Looks like you are messing with it now - there is an obvious print_r and br/ before the file data now. Are you calling exit() after the file data is output, or otherwise ensuring that cake doesn't attempt to render a view? On Nov 27, 7:09 pm, jonathan [EMAIL PROTECTED] wrote: Just so you know

Re: How to hand fileds in Model-read ...

2007-11-27 Thread Grant Cox
Just to clarify, when setting debug to 0 only the DESCRIBE `your_table` queries are cached - of course a read() does still read in every field. If you want to reduce the fields included, look at using findById() or just find() rather than read(). On Nov 28, 5:44 am, WordPress Guru [EMAIL

Re: How do you specify a separate/different layout for pages and errors? (CakePHP 1.2)

2007-11-27 Thread Grant Cox
Or specifically, use a different layout for your pages. You can set $this-layout in the view itself too, if you don't want to copy over the PagesController. On Nov 28, 11:06 am, kiang [EMAIL PROTECTED] wrote: Put the following line in the top of your controller: var $layout = 'error'; ---

Re: Arrays in Sessions

2007-11-25 Thread Grant Cox
// get the current basket $basket = $this-Session-read('basket'); if ( empty($basket) ){ $basket = array(); } // modify it how you like $basket[] = $new_product; // save back to session $this-Session-write( 'basket', $basket ); On Nov 26, 8:08 am, ohneworte [EMAIL PROTECTED] wrote: Good

Re: Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object

2007-11-21 Thread Grant Cox
Have you tried debugging this yourself - what problems did you encounter? The errors above give you specific line numbers in your own code that should give a good idea what is happening. For a guess, since it is in your afterFind, you are expecting the afterFind to have an array of results each

Re: Help with database structure

2007-11-21 Thread Grant Cox
http://manual.cakephp.org/chapter/models Read up on associations, and how they are meant to work. And perhaps make something a bit smaller until you understand what the difference between associations are. Anyway, this is the kind of structure I would start with for what you outlined. I've

Re: Behaviours - Session data

2007-11-21 Thread Grant Cox
Cake does not provide a method, as you should not be accessing the session from any model / behaviour. Sometimes it is just much easier to do so though, so you can still access $_SESSION directly. But you really should reconsider whether you have to access the session in your model / behaviour

Re: Behaviours - Session data

2007-11-21 Thread Grant Cox
And that nate's response came in 20 minutes before mine showed how long I sat here thinking about it, heh. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Multiple Slave Servers?

2007-11-20 Thread Grant Cox
http://groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/fdff3040db8f9cf6?lnk=gstq=nate+master+slave#fdff3040db8f9cf6 Or if that doesn't work, search this group for nate master slave. Basically just set the $useDbConfig in the beforeSave / beforeFind / beforeDelete to cause

Re: Cake Vendors directory access?

2007-11-20 Thread Grant Cox
I have no idea why it doesn't work for you, it works fine here. Are you sure you aren't including the .php part of the filename in your vendor call? Is your file in a subfolder or anything? What version of Cake are you using? The vendor() function is defined in /cake/basics.php, and is not

Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-19 Thread Grant Cox
Put both conditions in the 'or' key: $datetime = date(Y-m-d H:i:s); $count =$this-PromoCode- findCount(array(OR=array(PromoCode.start_date = $datetime, 'PromoCode.active'='1'))); On Nov 20, 11:49 am, zonium [EMAIL PROTECTED] wrote: I have these statements: $datetime = date(Y-m-d H:i:s);

Re: Routing Question

2007-11-19 Thread Grant Cox
Router::connect('/admin/logout', array('controller' = 'home', 'action' = 'logout', 'prefix'='admin')); On Nov 20, 8:11 am, releod [EMAIL PROTECTED] wrote: Hey, just installed my first CakePHP application today. I am wondering how to get url to work in the browser: /admin/logout Here is my

Re: Is cake 1.1 using the PHP5 only function scandir()?

2007-11-19 Thread Grant Cox
It looks like it - I can't see an alternative scandir function declared anywhere. Test it out and see if it causes an error, if so post a ticket on https://trac.cakephp.org/ On Nov 20, 2:53 am, keymaster [EMAIL PROTECTED] wrote: Am I imagining things, or is the cake 1.1 version using an

Re: controller action in beforeSave() ?

2007-11-18 Thread Grant Cox
No, you cannot access ANYTHING from the controller in the model - that's one of the core parts of MVC. What you should do is define a new function in your model - register() This can set some class variable which you can check in your other callbacks, eg: class YourModel extends AppModel {

  1   2   3   4   5   6   >