Re: 'add' action and auto-setting model id

2009-06-29 Thread Adam Royle
Yes, whether it is right or not, that is the way cake behaves. You should always use Model::create() before saving a new record just in case. For the extra paranoid, you can do this on your add() action: $this-Model-create($this-data, false); $this-Model-save(); The second parameter (false)

Re: 'add' action and auto-setting model id

2009-06-29 Thread Adam Royle
Hi Vijay, Have a look at the source of controller.php in constructClasses() and you will see what Ralph is experiencing. Line numbers are indicative of r8204 (current branch). line 448: $id = $this-passedArgs['0']; line 452: $this-loadModel($this-modelClass, $id); Cheers, Adam -

Re: n-categories URL routing

2009-06-23 Thread Adam Royle
Setup a route like this: Router::connect('/categories/*', array('controller' = 'categories', 'action' = 'index')); Then in your index() method of CategoriesController you can then check for the additional params in $this-params... This is not so dissimilar how Cake's PagesController works.

Re: n-categories URL routing

2009-06-23 Thread Adam Royle
23, 2:26 pm, toka...@gmail.com toka...@gmail.com wrote: Hi Adam, thanks a lot, I did not realize that it is so easy... I have already try it and it is working. :) anyway good point with the whole path... Tomas On Jun 23, 12:45 pm, Adam Royle a...@sleekgeek.com.au wrote: Setup a route

Re: Validation

2009-06-23 Thread Adam Royle
Each and every CakePHP app is like a hand-woven Persian rug - unique and each comes with its own beautiful imperfections. I implore you to accept our flaws as part of our personality and embrace all that is CakePHP! Cheers, Adam - Original Message - From: Nate Brunette

Re: transactions + redirect doesn't work!

2009-06-22 Thread Adam Royle
that operation in a standard way? Thanks, Mateo On 22 jun, 00:45, Adam Royle a...@sleekgeek.com.au wrote: Yes. You must start and end atransactionwith the same mysql connection. MySQL connections are automatically closed once the page has finished executing. Aredirectstops the current page execution

Re: transactions + redirect doesn't work!

2009-06-21 Thread Adam Royle
Yes. You must start and end a transaction with the same mysql connection. MySQL connections are automatically closed once the page has finished executing. A redirect stops the current page execution. Cheers, Adam - Original Message - From: Mateo San Román sanroma...@gmail.com To:

Re: Flash site With Cake Php

2009-06-19 Thread Adam Royle
Put this in app/views/users/xml/index.ctp ?php echo 'users'; echo $xml-serialize($users, array('format' = 'tags')); echo '/users'; ? and put this in app/views/layouts/xml/default.ctp ?php echo $xml-header(); echo $content_for_layout; ? XML it doesn't show as XML in your browser if debug is

Re: Router Connect

2009-06-19 Thread Adam Royle
Look into admin routing in the cakephp cookbook. Cheers, Adam On Jun 19, 12:44 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote: I'm a little confused by routes at the moment. Currently I have an admin structure where each function such as function users($load = null, $id = null) {    

Re: Dynamic use of MySQL views

2009-06-19 Thread Adam Royle
Does this work? $this-Item-setSource($locationId.'_items'); Cheers, Adam On Jun 19, 12:43 pm, VisionIzoizo mauro.tr...@googlemail.com wrote: Hi, I have one big table named 'items'. It's split into many views, according to a custom defined criteria (location). I want to access these views

Re: Changing view file in controller

2009-06-17 Thread Adam Royle
Why certainly! In your AppController add this: function beforeFilter() { if (!empty($this-params['facebook'])) { $this-viewPath = 'fbml'; } } And then you would have your fbml view in: app/views/YourModel/fbml/index.ctp and then you put your xhtml view in:

Re: CakePHP XSS protection?

2009-06-17 Thread Adam Royle
You need to handle this manually. Look at the Sanitize class for cake's built-in methods. http://api.cakephp.org/class/sanitize If you don't need the user to enter any html at all, consider using the h() method while outputting your data, which will convert any html tags to their entities so

Re: CakePHP XSS protection?

2009-06-17 Thread Adam Royle
Message - From: Marcel vermas...@gmail.com To: cake-php@googlegroups.com Sent: Wednesday, June 17, 2009 10:58 PM Subject: Re: CakePHP XSS protection? Adam Royle wrote: You need to handle this manually. Look at the Sanitize class for cake's built-in methods. http://api.cakephp.org/class

Re: https

2009-06-17 Thread Adam Royle
There is no code you need to change to get ssl working with cakephp. Make sure you have ssl setup on the site correctly with just static files first. Cheers, Adam - Original Message - From: rakesh singh rcky.ni...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Wednesday, June

Re: Auth Problem using in Login Process

2009-06-17 Thread Adam Royle
A bit hard to diagnose without seeing any code... but is your form posting to the login action? And also make sure cookies are enabled in your browser. Cheers, Adam - Original Message - From: uday singh.uday...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Thursday, June 18,

Re: Webroot and prefix in Router::connect()

2009-06-17 Thread Adam Royle
I see from a previous email you overrode your AppHelper to automatically prepend /fb onto all of your links which is causing the prob. Short of re-writing your links everywhere, you could modify this method so absolute files are not prepended with /fb. Cheers, Adam - Original Message

Re: Problem with Large Datasets

2009-06-16 Thread Adam Royle
Hi Femi, You should really just use one query for that with a number of joins and let the database do all the work. My advice is to get someone familiar with sql and construct the raw query and get it running at a decent speed inside the mysql console, and then find a way to get that sql into

Re: Problem with Large Datasets

2009-06-16 Thread Adam Royle
and closely followed standards on that. I honestly just wanted to avoid writing a custom query (lazy me). Was only hoping that there was a way to avoid custom queries. Will give that a try then. Thanks! Femi Adam Royle wrote: Hi Femi, You should really just use one query

Re: Advanced(?) Behavior question

2009-06-16 Thread Adam Royle
I am fairly certain that each related model will take care of it's own beforeSave and afterFind callbacks, so you should just need to handle encryption/decryption for the primary model, and each other model that is saved/found will handle its own as well. Cheers, Adam - Original Message

Re: Organization issues and more...

2009-06-16 Thread Adam Royle
Wow. Sorry, I didn't read your entire email. But a few things.. 1) Yes, generally you have just one table per model per controller. 2) A more flexible solution is to have your menu heirarchy to be separate from your controller/action heriarchy. This will allow you to separate your visual

Re: array extraction

2009-06-16 Thread Adam Royle
('Transaction.jurisdiction_id ='=$id),'fields' = array ('Transaction.id','SUM(Transaction.amount) AS Amount'; I don't know if that has anything to do with why I can't any array PHP functions like remove(), array_chunk(), array_slice() etc to work. -sam On Jun 15, 5:32 pm, Adam Royle

Re: MySQL function escape with multiple conditions

2009-06-16 Thread Adam Royle
If I am doing something like this I generally just create a string and pass it through. Make sure to encapsulate it in parenthesis () in case you have other conditions. $event_conditions = array( '(Event.start BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_ADD(CURDATE(), INTERVAL 7

Re: Advanced(?) Behavior question

2009-06-16 Thread Adam Royle
testDecrypt in the Post model...all it did was a find('all') with recursive set to 3. I then pr()'d the result and used die() to stop operation. All post titles were decrypted (they were encrypted in the database) but the user emails showed up as encrypted. On Jun 16, 9:24 pm, Adam Royle

Re: grr help with cron/shell tabs

2009-06-15 Thread Adam Royle
chmod +x /home/mileswj/cake/console/cake then put this in cron /home/mileswj/cake/console/cake your_shell_name -app /home/mileswj/ sc2armory.com/app/ Cheers, Adam On Jun 15, 6:25 pm, Miles J mileswjohn...@gmail.com wrote: Heres my current folder setup. /home/mileswj/cake/ (below root and

Re: array extraction

2009-06-15 Thread Adam Royle
use this function, it works well... // recursively reduces deep arrays to single-dimensional arrays // $preserve_keys: (0=never, 1=strings, 2=always) function array_flatten($array, $preserve_keys = 1, $return = array()) { foreach ($array as $key = $child) { if (is_array($child)) { $return

Re: grr help with cron/shell tabs

2009-06-15 Thread Adam Royle
cake is a shell script which needs to be chmod'ed to 755 to allow being executed (also chmod +x will do that) If you're getting the output of the file instead of it being executed, then it seems you're passing the script onto something else (such as the php interpreter) rather than executing

Re: routing to control layout

2009-06-15 Thread Adam Royle
Sure... Router::connect('/AppName/facebook/:controller/:action/*', array('facebook' = 1)); then in your app controller just check for $this-param['facebook'] - Original Message - From: Greg Baker greg.baker@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Tuesday, June 16,

Re: routing to control layout

2009-06-15 Thread Adam Royle
if $this-params['facebook'] were set? Would this be possible using routing or would I have to do something else? On Jun 15, 10:36 pm, Adam Royle a...@sleekgeek.com.au wrote: Sure... Router::connect('/AppName/facebook/:controller/:action/*', array('facebook' = 1)); then in your app controller just

Re: Cakephp equivalent of mysql_fetch_row

2009-06-14 Thread Adam Royle
http://book.cakephp.org/view/809/find-count - Original Message - From: Wayne smittysand...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Sunday, June 14, 2009 6:55 PM Subject: Cakephp equivalent of mysql_fetch_row Hi, i need a function that returns the number of rows from a

Re: Modifying Html Helper Image method for localization support

2009-06-14 Thread Adam Royle
I guess it depends if you have any shared images that might be generic and used with all languages. If you want to override the helper, you can do it by creating an AppHelper class in app/app_helper.php Although this does change your functionality and you would have to duplicate any shared

Re: Any idea how to put one cakephp project in the directory structure of another cakephp project?

2009-06-14 Thread Adam Royle
You will need to exclude the portfolio directory from being sent to your default cake installation. Something like this might work... IfModule mod_rewrite.c RewriteEngine on RewriteRule^$ app/webroot/[L] RewriteCond %{REQUEST_URI} !^/portfolio(/|$) RewriteRule(.*)

Re: PHP Fatal error: Class 'Router' not found in cake\libs\view\helper.php on line 178

2009-06-13 Thread Adam Royle
I found this problem too, when I was sending emails using a cron job, and needed to link back to the site. However there is an easy workaround. I am using the EmailTask from the Bakery, and added importing the router and routes definitions in here. ?php App::import('Core', 'Controller');

Re: Manual sorting of data records (datasets)

2009-03-14 Thread Adam Royle
Something like this should work (as long as you include the RequestHandler component). Personally, I use an extra field rank in my table which is just an integer. if ($this-RequestHandler-isAjax() !empty($this-params['form']['tableId'])) { foreach ($this-params['form']['tableId'] as

Re: A list of more productive tutorials?

2009-03-09 Thread Adam Royle
Can you be more explicit about what you are looking for? Is there something in particular you don't know how to do? Adam webperson wrote: Hello, Does anyone know of a single sole source of free phpcake tutorials? I have found and completed all of the ones I could find, but I am assuming

Re: One directory for all view files.

2009-03-03 Thread Adam Royle
Yes, CakePHP has a separate folder for each controllers views, but I would imagine if you had a ton of controllers you might want to separate them anyway? I recommend you stick with the conventions to start with, and further down the track if you still want to change it, you'll find a way.

Re: Find max(id)

2009-03-03 Thread Adam Royle
Oh right I see what it's doing now. I would say that it's a bug then. CakePHP should not generate invalid SQL queries. Although I'm pretty sure Cake adds the id field to the field list because it is required for recursively finding associated records, it could prob be modified to always add

Re: Find max(id)

2009-03-02 Thread Adam Royle
I think the majority of CakePHP users are using MySQL, so it could be a bug in the cake's MSSQL datasource. You should do some investigating into what query is generated, does it run if you try it through sql server directly? If not, what needs to be changed for it to work? Then look at the

Re: Security component breaks my ajax requests

2009-02-28 Thread Adam Royle
Looking at the Security component source, you need to override the validatePost value in SecurityComponent. The following is untested code, but I think it should work. function beforeFilter() { if ($this-action == 'your_action') { $this-Security-validatePost = false; }

Re: How to set up site structure with Admin folder and controllers?

2009-02-25 Thread Adam Royle
Have you looked into admin routing? You'll just need to prefix your actions and your views with admin_ to get it to work (and enable it in app/core.php) And then set up a route for your admin homepage, which would point to AdministratorsController::admin_dashboard() Router::connect('/admin',

Re: Manual sorting of data records (datasets)

2009-02-24 Thread Adam Royle
Both protaculous and jquery (and prob most other js libraries) have a sortable function so you can drag and drop records (re-ordering) with your mouse, and a serialize function so you can send the re-ordered ids back to the server to update the database. I'm sure you could also do the move

Re: How to embed flash when using CakePHP

2009-02-23 Thread Adam Royle
You might want to give some examples of your code if you want anything more specific than what I have said. However, if you aren't already, use Firebug to look at what URLs flash is requesting. And make sure you have debug = 0 when doing this so you can easily see 404 errors when they occur.

Re: Tree misbehaviour

2009-02-23 Thread Adam Royle
What data type are you using for your lft and rght columns? I'm not sure if it will help you, but have a browse over my article which has all the code to get the Tree behavior working and see if you're doing anything differently.

Re: Pages and Views

2009-02-23 Thread Adam Royle
I think you're on the right track with your thinking. 1) You should route to your users controller, not the pages controller Router::connect('/search', array('controller' = 'users', 'action' = 'search')); 2) You should explicitly set your search form url. echo

Re: Plugins - Calling plugin App Controller from base application App Controller

2009-02-23 Thread Adam Royle
Due to the way plugin controllers work with inheritance, you can only access the plugin's beforeFilter logic when the page is requested through the plugin (ie. /plugin/controller/action/) From what I can tell you want to execute plugin logic from your base app? The proper way to do this is

Re: How to embed flash when using CakePHP

2009-02-22 Thread Adam Royle
Brian is right. You need to change the path to be relative to the root of your site, not the page. So change this: media/jpgrotator.swf to this: /media/jpgrotator.swf In all instances and it should work. Also, if you are loading other swfs, images, text files, etc, from inside flash,

Re: Debug off denies access to login page

2009-02-21 Thread Adam Royle
Try debugging by putting logging statements in your code step by step and see what you get. $this-log('yayaya'); And you can check them inside app/tmp/logs/ Cheers, Adam - Original Message - From: benjam benjamwel...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Saturday,

Re: email to blog functionality

2009-02-19 Thread Adam Royle
Depends on your server setup. Two solutions: 1. Write a script that is called periodically through cron that checks an email mailbox for new messages. 2. Setup your email account to pipe to a script instead of to a mailbox. I have used #2 and it works well because the script only runs when it

Re: email to blog functionality

2009-02-19 Thread Adam Royle
I've done it using cpanel (quite easy actually), and from some googling it seems possible with plesk too. Just search for your control panel name pipe email to script. With #1, you can use php imap extension, which lets you access both pop and imap mailboxes. Adam leo wrote: Thanks, I'd

Re: Calling a (empty!) model-method causes SQL Error: 1064

2009-02-18 Thread Adam Royle
Sounds like you have a typo somewhere (maybe you've got plural instead of singular?). Cake automatically creates models if they don't exist. Therefore it is creating a model (an instance of AppModel) and your method is not defined in AppModel. Make sense? Adam Mr Speaker wrote: I think I

Re: Displaying Unrelated Models in an Index View

2009-02-17 Thread Adam Royle
I would probably add another model, Post, like you've mentioned. I would also probably create a behaviour that would exist in all the sub-post models, which would add and remove a link from the Post model on save/delete. Although I haven't used it myself, it looks like you could then use

Re: Book Comments - Should they be removed

2009-02-17 Thread Adam Royle
I think the comments should stay, but improve the functionality to make them more useful/constructive. Develop a upvote/downvote system for comments. This should eliminate stupid comments from wasting people's time, and the popular comments should indicate what parts of the manual could be

Re: Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread Adam Royle
var $hasAndBelongsToMany = array('Developer','Publisher'); - Original Message - From: mklappen mklap...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Tuesday, February 17, 2009 9:24 AM Subject: Can you have multiple hasAndBelongsToMany relationships in one model? Hi, I'm

Re: Problem w/ Shells

2009-02-15 Thread Adam Royle
Have you checked your database connection? (Just a thought) Also, with shells you need to ensure you execute the shell from the app folder, or specify the path to your app in -app Cheers, Adam Kyle Decot wrote: I'm trying to create a shell but I'm running into some problems. If I add $uses

Re: Problems with code using cake 1.2

2009-02-15 Thread Adam Royle
Your syntax is not valid. Try reading up on the new form helper on the cookbook. http://book.cakephp.org/view/183/Creating-Forms Cheers Adam simon...@gmail.com wrote: Good Night, I'm trying to make this code work but they are 3 problems with it. Here are the 3 errors: Method

Re: When to use Data caching??

2009-02-14 Thread Adam Royle
I don't tend to cache data by itself, as like you've said it generally won't save you much time vs mysql alone. I do use view caching on busy sites for static content and also for elements, as it can give a noticeable improvement. I guess it really depends on your traffic and the type of site

Re: switching databases on dev and production

2009-02-10 Thread Adam Royle
I use svn:ignore on app/config/database.php, and only commit a generic database.php.default file (that contains no usernames/passwords). Each time I checkout the code (dev, staging, production) I rename the .default file to database.php and make my edits on the server. So ultimately no passwords

Re: Best way to clear cache?

2009-02-08 Thread Adam Royle
I think you might benefit from a deploy script. I have a bash script that updates the site code from subversion and clears my cache dirs at the same time. I have command-line access and it runs on linux, so it's pretty easy to do that. On Feb 9, 9:30 am, Miles J mileswjohn...@gmail.com wrote:

Re: Image Association with Records

2009-01-30 Thread Adam Royle
I do something similar and it works quite well for my purposes, however I save my images in /files/images/, and I use behaviors to abstract the file management away from my model. So usually I have something like this: Image actsAs ImageBehavior (subclass of FileBehavior) Cheers, Adam On Jan

Re: Are we using the slowest PHP framework there is?

2009-01-25 Thread Adam Royle
Yes, it would be great to have a fully-fledged application example, complete with time to develop and lines of maintainable code benchmarks. And another one which measures mental anguish experienced by the framework. On Jan 26, 7:38 am, Miles J mileswjohn...@gmail.com wrote: Yes I always hate

Re: Automatic table generation?

2009-01-24 Thread Adam Royle
Hi Carlosz, #1. I find using a gui db program is much quicker than defining everything in a text file. I use navicat and it's awesome. However... #2. CakePHP does have a thing called CakeSchema, which can be used to generate table structures from a file definition. For more info, look at the

Re: Create html files dynamically

2009-01-24 Thread Adam Royle
I would recommend using routes to accomplish this - you don't need to write to a static html file. http://book.cakephp.org/view/542/Defining-Routes Cheers, Adam On Jan 24, 6:48 pm, Sumesh G sathees...@gmail.com wrote: thanks for your reply i want to create the html pages with the dynamic

Re: How can TMP be set to some other directory?

2009-01-20 Thread Adam Royle
Can you explain why you need different tmp directories for the same actual app? If it's for caching, etc, maybe you can use a cache prefix dynamically? Cheers, Adam Martin Westin wrote: Hi (again), I want to try to host one application under several domains. One Cake One App Many configs

Re: About custom cache features

2009-01-19 Thread Adam Royle
Btw, it wasn't deleted, only the version and milestone metadata was deleted from the ticket. It is still an open ticket. Cheers, Adam On Jan 19, 6:26 pm, kiang kia...@gmail.com wrote: I submitted a ticket about adding tag feature to cache and it got deleted

Re: Associations on the Fly - Good or Bad?

2009-01-17 Thread Adam Royle
Personally I find it easier to define all associations and use Containable or recursive = -1 to define what data I get back. It's easier to understand for me and works fairly well, makes it quick to develop and easy to debug. The only potential downside is that every associated model is loaded,

Re: Using a different path for image storage

2009-01-16 Thread Adam Royle
This error happens when the image doesn't exist, and the request is forwarded to cakephp. Make sure the file is there and case-sensitive if on linux. Cheers, Adam On Jan 16, 8:48 pm, g4b0 gabriele.bros...@gmail.com wrote: Hi all, I'm trying to put some images in /app/webroot/img/photo, but

Re: where to start - basic security question?

2009-01-13 Thread Adam Royle
Yes, I would say most people use the controller/action/params type urls. Most people's thoughts about passing the action through a POST instead of a GET to make it more secure are moot. You can fake (and modify variables) in a POST request just as easy as you can with GET. Your post indicates

Re: share function in views

2009-01-12 Thread Adam Royle
If it's just a simple function, then you can place it in bootstrap.php and it will be globally available. Cheers, Adam On Jan 12, 8:51 pm, Henrik Gemal henrikge...@gmail.com wrote: I have a custom html escape function that I like to be able to use in two views. What's the best way to share

Re: TreeBehaviour reorder performance issue

2009-01-10 Thread Adam Royle
I've had a tree with that many records and had no issues re-ordering it (maybe 1-2 seconds max). I seem to remember needing to set $this-MyModel-recursive = -1; before calling the reorder methods. Maybe that is your problem - you might be selecting more than you need to? Maybe you should show

Re: Simple String Manipulations?

2009-01-10 Thread Adam Royle
Try this in your model... class Whatever extends AppModel { function beforeSave() { $data = $this-data[$this-alias]; if (!empty($data['title'])) { $data['title'] = ucwords($data['title']); } return parent::beforeSave(); } } Your could then

Re: dynamic content from infinite 'tree' categories

2009-01-09 Thread Adam Royle
Maybe you could try a real tree component? http://blogs.bigfish.tv/adam/2008/02/12/drag-and-drop-using-ext-js-with-the-cakephp-tree-behavior/ Cheers, Adam On Jan 9, 8:19 pm, designv...@gmail.com designv...@gmail.com wrote: Has anyone done aything along the lines of dynamically adding divs/

Re: include calculated data in the model

2009-01-05 Thread Adam Royle
Just add a physical amount field to your orders table, and then add a method to your Order model which calculates the order total and updates the order. Then call that method whenever you add/modify/ delete your OrderProducts. On Jan 6, 8:21 am, Yannis i...@netstudio.gr wrote: I have this kind

Re: Return compressed XML

2009-01-04 Thread Adam Royle
If you're sending unique data for each request, I wouldn't bother using the MediaView. Just output data in your views and set some custom headers. You can also find out about an easier way to gzip output in cakephp here:

Re: Exposing a Web Service on a Cake Shell

2009-01-04 Thread Adam Royle
Todays databases are designed to handle a crapload of queries, so don't be afraid to take advantage of this. Just make sure you've got indexes on the right columns and your queries are using those indexes. You could possible create another table which is optimised to hold any database changes

Re: Adding table row with AJAX

2009-01-02 Thread Adam Royle
It is my understanding that CakePHP is planning to migrate to jQuery in the near future (much like the rest of the world, even my grandmother, and she doesn't even have a computer!). I use jQuery to add an extra row by cloning the last row, incrementing the ids and names of the elements and

Re: Problem in model designing

2008-12-31 Thread Adam Royle
For simplicity's sake I would keep them in the one table, and dynamically change the $validate array in my beforeValidate method of the model to suit. I've never used this but it may help you: http://bakery.cakephp.org/articles/view/conditinalvalidation-behavior Cheers, Adam On Dec 26 2008,

Re: Order associated data

2008-12-30 Thread Adam Royle
Yes, you've got the categories/products thing set up as I would do it. With ordering, you can do it both ways: 1) Just for this association - use the 'order' key when setting up the association in categories model... eg.

Re: Order associated data

2008-12-30 Thread Adam Royle
works fine, but the second one doesn't. I've added it to the top of the Product model, just below the $name variable, like so: var $name = 'Product'; var $order = 'Product.title ASC'; Any idea? On Dec 30, 10:04 pm, Adam Royle a...@sleekgeek.com.au wrote: Yes, you've got the categories

Re: what's wrong with my route?

2008-12-30 Thread Adam Royle
I don't usually care about routes for my admin controllers since no one except administrators see them, so if it was me I wouldn't worry about it. However you could probably simplify your routes: Router::connect('/admin/islandnews/:action/*', array('controller' = 'newsletters', 'admin' =

Re: HTML 4 specific CakePHP?

2008-12-28 Thread Adam Royle
Is it possible that you can just overwrite the tag list with your HTML equivalents? http://bakery.cakephp.org/articles/view/overriding-specific-html-tags-before-using-helper-methods Cheers, Adam On Dec 29, 8:24 am, gearvOsh mileswjohn...@gmail.com wrote: I have not found any option or setting

Re: parseExtension and 404 throwing

2008-12-25 Thread Adam Royle
Have you tried turning debug to 2 and seeing what the error is? Cheers, Adam On Dec 25, 3:40 am, Jne goo...@neuveglise.net wrote: Hi, on my website I have a 'movie_comments' controller and a feed($id) action. With RC3 :http://sph3re.tv/movie_comments/feed/151.rssis outputting the proper

Re: parseExtension and 404 throwing

2008-12-25 Thread Adam Royle
complaining about view not found but it's looking for the wrong one since the feed.ctp is in the views/movie_comments/rss/ dir as it is supposed to be. Thanks ! Jérôme On 25 déc, 09:48, Adam Royle a...@sleekgeek.com.au wrote: Have you tried turning debug to 2 and seeing what the error

Re: Using dynamic values in model validation

2008-12-25 Thread Adam Royle
Controllers talk to models, not the other way round, so you would need to call a method in your model from your controllers, passing the params as necessary. On Dec 23, 8:52 am, gearvOsh mileswjohn...@gmail.com wrote: No not that. In the models beforeValidate() is it possible for me to do like

Re: parseExtension and 404 throwing

2008-12-25 Thread Adam Royle
to track the view path ? Thank you ! Jérôme On 25 déc, 12:14, Adam Royle a...@sleekgeek.com.au wrote: Hmm... that's unusual. I did a quick test with one of my apps that uses parseExtensions, upgraded it from RC3 to RC4 and it worked as expected. Maybe there is something else in your

Re: Containable behavior not working as expected

2008-12-25 Thread Adam Royle
Admittedly I skimmed through your post, but what sql is executed? Are sure you sure you've attached the Containable behavior to your model? Cheers, Adam On Dec 26, 1:28 pm, Aidan Lister aidanlis...@gmail.com wrote: I'm having trouble with the Containable behavior. My first query, ?php

Re: Using dynamic values in model validation

2008-12-22 Thread Adam Royle
I don't really understand your question... are you asking if you can see what data is going to be saved from inside the beforeValidate() method? If so, look at $this-data Cheers, Adam On Dec 22, 8:20 pm, gearvOsh mileswjohn...@gmail.com wrote: Thanks, also is there a way I can get the

Re: Is it possible to redefine Inflector::slug()?

2008-12-21 Thread Adam Royle
The best solution is to write a patch and submit it into the cake core. On Dec 20, 11:22 am, Jaime ja...@iteisa.com wrote: Hi all, I did a nice app which makes heavy use of Inflector::slug() to convert My Strings inoto my_strings. However, now I find that the core slug() function is not

Re: Problem with CakePHP 1.2 recursive including content to page, big problem.

2008-12-21 Thread Adam Royle
If you look at the page title, it says PD Reality | Errors - this indicates there were errors. Double-check to make sure you have uploaded all files, database connection is fine, and you've cleared the tmp folders. Set debug = 2 and it should show you what is going wrong. Otherwise, check the app

Re: Problem with CakePHP 1.2 recursive including content to page, big problem.

2008-12-21 Thread Adam Royle
Oh, and make sure you have writable tmp folders and mod_rewrite and AllowOverride, etc, all the things you should check for a standard install. On Dec 21, 6:44 pm, Petr Vytlačil petr.vytla...@gmail.com wrote: Hi i developing a application for my friends, i try this applicaton on two webhosting

Re: exclude form helper markup?

2008-12-21 Thread Adam Royle
I was the same as you when I first started, but over time I started seeing the usefulness of cake's magic. You can change the label easily by doing this: ?php echo $form-input('email', array('label' = 'Your Email Address:')); ? Cheers, Adam On Dec 22, 6:58 am, justclint justcl...@gmail.com

Re: Using dynamic values in model validation

2008-12-21 Thread Adam Royle
When defining class properties you can't use expressions - only data structures, so you need to populate the $validate array dynamically inside the model. You can do this in beforeValidate() method in your model, but be sure to return true. beforeValidate() { $this-validate['fieldName'] =

Re: appmodel save returns true to data not in database

2008-12-20 Thread Adam Royle
If you are upgrading from 1.1 there could be many things that are tripping you up. You controller code looks fine, although I would change your view code to this: ?php echo $form-create('User'); echo $form-input('about_me', array('type' = 'textarea'); echo $form-end('Submit'); ? Also, in 1.2

Re: Action-Specific Helpers

2008-12-18 Thread Adam Royle
What you are doing is perfectly fine, I personally use $this-helpers [] = 'Blah'; since it's quick and easy. Cake will only load your helper once even if it appears multiple times in your helpers array, so don't even worry about checking for this. Heck, just include it twice to make sure it

Re: Controller action randomly running twice

2008-12-18 Thread Adam Royle
By the way, you can also do this: $this-log($this) if you want to really analyse the request. :) Cheers, Adam On Dec 19, 12:13 am, WebbedIT p...@webbedit.co.uk wrote: Tested your theory that something in my page with a local relative path was calling the page again.  To do this I added an

Re: Inflector::singularize converts Is to I

2008-12-18 Thread Adam Royle
Well, Is is not actually a plural... so... what behaviour would you expect? Maybe some context of where you are using this would be beneficial. Cheers, Adam On Dec 19, 12:45 pm, bingo ragra...@gmail.com wrote: hi bakers, I just stumbled across a weird problem and not sure whether its a bug

Re: $form-input with onkeyup, onfocus, etc

2008-12-13 Thread Adam Royle
CakePHP doesn't discern between html attributes, by default it escapes all attribute values. If you want to change this behaviour, then you can pass 'escape' = false as part of that second array, *however* you will manually need to escape all other values (including the input value I believe). A

Re: Validation with CakePHP/ExtJS

2008-12-13 Thread Adam Royle
Hi Paul, You can also access the validation errors directly in the view, so you could just have this in your controller... $this-User-save($this-data); and something like this in your view... ?php $response = array( 'success' = empty($this-validationErrors), 'errors' =

Re: unobtrusive datepicker

2008-12-13 Thread Adam Royle
I use Firebug in this case to see what files are being loaded, and to make sure I'm getting no 404s on things like js or css files, etc. Cheers, Adam On Dec 13, 8:34 pm, cakephpro...@googlemail.com cakephpro...@googlemail.com wrote: Hello, I'm using the unobtrusive datepicker

Re: Explanation for model validation on parameter in conjunction with required = true

2008-12-13 Thread Adam Royle
Hi Mr Timp, Yes, your example looks a bit old/odd. The correct equivalent of : $this-User-data = $this-data; is this: $this-User-set($this-data); This will ensure $this-User-id is updated with the correct value. However, having said that, most of the code you've got seems unneeded. Replace

Re: Problems storing the output of render()

2008-12-12 Thread Adam Royle
I can't explain why it is concatenated (certainly seems odd to me too) but until you figure out if it's a bug or a feature, could just manually set $this-output = ''; after your render call. Cheers, Adam On Dec 13, 12:24 pm, seedifferently seedifferen...@gmail.com wrote: Dear group, I'm

Re: Limitation in number of records when using CakeAMF

2008-12-11 Thread Adam Royle
Hi kiang, At first I thought you were insane, because I was returning 1000 rows in an array and all was fine... except then I tried with longer data, and got the same problem as you experience. So I did some debugging and have found the solution! Cake was always returning 0 as the length of the

  1   2   3   4   >