routes, controller name and model name
I'm making a site for an artist and when showing image galleries of art collections I want url's like www.site.com/collections/name-of-collection Now I also have a database table for collections, and hence a collection_controller and a collection model. First I had my routes like this - Router::connect('/collections/:action/*', array('controller' = 'collections')); - Router::connect('/collections/*', array('controller' = 'collections', 'action' = 'index')); I thought that the first route would only catch url's with existing actions, but instead it also caught my /collections/name-of- collection url's. So I changed it to: - Router::connect('/coll/:action/*', array('controller' = 'collections')); since the url's don't matter for my admin actions. But then I have to change my forms because ?= $form-create('Collection');? will post the form to /collections/... Now I can solve this in several ways (change the model name; make separate routes for all my admin actions, ...) but I was wondering if there's an elegant way to deal with custom url's that start with a controller/model name? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model Find With Conditions On Associated Models Not Working
I've seen similar questions raised but haven't found a solution that works. Perhaps it's because I'm new to CakePHP and don't fully understand unbindModel(), bindModel(), container behaviors, etc. Anyway, I'll start simple and take suggestions. I have the following models in which a Menu hasAndBelongsToMany Entree and hasMany MenuPosting, and a MenuPosting belongsTo Menu: class Menu extends AppModel { var $name = 'Menu'; var $hasAndBelongsToMany = 'Entree'; var $hasMany = array( 'MenuPosting' = array( 'dependent' = true ) ); } class MenuPosting extends AppModel { var $name = 'MenuPosting'; var $belongsTo = 'Menu'; } class Entree extends AppModel { var $name = 'Entree'; } In my MenusController I have a display_current() action to find all menus that are currently posted: class MenusController extends AppController { var $name = 'Menus'; function display_current() { // Limit the query results to the menu that is visible (i.e. is // currently posted) $conditions = array( 'MenuPosting.post_start =' = date('Y-m-d H:i:s', strtotime (now)), 'MenuPosting.post_end ' = date('Y-m-d H:i:s', strtotime(now)), ); // Find the menus that meets the conditions. $this-set('menu', $this-Menu-find('all', array('conditions' = $conditions))); } } The error I get from this is: Warning (512): SQL Error: 1054: Unknown column 'MenuPosting.post_start' in 'where clause' $sql= SELECT `Menu`.`id`, `Menu`.`old_id`, `Menu`.`created`, `Menu`.`modified`, `Menu`.`title` FROM `menus` AS `Menu` WHERE `MenuPosting`.`post_start` = '2008-12-06 22:02:57' AND `MenuPosting`.`post_end` '2008-12-06 22:02:57' If I remove the conditions from the find I am able to retrieve all Menu and associated Entree, so I believe I have set up my database tables correctly. Any suggestions? --~--~-~--~~~---~--~~ 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: simple write to database
Hi, try using $this-User-save($this-data['User']). The save function expects an array so that it can tell what db fields it can map the values to. Passing it $this-data['User']['about_me'] will only pass the value of about me, and cake doesn't know what to map it to. Hope that helps. mike wrote: I have a simple example below. I just want a form that saves stuff to the database. Its never getting to log test2 I guess the data is not in the right format but how am I supposed to do it? I've already spent a considerable amount of time debugging this and other problems, please help! thanks. CREATE TABLE users ( id int NOT NULL AUTO_INCREMENT, lastName varchar(255), firstName varchar(255), picture_id int, about_me varchar(255), PRIMARY KEY (id) ); here's the model: class User extends AppModel { // Its always good practice to include this variable. var $name = 'User'; // This is used for validation, see Chapter Data Validation. var $validate = array(); } controller: class NewuserController extends AppController { var $name = 'Newuser'; var $uses = Array('User'); function index() { } function add() { $this-log('in newuser_controller add()'); if(!empty($this-data)) { $this-log('test1'); //If the form data can be validated and saved... if($this-User-save($this-data['User']['about_me'])) { $this-log('test2'); //Set a session flash message and redirect. $this-Session-setFlash(User Saved!); $this-redirect('add'); } } } } View: ... form action=?php echo $html-url('/newuser/add'); ? method=post ? //echo $form-create('User'); ? FONT CLASS=text12nbsp;BRDescribe yourself/FONT ?php echo $html-textarea('User/about_me')? ?php echo $html-submit('Add'); ?br/ ? //echo $form-end('Add User'); ? /form --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
View Caching
I've been through the manual and APIs more times than I can count, and still have had no luck whatsoever getting view caching to work with 1.2, either on my local development box, or my server. I have an app/ tmp/cache directory that is 0777, I have Configure::write('Cache.check', true); Cache::config('default', array('engine' = 'File')); in core.php, and I have var $helpers=array('Cache'); var $cacheAction = 1 hour; in my controller. However, no file is created, and no error is thrown. What am I missing? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Question about security level and session when browser is closed
If the security level is set to medium and the browser is closed, the user session is not deleted. So when opening the browser again after a few minutes, the user still has access to the authorized pages without logging in again. My question is, if the browser is kept closed long enough, will the session eventually expire if the security level is medium? How long will it take? Would it be possible to adjust the duration when the session expires while keeping the same security level (medium)? --~--~-~--~~~---~--~~ 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: Ordering search results by best match
Have a look at sphinx, and the SphinxBehaviour on the bakery. Cheers, Adam On Dec 7, 7:22 am, Clay [EMAIL PROTECTED] wrote: My app has the following: Genus hasMany Species Species hasMany CommonName and the corresponding belongsTo relationships as well. Each of these models has a name field, and Genus and Species have several other fields. Say for example I have a Species Acer rubrum. This Species belongsTo Genus Acer and has a CommonName Red Maple. I want my users to be able to search the database for Red Maple and get as a result Species Acer rubrum (with the CommonName Red Maple highlighted to show that's what it matched. I can do this already. Yay. However if I have another Species with CommonName Bored Maple, I want to display this result too, but lower in the list than Red Maple. Since Bored comes before Red alphabetically I can't just order by CommonName.name to get the result I want. So what I know I could do is a series of finds: 1) Find exact match: CommonName.name = $searchStr 2) Find starting match: CommonName.name LIKE = $searchStr . '%' 3) Find internal match: CommonName.name LIKE = '%' . $searchStr . '%' And then merge them into my results array. However, this seems very inefficient. Is there a way I can use cake's find() function to do this all in one go while ordering them in order of best match? I have thought about this for quite some time and done some research but I can't seem to find any clever solution. I might be able to do a custom query with a bunch of SELECTs as above combined with UNION or something, but this would be a pretty complex query and not really much more efficient than what I already know how to do. Thanks in advance any genius here who has a solution! -Clay --~--~-~--~~~---~--~~ 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: View Caching
Maybe it was a typo, but view caches are stored inside tmp/cache/ views/ so make sure that directory is writable. Also, have you tried with debug = 0? Cheers, Adam On Dec 7, 5:44 pm, NickABusey [EMAIL PROTECTED] wrote: I've been through the manual and APIs more times than I can count, and still have had no luck whatsoever getting view caching to work with 1.2, either on my local development box, or my server. I have an app/ tmp/cache directory that is 0777, I have Configure::write('Cache.check', true); Cache::config('default', array('engine' = 'File')); in core.php, and I have var $helpers=array('Cache'); var $cacheAction = 1 hour; in my controller. However, no file is created, and no error is thrown. What am I missing? --~--~-~--~~~---~--~~ 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: Dynamic Navigation in a Layout. How?
Rob Wilkerson wrote: I'm so new to Cake that I'm honestly not even sure how to best ask this question (much less search to see whether it's been asked), so I'm going to describe what I have and allow the question of how best to achieve the result to be implied. I have a layout (my default layout) that includes 3 different navigation menus (primary, secondary, tertiary). Those menus are data driven - I have a nav_menus table that hasAndBelongsToMany nav_menu_items. I'd like to populate those menu instances dynamically in each place where they belong on the layout. I'd like to share the logic that will retrieve the items based on the menu and use that to output the expected markup: ul class=alternate-nav li class=firstHome/li liDirections/li li class=lastContact/li /ul I'm not sure where to look to get started. I have dug around some, but I haven't seen anything that seems to address this particular need in a way that I can digest it as such. Thanks. I got pulled away from this for a while, but I'm trying to get back to it so I wanted to revisit this question. validkeys suggested using a component, but the more I look at it the less it seems right (at least from a total n00b's perspective). I'm trying to insert data-driven output into a _layout_. If I use a component, then I'd have to specify the use of that component for every controller that uses that template. Is there not a more universal way to tell the template to include dynamic content? It seems like an element (provided I can figure out how to give it data access without breaking encapsulation) is the right way to go. Any thoughts? --~--~-~--~~~---~--~~ 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: simple write to database
Change if($this-User-save($this-data['User']['about_me'])) { to if($this-User-save($this-data)) { On Dec 6, 9:42 pm, mike [EMAIL PROTECTED] wrote: I have a simple example below. I just want a form that saves stuff to the database. Its never getting to log test2 I guess the data is not in the right format but how am I supposed to do it? I've already spent a considerable amount of time debugging this and other problems, please help! thanks. CREATE TABLE users ( id int NOT NULL AUTO_INCREMENT, lastName varchar(255), firstName varchar(255), picture_id int, about_me varchar(255), PRIMARY KEY (id) ); here's the model: class User extends AppModel { // Its always good practice to include this variable. var $name = 'User'; // This is used for validation, see Chapter Data Validation. var $validate = array(); } controller: class NewuserController extends AppController { var $name = 'Newuser'; var $uses = Array('User'); function index() { } function add() { $this-log('in newuser_controller add()'); if(!empty($this-data)) { $this-log('test1'); //If the form data can be validated and saved... if($this-User-save($this-data['User']['about_me'])) { $this-log('test2'); //Set a session flash message and redirect. $this-Session-setFlash(User Saved!); $this-redirect('add'); } } } } View: ... form action=?php echo $html-url('/newuser/add'); ? method=post ? //echo $form-create('User'); ? FONT CLASS=text12nbsp;BRDescribe yourself/FONT ?php echo $html-textarea('User/about_me')? ?php echo $html-submit('Add'); ?br/ ? //echo $form-end('Add User'); ? /form --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: admin routes prefix routing paginator problems..
You can play with $paginator in view: $paginator-options(array('prefix' ='')); $paginator-options(array('url' ='')); On Dec 7, 1:34 am, Andras Kende [EMAIL PROTECTED] wrote: Hello, Im trying to do an app with 3 areas admin routes which requires login /admin/ /nurse/ /practice/ routes.php: Router::connect(/admin/:controller/:action/*, array (prefix=admin, admin=true)); Router::connect(/nurse/:controller/:action/*, array (prefix=nurse, nurse=true)); Router::connect(/practice/:controller/:action/*, array (prefix=practice, practice=true)); all seems working, except pagination, paginator links look like: http://www.domain.com/calls/nurse_index/page:2 should be :http://www.domain.com/nurse/calls/index/page:2 tried to add more more routes like Router::connect(/admin/:controller/:action/*, array (prefix=admin)); Router::connect(/nurse/:controller/:action/*, array (prefix=nurse)); Router::connect(/practice/:controller/:action/*, array (prefix=practice)); but then it nurse index shows url ashttp://www.domain.com/admin/calls/index/page:2 , so somehow are overlapping.. Is there a way to construct the url correctly ? maybe from a controller ? Thank you, Andras --~--~-~--~~~---~--~~ 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: store i18n data in database
So, you are looking for web based editor of gettext files. I am not aware of anything what can be easily used in cake app, but fast googling told me there are some projects which one could learn from, like GGTT, phpTranslator, PHPTrans, Pootle... Do not blame me, if they will not suit your needs ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Instances of TinyMCE
anyone able to help? On Dec 6, 9:04 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: So I've been playing around with the TinyMCE Helper located in the bakery and so far it's been pretty awesome. However I do have one problem. In one of my areas there are two text boxes that need editing, and so I would like TinyMCE to control both text boxes. This is my code for that part of the form: echo $form-label('description', 'Description:'); echo $tinymce-input('description', array('label' = false, 'rows' = 20, 'cols' = 50)); echo $form-label('tech_description', 'Technical Description:'); echo $tinymce-input('tech_description', array('label' = false, 'rows' = 20, 'cols' = 50)); However, only the first text box gets TinyMCE, the other one gets reduced to a normal textarea box. So I am just wondering if anyone knows how to make it produce two TinyMCE boxes so I can have multiple instances of it. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Various named parameters
REF: http://book.cakephp.org/view/541/Named-parameters I would like to pass optional named variables into my controller to limit the data received from the database. (the variables shouldnt hve to be passed in any particular order and each variable passed is optional) $this-Game-find( 'all', array( 'conditions' = array( 'Game.name LIKE ' = '%'.$this-passedArgs['name'].'%', 'Game.released' = '%' + $this-passedArgs['released'] + '%', 'Game.date LIKE' = '%' + $this-passedArgs['date'] + '%', 'Esrb.name LIKE' = '%' + $this-passedArgs['esrb'] + '%' ) ) ) If all variables are passed this works fine, however if only a few are passed i get an error similar to this: Notice (8): Undefined index: released Is there something I am missing? Or is there a better method? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Sanity Check: Many-to-Many Relationship Not Saving
I have a simple many to many relationship scaffolded up that isn't working the way it should. I'm sure I'm missing something, but I can't see what that something is and could use a sanity check. I have NavMenu and NavMenuItem models. Each of those hasAndBelongsToMany of the other. In the database, I have a nav_menus table, a nav_menu_items table and the linking table, nav_menu_items_nav_menus. As far as I can tell, all of my naming conventions are correct. Each of the primary tables has a field named id and the linking table has the following fields: id, nav_menu_id, nav_menu_item_id. When I load the scaffolding page to edit a NavMenu (e.g. /nav_menus/ edit/4917839a-f064-447d-a492-0e733b196446), I see inputs for the NavMenu properties and I also see a listbox to select the appropriate menu items for the menu I'm editing. That would seem to indicate that Cake is seeing everything correct, but when I select a few menu items to be associated with the menu, the linking table isn't updated. All other NavMenu fields can be updated as expected. Obviously, this is my initial foray into CakePHP development, but I can't figure out what I've done to screw this up. Any help would be appreciated. Thanks. Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Instances of TinyMCE
I'm not sure what the helper you're talking about does, but all you need to do to get TinyMce to work is to reference the control you want it applied to with JavaScript like: script type=text/javascript src=your installation path/tiny_mce/ tiny_mce.js/script script type=text/javascript tinyMCE.init({ mode : textareas, theme : simple, editor_selector : mceSimple }); tinyMCE.init({ mode : textareas, theme : advanced, editor_selector : mceAdvanced }); /script form method=post action=somepage textarea name=content1 class=mceSimple style=width:100% /textarea textarea name=content2 class=mceAdvanced style=width:100% /textarea /form (From http://tinymce.moxiecode.com/examples/example_04.php) On Dec 7, 5:35 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: anyone able to help? On Dec 6, 9:04 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: So I've been playing around with the TinyMCE Helper located in the bakery and so far it's been pretty awesome. However I do have one problem. In one of my areas there are two text boxes that need editing, and so I would like TinyMCE to control both text boxes. This is my code for that part of the form: echo $form-label('description', 'Description:'); echo $tinymce-input('description', array('label' = false, 'rows' = 20, 'cols' = 50)); echo $form-label('tech_description', 'Technical Description:'); echo $tinymce-input('tech_description', array('label' = false, 'rows' = 20, 'cols' = 50)); However, only the first text box gets TinyMCE, the other one gets reduced to a normal textarea box. So I am just wondering if anyone knows how to make it produce two TinyMCE boxes so I can have multiple instances of it. --~--~-~--~~~---~--~~ 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: Dynamic Navigation in a Layout. How?
Elements are definitely the way to go. I make extensive use of elements for common display items. On the other hand, if you are just driving a common navigation, I'm not sure you need an element since it can just go directly into the layout. On Dec 7, 5:24 am, Rob Wilkerson [EMAIL PROTECTED] wrote: Rob Wilkerson wrote: I'm so new to Cake that I'm honestly not even sure how to best ask this question (much less search to see whether it's been asked), so I'm going to describe what I have and allow the question of how best to achieve the result to be implied. I have a layout (my default layout) that includes 3 different navigation menus (primary, secondary, tertiary). Those menus are data driven - I have a nav_menus table that hasAndBelongsToMany nav_menu_items. I'd like to populate those menu instances dynamically in each place where they belong on the layout. I'd like to share the logic that will retrieve the items based on the menu and use that to output the expected markup: ul class=alternate-nav li class=firstHome/li liDirections/li li class=lastContact/li /ul I'm not sure where to look to get started. I have dug around some, but I haven't seen anything that seems to address this particular need in a way that I can digest it as such. Thanks. I got pulled away from this for a while, but I'm trying to get back to it so I wanted to revisit this question. validkeys suggested using a component, but the more I look at it the less it seems right (at least from a total n00b's perspective). I'm trying to insert data-driven output into a _layout_. If I use a component, then I'd have to specify the use of that component for every controller that uses that template. Is there not a more universal way to tell the template to include dynamic content? It seems like an element (provided I can figure out how to give it data access without breaking encapsulation) is the right way to go. Any thoughts? --~--~-~--~~~---~--~~ 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: Dynamic Navigation in a Layout. How?
On Dec 7, 10:59 am, Rob [EMAIL PROTECTED] wrote: Elements are definitely the way to go. I make extensive use of elements for common display items. Okay, good. At least I'm not _way_ off base, then. Now, the follow-on question is this: how do I make an element data-driven? In my case, I'd want my element to have access to the NavMenu model in order to retrieve the items in any given menu. I haven't found much (read: anything) documented on this. On the other hand, if you are just driving a common navigation, I'm not sure you need an element since it can just go directly into the layout. Except that it's data-driven and exists with slight variations in 3 different locations within the layout. Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Instances of TinyMCE
yea, I was just hoping for something that would use the helper, as that's the entire reason why I have it. But if I have to do this then I guess I have to do it this way. I will try this out and see if it works, don't see why it wouldn't. On Dec 7, 9:55 am, Rob [EMAIL PROTECTED] wrote: I'm not sure what the helper you're talking about does, but all you need to do to get TinyMce to work is to reference the control you want it applied to with JavaScript like: script type=text/javascript src=your installation path/tiny_mce/ tiny_mce.js/script script type=text/javascript tinyMCE.init({ mode : textareas, theme : simple, editor_selector : mceSimple }); tinyMCE.init({ mode : textareas, theme : advanced, editor_selector : mceAdvanced}); /script form method=post action=somepage textarea name=content1 class=mceSimple style=width:100% /textarea textarea name=content2 class=mceAdvanced style=width:100% /textarea /form (Fromhttp://tinymce.moxiecode.com/examples/example_04.php) On Dec 7, 5:35 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: anyone able to help? On Dec 6, 9:04 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: So I've been playing around with the TinyMCE Helper located in the bakery and so far it's been pretty awesome. However I do have one problem. In one of my areas there are two text boxes that need editing, and so I would like TinyMCE to control both text boxes. This is my code for that part of the form: echo $form-label('description', 'Description:'); echo $tinymce-input('description', array('label' = false, 'rows' = 20, 'cols' = 50)); echo $form-label('tech_description', 'Technical Description:'); echo $tinymce-input('tech_description', array('label' = false, 'rows' = 20, 'cols' = 50)); However, only the first text box gets TinyMCE, the other one gets reduced to a normal textarea box. So I am just wondering if anyone knows how to make it produce two TinyMCE boxes so I can have multiple instances of it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Instances of TinyMCE
It appears to have worked, so I guess I will just end up doing it this way. Thanks for your help. On Dec 7, 10:24 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: yea, I was just hoping for something that would use the helper, as that's the entire reason why I have it. But if I have to do this then I guess I have to do it this way. I will try this out and see if it works, don't see why it wouldn't. On Dec 7, 9:55 am, Rob [EMAIL PROTECTED] wrote: I'm not sure what the helper you're talking about does, but all you need to do to get TinyMce to work is to reference the control you want it applied to with JavaScript like: script type=text/javascript src=your installation path/tiny_mce/ tiny_mce.js/script script type=text/javascript tinyMCE.init({ mode : textareas, theme : simple, editor_selector : mceSimple }); tinyMCE.init({ mode : textareas, theme : advanced, editor_selector : mceAdvanced}); /script form method=post action=somepage textarea name=content1 class=mceSimple style=width:100% /textarea textarea name=content2 class=mceAdvanced style=width:100% /textarea /form (Fromhttp://tinymce.moxiecode.com/examples/example_04.php) On Dec 7, 5:35 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: anyone able to help? On Dec 6, 9:04 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: So I've been playing around with the TinyMCE Helper located in the bakery and so far it's been pretty awesome. However I do have one problem. In one of my areas there are two text boxes that need editing, and so I would like TinyMCE to control both text boxes. This is my code for that part of the form: echo $form-label('description', 'Description:'); echo $tinymce-input('description', array('label' = false, 'rows' = 20, 'cols' = 50)); echo $form-label('tech_description', 'Technical Description:'); echo $tinymce-input('tech_description', array('label' = false, 'rows' = 20, 'cols' = 50)); However, only the first text box gets TinyMCE, the other one gets reduced to a normal textarea box. So I am just wondering if anyone knows how to make it produce two TinyMCE boxes so I can have multiple instances of it. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Handling user privacy settings in conjunction with ACL and Auth
I'm currently developing an application that relies heavily on user privacy. Firstly, I'm going to set-up an ACL that includes guests being able to view member's profiles and the website's homepage, but nothing else. Registered members would have access to the other areas, along with other ACL groups etc etc. However, my problem occurs when, for example, a SPECIFIC USER (i.e. NOT just an action in a controller) has decided to make their profile private (or even certain parts of their profile). What would be the best way to handle these privacy settings? My initial thought is to place all the access logic inside the beforeFilter() method, after all of the ACL and Auth logic. However, would this significantly affect database performance? In fact, is there a way for custom records to be handled through ACL? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Set:extract retaining the original id
Hello guys, I'm having some problem with the Set::extract feature of cakephp: Here is my array from $this-data that was already submitted: [User] = Array ( [User] = Array ( [1] = Array ( [0] = 3 ) [2] = Array ( [0] = 2 ) [3] = Array ( [0] = 4 ) ) ) and I want to have a result (array) like this: [User] = Array ( [User] = Array ( [1] = 3 [2] = 2 [3] = 4 ) ) However, when i do this: $this-data['User']['User'] = Set::extract($this-data['User'] ['User'], '{n}.0'); The result is always like this: [User] = Array ( [User] = Array ( [0] = 3 [1] = 2 [2] = 4 ) ) See the difference? Set:extract is always resetting (from zero and so on) the ids of the root array I'm trying to extract. I receive, [0] = 3 [1] = 2 [2] = 4 instead of what I want which is: [1] = 3 [2] = 2 [3] = 4 Please help. I really need the original ids for parsing purposes. Thanks, Mario --~--~-~--~~~---~--~~ 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: ORM, fetching related rows of corresponding model: undefined index..
MODEL answers.php ?php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = array( 'Question' = array( 'className'= 'Question' ) ); } ? Model questions.php ?php class Question extends AppModel { var $name = 'Question'; var $hasMany = array( 'Answer' = array( 'className' = 'Answer' ) ); } ? === On Dec 7, 11:00 am, thatsgreat2345 [EMAIL PROTECTED] wrote: Post your model code so we can see if you are doing your associations correctly, or if they are spelled correctly. On Dec 6, 9:50 pm, Tanay [EMAIL PROTECTED] wrote: it seems no relationships are working with my cakephp. has it got anything to do with my version of php5? i have got struck at this for a long time. help will be very greatly appreciated. here is the var_dump of $questions as seen in home.ctp array(2) { [0]= array(1) { [Question]= array(5) { [id]= string (1) 1 [question]= string(22) Why do you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:19:04 [modified]= string(19) 2008-02-11 22:19:04 } } [1]= array(1) { [Question]= array(5) { [id]= string(1) 2 [question]= string(25) Why won't you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:22:06 [modified]= string(19) 2008-02-11 22:22:06 } } } coresponding queries sql dump is DESCRIBE `questions` SELECT `Question`.`id`, `Question`.`question`, `Question`.`questioner`, `Question`.`created`, `Question`.`modified` FROM `questions` AS `Question` WHERE 1 = 1 On Dec 7, 1:47 am, thatsgreat2345 [EMAIL PROTECTED] wrote: I see you are using the Packt Publishing book, ensure that your model relations aren't misspelled or anything else it won't load the answers and thus won't exist, in the controller do a debug on the find, that or in the view do a pr($questions) before the foreach this will display the array and see what exactly what is in the array. On Dec 6, 9:40 am, Tanay [EMAIL PROTECTED] wrote: Tanay wrote: i have two dbs questions , and answers.. corresponding models questions has many answers answers belogns to questions in questions_controller, i have this home function function home() { $this-Question-recursive = 1; $this-set('questions', $this-Question-find('all')); } in my home.ctp, i tried to show the corresponding answers using the code below i took a question from an array of questions using foreach foreach question, $question['Answer'] is expected to give array of answers, but it says Undefined index: Answer THAT LIne is marked in code below home.ctp: ?php if(empty($questions)): ? p class=no_answerNo Questions yet. Be the first one to post a Question!/p ?php else: ? dl ?php foreach ($questions as $question): ? dtspan?php e($question['Question']['questioner']); ?/span/dt dd ?php e($html-link($question['Question']['question'] .'?', array('action' = 'show', $question['Question']['id']))); ? ?php $answer_count = count($question ['Answer']); // -ERROR HERE if(!$answer_count) e((no answers yet)); else if($answer_count == 1) e((1 answer)); else e((.$answer_count. answers)); ? /dd ?php endforeach; ? /dl ?php endif; ? the above code is a part of project in book CakePHP application Development, the code is same as in book is it due to some different version of cakephp that author used? i use latest 1.2 version . . . . . . Still the same. But now it says The new variable name $question['question']['answer'] is undefined index. --~--~-~--~~~---~--~~ 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: View Caching
That was not a typo, that's what I was missing. Thanks very much! On Dec 7, 5:09 am, Adam Royle [EMAIL PROTECTED] wrote: Maybe it was a typo, but view caches are stored inside tmp/cache/ views/ so make sure that directory is writable. Also, have you tried with debug = 0? Cheers, Adam On Dec 7, 5:44 pm, NickABusey [EMAIL PROTECTED] wrote: I've been through the manual and APIs more times than I can count, and still have had no luck whatsoever getting view caching to work with 1.2, either on my local development box, or my server. I have an app/ tmp/cache directory that is 0777, I have Configure::write('Cache.check', true); Cache::config('default', array('engine' = 'File')); in core.php, and I have var $helpers=array('Cache'); var $cacheAction = 1 hour; in my controller. However, no file is created, and no error is thrown. What am I missing? --~--~-~--~~~---~--~~ 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: Dynamic Navigation in a Layout. How?
What you need is indeed an element, and to query the database from inside an element you can use requestAction in it (that's what it's there for). It's explained here: http://book.cakephp.org/view/434/requestAction --~--~-~--~~~---~--~~ 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: Various named parameters
$conditions = array(); if (isset($this-passedArgs['released'])) { $conditions['Game.released'] = '%' + $this-passedArgs['released'] + '%'; } ... $this-Game-find('all', array('conditions' = $conditions)); You may want to sanitize. On Sun, Dec 7, 2008 at 7:16 AM, navilon [EMAIL PROTECTED] wrote: REF: http://book.cakephp.org/view/541/Named-parameters I would like to pass optional named variables into my controller to limit the data received from the database. (the variables shouldnt hve to be passed in any particular order and each variable passed is optional) $this-Game-find( 'all', array( 'conditions' = array( 'Game.name LIKE ' = '%'.$this-passedArgs['name'].'%', 'Game.released' = '%' + $this-passedArgs['released'] + '%', 'Game.date LIKE' = '%' + $this-passedArgs['date'] + '%', 'Esrb.name LIKE' = '%' + $this-passedArgs['esrb'] + '%' ) ) ) If all variables are passed this works fine, however if only a few are passed i get an error similar to this: Notice (8): Undefined index: released Is there something I am missing? Or is there a better method? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Dynamic Navigation in a Layout. How?
Just do a find on your NavMenu in the model you are driving your view from, and then you can access the data from your element. I do this on my site in my jobs view, where I want to display a couple differently filtered lists of job slots. I populate the lists into $userSlots and $availableSlots in my jobs_controller, then in my view, I use the same element to display them by passing in those two data sets: ?php if (isset($userSlots)):? h3?php __('You are signed up for');?/h3 ?php echo $this-element('signup_list', array( 'slots' = $userSlots )); ? ?php endif; ? h3?php __('Available Time Slots for '. $job['Job'] ['job_name']);?/h3 ?php if (isset($availableSlots)):? ?php echo $this-element('signup_list', array( 'slots' = $availableSlots )); ? ?php else: ? h3Nobody signed up for this job yet/h3 ?php endif; ? On Dec 7, 8:08 am, Rob Wilkerson [EMAIL PROTECTED] wrote: On Dec 7, 10:59 am, Rob [EMAIL PROTECTED] wrote: Elements are definitely the way to go. I make extensive use of elements for common display items. Okay, good. At least I'm not _way_ off base, then. Now, the follow-on question is this: how do I make an element data-driven? In my case, I'd want my element to have access to the NavMenu model in order to retrieve the items in any given menu. I haven't found much (read: anything) documented on this. On the other hand, if you are just driving a common navigation, I'm not sure you need an element since it can just go directly into the layout. Except that it's data-driven and exists with slight variations in 3 different locations within the layout. Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model Find With Conditions On Associated Models Not Working
You need a LEFT JOIN in your query. MenuPosting can't be in the WHERE clause. Perhaps if you post the actual SQL query you're aiming for we can figure out how to have Cake generate it. What are post_start post_end, anyway? On Sat, Dec 6, 2008 at 10:06 PM, erturne [EMAIL PROTECTED] wrote: I've seen similar questions raised but haven't found a solution that works. Perhaps it's because I'm new to CakePHP and don't fully understand unbindModel(), bindModel(), container behaviors, etc. Anyway, I'll start simple and take suggestions. I have the following models in which a Menu hasAndBelongsToMany Entree and hasMany MenuPosting, and a MenuPosting belongsTo Menu: class Menu extends AppModel { var $name = 'Menu'; var $hasAndBelongsToMany = 'Entree'; var $hasMany = array( 'MenuPosting' = array( 'dependent' = true ) ); } class MenuPosting extends AppModel { var $name = 'MenuPosting'; var $belongsTo = 'Menu'; } class Entree extends AppModel { var $name = 'Entree'; } In my MenusController I have a display_current() action to find all menus that are currently posted: class MenusController extends AppController { var $name = 'Menus'; function display_current() { // Limit the query results to the menu that is visible (i.e. is // currently posted) $conditions = array( 'MenuPosting.post_start =' = date('Y-m-d H:i:s', strtotime (now)), 'MenuPosting.post_end ' = date('Y-m-d H:i:s', strtotime(now)), ); // Find the menus that meets the conditions. $this-set('menu', $this-Menu-find('all', array('conditions' = $conditions))); } } The error I get from this is: Warning (512): SQL Error: 1054: Unknown column 'MenuPosting.post_start' in 'where clause' $sql= SELECT `Menu`.`id`, `Menu`.`old_id`, `Menu`.`created`, `Menu`.`modified`, `Menu`.`title` FROM `menus` AS `Menu` WHERE `MenuPosting`.`post_start` = '2008-12-06 22:02:57' AND `MenuPosting`.`post_end` '2008-12-06 22:02:57' If I remove the conditions from the find I am able to retrieve all Menu and associated Entree, so I believe I have set up my database tables correctly. Any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Instances of TinyMCE
I'd check with the author of the helper, or diagnose it yourself. Basically you just need each element to have a different class/id in order for TinyMCE to select it. On Dec 7, 8:55 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: It appears to have worked, so I guess I will just end up doing it this way. Thanks for your help. On Dec 7, 10:24 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: yea, I was just hoping for something that would use the helper, as that's the entire reason why I have it. But if I have to do this then I guess I have to do it this way. I will try this out and see if it works, don't see why it wouldn't. On Dec 7, 9:55 am, Rob [EMAIL PROTECTED] wrote: I'm not sure what the helper you're talking about does, but all you need to do to get TinyMce to work is to reference the control you want it applied to with JavaScript like: script type=text/javascript src=your installation path/tiny_mce/ tiny_mce.js/script script type=text/javascript tinyMCE.init({ mode : textareas, theme : simple, editor_selector : mceSimple }); tinyMCE.init({ mode : textareas, theme : advanced, editor_selector : mceAdvanced}); /script form method=post action=somepage textarea name=content1 class=mceSimple style=width:100% /textarea textarea name=content2 class=mceAdvanced style=width:100% /textarea /form (Fromhttp://tinymce.moxiecode.com/examples/example_04.php) On Dec 7, 5:35 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: anyone able to help? On Dec 6, 9:04 am, Arak Tai'Roth [EMAIL PROTECTED] wrote: So I've been playing around with the TinyMCE Helper located in the bakery and so far it's been pretty awesome. However I do have one problem. In one of my areas there are two text boxes that need editing, and so I would like TinyMCE to control both text boxes. This is my code for that part of the form: echo $form-label('description', 'Description:'); echo $tinymce-input('description', array('label' = false, 'rows' = 20, 'cols' = 50)); echo $form-label('tech_description', 'Technical Description:'); echo $tinymce-input('tech_description', array('label' = false, 'rows' = 20, 'cols' = 50)); However, only the first text box gets TinyMCE, the other one gets reduced to a normal textarea box. So I am just wondering if anyone knows how to make it produce two TinyMCE boxes so I can have multiple instances of it. --~--~-~--~~~---~--~~ 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: routes, controller name and model name
If you don't want to put an action before name-of-collection you'll need to create a route for each action, AFAIK. Router::connect('/showcases', array('controller' = 'showcases', 'action' = 'index')); Router::connect('/showcases/edit/*', array('controller' = 'showcases', 'action' = 'edit')); etc. Router::connect('/collections/:slug', array('controller' = 'collections', 'action' = 'view'), array('slug' = '[-_A-Za-z0-9]+') ); On Sun, Dec 7, 2008 at 5:56 AM, Filip Camerman [EMAIL PROTECTED] wrote: I'm making a site for an artist and when showing image galleries of art collections I want url's like www.site.com/collections/name-of-collection Now I also have a database table for collections, and hence a collection_controller and a collection model. First I had my routes like this - Router::connect('/collections/:action/*', array('controller' = 'collections')); - Router::connect('/collections/*', array('controller' = 'collections', 'action' = 'index')); I thought that the first route would only catch url's with existing actions, but instead it also caught my /collections/name-of- collection url's. So I changed it to: - Router::connect('/coll/:action/*', array('controller' = 'collections')); since the url's don't matter for my admin actions. But then I have to change my forms because ?= $form-create('Collection');? will post the form to /collections/... Now I can solve this in several ways (change the model name; make separate routes for all my admin actions, ...) but I was wondering if there's an elegant way to deal with custom url's that start with a controller/model name? --~--~-~--~~~---~--~~ 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: ORM, fetching related rows of corresponding model: undefined index..
Well based on your post, you are not getting the related model, and it appears you've only done a find on the Questions without setting recursive in your find('all'), try this: $this-set('questions', $this-Question-find('all', array ('recursive' = 1))); On Dec 7, 9:55 am, Tanay [EMAIL PROTECTED] wrote: MODEL answers.php ?php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = array( 'Question' = array( 'className' = 'Question' ) ); } ? Model questions.php ?php class Question extends AppModel { var $name = 'Question'; var $hasMany = array( 'Answer' = array( 'className' = 'Answer' ) ); } ? === On Dec 7, 11:00 am, thatsgreat2345 [EMAIL PROTECTED] wrote: Post your model code so we can see if you are doing your associations correctly, or if they are spelled correctly. On Dec 6, 9:50 pm, Tanay [EMAIL PROTECTED] wrote: it seems no relationships are working with my cakephp. has it got anything to do with my version of php5? i have got struck at this for a long time. help will be very greatly appreciated. here is the var_dump of $questions as seen in home.ctp array(2) { [0]= array(1) { [Question]= array(5) { [id]= string (1) 1 [question]= string(22) Why do you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:19:04 [modified]= string(19) 2008-02-11 22:19:04 } } [1]= array(1) { [Question]= array(5) { [id]= string(1) 2 [question]= string(25) Why won't you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:22:06 [modified]= string(19) 2008-02-11 22:22:06 } } } coresponding queries sql dump is DESCRIBE `questions` SELECT `Question`.`id`, `Question`.`question`, `Question`.`questioner`, `Question`.`created`, `Question`.`modified` FROM `questions` AS `Question` WHERE 1 = 1 On Dec 7, 1:47 am, thatsgreat2345 [EMAIL PROTECTED] wrote: I see you are using the Packt Publishing book, ensure that your model relations aren't misspelled or anything else it won't load the answers and thus won't exist, in the controller do a debug on the find, that or in the view do a pr($questions) before the foreach this will display the array and see what exactly what is in the array. On Dec 6, 9:40 am, Tanay [EMAIL PROTECTED] wrote: Tanay wrote: i have two dbs questions , and answers.. corresponding models questions has many answers answers belogns to questions in questions_controller, i have this home function function home() { $this-Question-recursive = 1; $this-set('questions', $this-Question-find('all')); } in my home.ctp, i tried to show the corresponding answers using the code below i took a question from an array of questions using foreach foreach question, $question['Answer'] is expected to give array of answers, but it says Undefined index: Answer THAT LIne is marked in code below home.ctp: ?php if(empty($questions)): ? p class=no_answerNo Questions yet. Be the first one to post a Question!/p ?php else: ? dl ?php foreach ($questions as $question): ? dtspan?php e($question['Question']['questioner']); ?/span/dt dd ?php e($html-link($question['Question']['question'] .'?', array('action' = 'show', $question['Question']['id']))); ? ?php $answer_count = count($question ['Answer']); // -ERROR HERE if(!$answer_count) e((no answers yet)); else if($answer_count == 1) e((1 answer)); else e((.$answer_count. answers)); ? /dd ?php endforeach; ? /dl ?php endif; ? the above code is a part of project in book CakePHP application Development, the code is same as in book is it due to some different version of cakephp that author used? i use latest 1.2 version . . . . . . Still the same. But now it says The new variable name $question['question']['answer'] is undefined index. --~--~-~--~~~---~--~~ 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: Well formed XML for RESTful web services ...
Maybe this will help you: http://www.firephp.org/Wiki/Libraries/CakePHP On Dec 7, 4:32 am, Rob [EMAIL PROTECTED] wrote: No, I don't expect Cake to format the output at all since we are doing MVC. I want to use the debug output without it affecting my HTTP stream. The bug/problem is that if debug 1, the content type gets flipped to text/html, and the SQL debug gets appended to the XML (after the end of the HTML because it's being output directly from the dbo_source.php If we're truly doing MVC, there should never be debug information going directly to the view, and the debug information should be accessible in the model to the controller so we can decide how to deal with it. Say for instance I have debug set to 1 to catch errors. Now in my controller code, I have to turn off debug for XML, so I don't get any chance to catch those errors, which may or may not need to be dealt with. I know the workaround is to detect that I'm doing XML and set debug to 0, but that doesn't help in development in any way. Formatting the debug data and spitting it into the view like it does is violating the MVC design (while it is nice when you're debugging HTML). On Dec 6, 6:31 pm, James K [EMAIL PROTECTED] wrote: Not sure I understand the problem. Do you expect Cake to format it's debug information based on the content type? It's debug information - it's meant for debugging. You can type Configure::write('debug', 0) at the top of any action in order to lower the debug level selectively per action without having to shut if off for the entire app. I have lots of views in a particular application that return XML or JSON, and of course having debug info at the bottom of that response will break those requests. Once I confirm the response is returning correctly formatted XML or JSON, I turn the debugging off for that action and only turn it back on in that action in the event I need to debug :P Good luck, James On Dec 6, 6:24 pm, Rob [EMAIL PROTECTED] wrote: I'll probably get no response or flames telling me to just set debug to 1, but I've set up my VolunteerCake code to be a RESTful web service by using the Router::parseExtensions() and Router::mapResources() magic. This works fine as long as debug is not greater than 1. When debug is greater than 1 however, the XML that gets returned is broken due to problems with the way the SQL debug is spit out. I traced this down to a call In the close() function of dbo_source.php, to showLog() which spits out the SQL in an HTML table I call the web service and get the XML as expected. The closing XML is followed by the dump of the SQL like: /VolunteerCake!-- 0.9699s --table class=cake-sql-log id=cakeSqlLog_1228604311493b0397a19568_61229664 summary=Cake SQL Log cellspacing=0 border = 0 caption(default) 36 queries took 127 ms/caption Other web service tools I've worked with operate by giving you access to the debug data so you can spit it out as part of the XML if you want to, so you end up with something like: VolunteerCakemyDatanon-debug data/myDatadebugdebug data (usually wrapped in a CDATA)/debug/myData/VolunteerCake Ideally Cake shouldn't be changing the content-type and spitting out HTML after the well-formed document has been created anyway. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can/Should I use 1.2RC3 in a production environment
HI, cake noob here. I know 1.2 isn't stable yet, but does anyone have any experience or advice wrt usin 1.2RC3 in a production environment? We are migrating a Perl CGI project over to Cake and first decided to use 1.1 because of the stable tag on it. But if 1.2 is going stable in January/early '09, should we develop on it? I only want to do TDD work and have read that using Simpletest in 1.1 is problematic. Thanks Ed --~--~-~--~~~---~--~~ 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: Custom Helper not Working
gervOsh, Thanks for replying. I do have the PHP tags I just didn't post them on my code. The complete code looks like this: ?php class ElapsedHelper extends AppHelper { function test(){ return $this-output('test'); } } ? On Dec 6, 9:04 pm, gearvOsh [EMAIL PROTECTED] wrote: Missing php open/close tags? On Dec 6, 1:00 pm, Sapslabs [EMAIL PROTECTED] wrote: I am creating a custom helper like this class ElapsedHelper extends AppHelper { function test(){ return $this-output('test'); } } Which is save under views/helpers/elapsed.php I am including this on my controller using var $helpers = array('Elapsed'); but when I try it I get this error: class ElapsedHelper extends AppHelper { function test(){ return $this-output('test');} } Missing Helper Class Error: The helper class ElapsedHelper can not be found or does not exist. Error: Create the class below in file: www/views/helpers/elapsed.php ?php class ElapsedHelper extends AppHelper { } ? Any idea on what I am doing wrong? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Can/Should I use 1.2RC3 in a production environment
1.2 unstable, where did you get that from? On Dec 7, 9:59 am, Ed Howland [EMAIL PROTECTED] wrote: HI, cake noob here. I know 1.2 isn't stable yet, but does anyone have any experience or advice wrt usin 1.2RC3 in a production environment? We are migrating a Perl CGI project over to Cake and first decided to use 1.1 because of the stable tag on it. But if 1.2 is going stable in January/early '09, should we develop on it? I only want to do TDD work and have read that using Simpletest in 1.1 is problematic. Thanks Ed --~--~-~--~~~---~--~~ 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: Can/Should I use 1.2RC3 in a production environment
Despite being in RC3 I already use it in some productions projects without any problems. It may have some bugs in some features but the main 1.2 core is stable enough to start development. And 1.2 is a big evolution over 1.1 version. On Dec 7, 5:59 pm, Ed Howland [EMAIL PROTECTED] wrote: HI, cake noob here. I know 1.2 isn't stable yet, but does anyone have any experience or advice wrt usin 1.2RC3 in a production environment? We are migrating a Perl CGI project over to Cake and first decided to use 1.1 because of the stable tag on it. But if 1.2 is going stable in January/early '09, should we develop on it? I only want to do TDD work and have read that using Simpletest in 1.1 is problematic. Thanks Ed --~--~-~--~~~---~--~~ 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: Can/Should I use 1.2RC3 in a production environment
Thanks to all. That gives me comfort esp. wrt to unit testing. Ed On Sun, Dec 7, 2008 at 2:02 PM, lightglitch [EMAIL PROTECTED] wrote: Despite being in RC3 I already use it in some productions projects without any problems. It may have some bugs in some features but the main 1.2 core is stable enough to start development. And 1.2 is a big evolution over 1.1 version. On Dec 7, 5:59 pm, Ed Howland [EMAIL PROTECTED] wrote: HI, cake noob here. I know 1.2 isn't stable yet, but does anyone have any experience or advice wrt usin 1.2RC3 in a production environment? We are migrating a Perl CGI project over to Cake and first decided to use 1.1 because of the stable tag on it. But if 1.2 is going stable in January/early '09, should we develop on it? I only want to do TDD work and have read that using Simpletest in 1.1 is problematic. Thanks Ed -- Ed Howland http://greenprogrammer.blogspot.com http://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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: Can/Should I use 1.2RC3 in a production environment
For the last 6 months or so, most of the changes made to the 1.2 core code have been with regards to test coverage. Very little (if any) of the most commonly used API has changed, and I think the developers have been pretty clear that not much will change either. For the most part, websites I put together in March 2008 still function perfectly fine with the latest version of the core code. Upgrading from 1.1 to 1.2, however, does require a bit of work, because of the changes made to the way the HTML helper forms work. Also, so many more people are focused on 1.2, that if there are any major vulnerabilities or performance problems discovered, they will be found quickly making its use relatively safe from a project management standpoint. -Aran On Dec 7, 12:26 pm, Ed Howland [EMAIL PROTECTED] wrote: Thanks to all. That gives me comfort esp. wrt to unit testing. Ed On Sun, Dec 7, 2008 at 2:02 PM, lightglitch [EMAIL PROTECTED] wrote: Despite being in RC3 I already use it in some productions projects without any problems. It may have some bugs in some features but the main 1.2 core is stable enough to start development. And 1.2 is a big evolution over 1.1 version. On Dec 7, 5:59 pm, Ed Howland [EMAIL PROTECTED] wrote: HI, cake noob here. I know 1.2 isn't stable yet, but does anyone have any experience or advice wrt usin 1.2RC3 in a production environment? We are migrating a Perl CGI project over to Cake and first decided to use 1.1 because of the stable tag on it. But if 1.2 is going stable in January/early '09, should we develop on it? I only want to do TDD work and have read that using Simpletest in 1.1 is problematic. Thanks Ed -- Ed Howlandhttp://greenprogrammer.blogspot.comhttp://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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: Ordering search results by best match
I searched for sphinx at the bakery and found nothing Adam, do you have a direct link? THANKS! -John On Dec 7, 7:05 am, Adam Royle [EMAIL PROTECTED] wrote: Have a look at sphinx, and the SphinxBehaviour on the bakery. Cheers, Adam On Dec 7, 7:22 am, Clay [EMAIL PROTECTED] wrote: My app has the following: Genus hasMany Species Species hasMany CommonName and the corresponding belongsTo relationships as well. Each of these models has a name field, and Genus and Species have several other fields. Say for example I have a Species Acer rubrum. This Species belongsTo Genus Acer and has a CommonName Red Maple. I want my users to be able to search the database for Red Maple and get as a result Species Acer rubrum (with the CommonName Red Maple highlighted to show that's what it matched. I can do this already. Yay. However if I have another Species with CommonName Bored Maple, I want to display this result too, but lower in the list than Red Maple. Since Bored comes before Red alphabetically I can't just order by CommonName.name to get the result I want. So what I know I could do is a series of finds: 1) Find exact match: CommonName.name = $searchStr 2) Find starting match: CommonName.name LIKE = $searchStr . '%' 3) Find internal match: CommonName.name LIKE = '%' . $searchStr . '%' And then merge them into my results array. However, this seems very inefficient. Is there a way I can use cake's find() function to do this all in one go while ordering them in order of best match? I have thought about this for quite some time and done some research but I can't seem to find any clever solution. I might be able to do a custom query with a bunch of SELECTs as above combined with UNION or something, but this would be a pretty complex query and not really much more efficient than what I already know how to do. Thanks in advance any genius here who has a solution! -Clay --~--~-~--~~~---~--~~ 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: Model Find With Conditions On Associated Models Not Working
On Dec 7, 1:54 pm, brian [EMAIL PROTECTED] wrote: You need a LEFT JOIN in your query. MenuPosting can't be in the WHERE clause. Perhaps if you post the actual SQL query you're aiming for we can figure out how to have Cake generate it. Essentially I want information about menus and the entrees on them. Something like: SELECT Menus.title, Entrees.name FROM menus Menus INNER JOIN entrees_menus EntreesMenus ON EntreesMenus.menu_id=Menus.id INNER JOIN entrees Entrees ON EntreesMenus.entree_id=Entrees.id INNER JOIN menu_postings MenuPostings ON MenuPostings.menu_id=Menus.id WHERE MenuPostings.post_start = NOW() AND MenuPostings.post_end NOW (); Of course I'll eventually want more than just the menu title and entree names, but that's good enough for now. I don't think LEFT JOIN is correct for what I need because I'm not interested in a menu without entrees! INNER JOIN is the way to go here. Not sure if we can make CakePHP do that using find() or Containable or unbindModel()/bindModel(). I'm definitely open to suggestions. What are post_start post_end, anyway? Records in the menu_postings table define when each menu is visible on the website. We might have a particular menu visible on the website at various times throughout the year (defined by post_start and post_end). On Sat, Dec 6, 2008 at 10:06 PM, erturne [EMAIL PROTECTED] wrote: I've seen similar questions raised but haven't found a solution that works. Perhaps it's because I'm new to CakePHP and don't fully understand unbindModel(), bindModel(), container behaviors, etc. Anyway, I'll start simple and take suggestions. I have the following models in which a Menu hasAndBelongsToMany Entree and hasMany MenuPosting, and a MenuPosting belongsTo Menu: class Menu extends AppModel { var $name = 'Menu'; var $hasAndBelongsToMany = 'Entree'; var $hasMany = array( 'MenuPosting' = array( 'dependent' = true ) ); } class MenuPosting extends AppModel { var $name = 'MenuPosting'; var $belongsTo = 'Menu'; } class Entree extends AppModel { var $name = 'Entree'; } In my MenusController I have a display_current() action to find all menus that are currently posted: class MenusController extends AppController { var $name = 'Menus'; function display_current() { // Limit the query results to the menu that is visible (i.e. is // currently posted) $conditions = array( 'MenuPosting.post_start =' = date('Y-m-d H:i:s', strtotime (now)), 'MenuPosting.post_end ' = date('Y-m-d H:i:s', strtotime(now)), ); // Find the menus that meets the conditions. $this-set('menu', $this-Menu-find('all', array('conditions' = $conditions))); } } The error I get from this is: Warning (512): SQL Error: 1054: Unknown column 'MenuPosting.post_start' in 'where clause' $sql = SELECT `Menu`.`id`, `Menu`.`old_id`, `Menu`.`created`, `Menu`.`modified`, `Menu`.`title` FROM `menus` AS `Menu` WHERE `MenuPosting`.`post_start` = '2008-12-06 22:02:57' AND `MenuPosting`.`post_end` '2008-12-06 22:02:57' If I remove the conditions from the find I am able to retrieve all Menu and associated Entree, so I believe I have set up my database tables correctly. Any suggestions? --~--~-~--~~~---~--~~ 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: API documentation tool
It's doxygen :) 2008/12/5 Olivier Percebois-Garve [EMAIL PROTECTED]: yeah after some research it seems to be doxygen. thx. Dont forgot to have a nice weekend. Olivier On Fri, Dec 5, 2008 at 2:29 PM, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: Good point... probably Doxygen then..seems like it (look at the examples on Doxygen site, especially the tabs).. On Dec 5, 2:14 pm, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: But it looks visually so different to what I know from phpDocumentor. No left column, etc... On Fri, Dec 5, 2008 at 1:47 PM, dr. Hannibal Lecter [EMAIL PROTECTED]wrote: I'm not sure on this, but I believe it could be phpDocumentor (http:// phpdoc.org/)? On Dec 5, 1:03 pm, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Hi What is used to generate the API doc of cakephp ? thanks Olivier -- Att, Everton Yoshitani --~--~-~--~~~---~--~~ 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: Model Find With Conditions On Associated Models Not Working
I misinterpreted MenuPostings. I thought it was a table of comments or something like that. So, it seems that, though there may be many MenuPostings for a particularMenu, only a single one is really active at a given time. Is that the case? If so, why not just add columns post_start post_end to the menus table and modify them whenever the posting dates for a menu need to be changed? That would make your query much simpler. On Sun, Dec 7, 2008 at 5:27 PM, erturne [EMAIL PROTECTED] wrote: On Dec 7, 1:54 pm, brian [EMAIL PROTECTED] wrote: You need a LEFT JOIN in your query. MenuPosting can't be in the WHERE clause. Perhaps if you post the actual SQL query you're aiming for we can figure out how to have Cake generate it. Essentially I want information about menus and the entrees on them. Something like: SELECT Menus.title, Entrees.name FROM menus Menus INNER JOIN entrees_menus EntreesMenus ON EntreesMenus.menu_id=Menus.id INNER JOIN entrees Entrees ON EntreesMenus.entree_id=Entrees.id INNER JOIN menu_postings MenuPostings ON MenuPostings.menu_id=Menus.id WHERE MenuPostings.post_start = NOW() AND MenuPostings.post_end NOW (); Of course I'll eventually want more than just the menu title and entree names, but that's good enough for now. I don't think LEFT JOIN is correct for what I need because I'm not interested in a menu without entrees! INNER JOIN is the way to go here. Not sure if we can make CakePHP do that using find() or Containable or unbindModel()/bindModel(). I'm definitely open to suggestions. What are post_start post_end, anyway? Records in the menu_postings table define when each menu is visible on the website. We might have a particular menu visible on the website at various times throughout the year (defined by post_start and post_end). On Sat, Dec 6, 2008 at 10:06 PM, erturne [EMAIL PROTECTED] wrote: I've seen similar questions raised but haven't found a solution that works. Perhaps it's because I'm new to CakePHP and don't fully understand unbindModel(), bindModel(), container behaviors, etc. Anyway, I'll start simple and take suggestions. I have the following models in which a Menu hasAndBelongsToMany Entree and hasMany MenuPosting, and a MenuPosting belongsTo Menu: class Menu extends AppModel { var $name = 'Menu'; var $hasAndBelongsToMany = 'Entree'; var $hasMany = array( 'MenuPosting' = array( 'dependent' = true ) ); } class MenuPosting extends AppModel { var $name = 'MenuPosting'; var $belongsTo = 'Menu'; } class Entree extends AppModel { var $name = 'Entree'; } In my MenusController I have a display_current() action to find all menus that are currently posted: class MenusController extends AppController { var $name = 'Menus'; function display_current() { // Limit the query results to the menu that is visible (i.e. is // currently posted) $conditions = array( 'MenuPosting.post_start =' = date('Y-m-d H:i:s', strtotime (now)), 'MenuPosting.post_end ' = date('Y-m-d H:i:s', strtotime(now)), ); // Find the menus that meets the conditions. $this-set('menu', $this-Menu-find('all', array('conditions' = $conditions))); } } The error I get from this is: Warning (512): SQL Error: 1054: Unknown column 'MenuPosting.post_start' in 'where clause' $sql= SELECT `Menu`.`id`, `Menu`.`old_id`, `Menu`.`created`, `Menu`.`modified`, `Menu`.`title` FROM `menus` AS `Menu` WHERE `MenuPosting`.`post_start` = '2008-12-06 22:02:57' AND `MenuPosting`.`post_end` '2008-12-06 22:02:57' If I remove the conditions from the find I am able to retrieve all Menu and associated Entree, so I believe I have set up my database tables correctly. Any suggestions? --~--~-~--~~~---~--~~ 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: Ordering search results by best match
I guess it is pending approval but here is a cached version from google http://209.85.173.132/search?q=cache:NzoXH-E2eZwJ:bakery.cakephp.org/articles/view/sphinx-behavior+SphinxBehavior+cakephphl=enct=clnkcd=1gl=usclient=firefox-a On Dec 7, 2:23 pm, Johnathan Henderson [EMAIL PROTECTED] wrote: I searched for sphinx at the bakery and found nothing Adam, do you have a direct link? THANKS! -John On Dec 7, 7:05 am, Adam Royle [EMAIL PROTECTED] wrote: Have a look at sphinx, and the SphinxBehaviour on the bakery. Cheers, Adam On Dec 7, 7:22 am, Clay [EMAIL PROTECTED] wrote: My app has the following: Genus hasMany Species Species hasMany CommonName and the corresponding belongsTo relationships as well. Each of these models has a name field, and Genus and Species have several other fields. Say for example I have a Species Acer rubrum. This Species belongsTo Genus Acer and has a CommonName Red Maple. I want my users to be able to search the database for Red Maple and get as a result Species Acer rubrum (with the CommonName Red Maple highlighted to show that's what it matched. I can do this already. Yay. However if I have another Species with CommonName Bored Maple, I want to display this result too, but lower in the list than Red Maple. Since Bored comes before Red alphabetically I can't just order by CommonName.name to get the result I want. So what I know I could do is a series of finds: 1) Find exact match: CommonName.name = $searchStr 2) Find starting match: CommonName.name LIKE = $searchStr . '%' 3) Find internal match: CommonName.name LIKE = '%' . $searchStr . '%' And then merge them into my results array. However, this seems very inefficient. Is there a way I can use cake's find() function to do this all in one go while ordering them in order of best match? I have thought about this for quite some time and done some research but I can't seem to find any clever solution. I might be able to do a custom query with a bunch of SELECTs as above combined with UNION or something, but this would be a pretty complex query and not really much more efficient than what I already know how to do. Thanks in advance any genius here who has a solution! -Clay --~--~-~--~~~---~--~~ 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: Can/Should I use 1.2RC3 in a production environment
On Sun, Dec 7, 2008 at 4:09 PM, aranworld [EMAIL PROTECTED] wrote: For the last 6 months or so, most of the changes made to the 1.2 core code have been with regards to test coverage. Very little (if any) of the most commonly used API has changed, and I think the developers have been pretty clear that not much will change either. For the most part, websites I put together in March 2008 still function perfectly fine with the latest version of the core code. Upgrading from 1.1 to 1.2, however, does require a bit of work, Since this project is Greenfield, it shouldn't be a problem. All I have now is the login page, home page and various user add,edit, list stuff. Did note the file extension changed from .thtml to .ctp. because of the changes made to the way the HTML helper forms work. Also, so many more people are focused on 1.2, that if there are any major vulnerabilities or performance problems discovered, they will be found quickly making its use relatively safe from a project management standpoint. Also most of the on-line discussion seems to assume 1.2. With the release being nearly 2 years old, I;d say it is mature enough for our use. After all I'm writing this on GMail(beta)! Thanks Ed -- Ed Howland http://greenprogrammer.blogspot.com http://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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 can I view the screencasts on Linux
I am having trouble playing the screencasts on the cakephp.org site. I am using Ubuntu 8.10 w/FF. Does anyone have any suggestions? Thanks Ed -- Ed Howland http://greenprogrammer.blogspot.com http://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
saving into multiple table with multiple data
i have 5 tables like these 1). purchases 2). purchase_details - purchase_id - item_id 3). items 4). purchase_item_details - purchase_detail_id - item_detail_id 5). item_details - item_id in an action, i have to do more than one save action. rule 1). save data into purchases 2). get last insert id from table purchases 3). save data into items 4). get last insert id from table items 5). save data into purchase_details with those two variables ( purchase_id item_id ) 6). get last insert id from table purchase_details 7). save data into item_details with item_id 8). get last insert id from table item_details 9). save data into purchase_item_detail with those two variables ( purchase_detail_id item_detail_id ) so.. i get a problem at rule #3... it cannot save, dont know why, i have no error message at my web items table CREATE TABLE IF NOT EXISTS `items` ( `id` int(11) NOT NULL auto_increment, `item_type_id` int(11) NOT NULL, `item_brand_type_id` int(11) NOT NULL, `desc` text NOT NULL, `info` text NOT NULL, `default_price` int(11) NOT NULL, `entry_date` date NOT NULL, `entry_by` int(11) NOT NULL, `update_date` date NOT NULL, `update_by` int(11) NOT NULL, `f_expired` enum('t','f') NOT NULL, `f_return` enum('t','f') NOT NULL, `f_active` enum('t','f') NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model Find With Conditions On Associated Models Not Working
On Dec 7, 5:48 pm, brian [EMAIL PROTECTED] wrote: I misinterpreted MenuPostings. I thought it was a table of comments or something like that. So, it seems that, though there may be many MenuPostings for a particularMenu, only a single one is really active at a given time. Is that the case? If so, why not just add columns post_start post_end to the menus table and modify them whenever the posting dates for a menu need to be changed? That would make your query much simpler. They want to set up their menu schedule ahead of time, and not have to remember to set the next posting each time one expires. I can also envision other situations like this in other applications, and as this is my first Cake app I'd like to learn what the limitations of the technology are. In this case I COULD attack the problem from a different angle, starting with MenuPosting rather than Menu so that I can specify conditions on the post_start and post_end, but I don't like the idea changing simply because I don't understand how to make it work the way I want to. I'd really like to find out if it's possible to do what I want (obtain menus filtered based on the criteria of an associated model). Or if it's not possible, why. On Sun, Dec 7, 2008 at 5:27 PM, erturne [EMAIL PROTECTED] wrote: On Dec 7, 1:54 pm, brian [EMAIL PROTECTED] wrote: You need a LEFT JOIN in your query. MenuPosting can't be in the WHERE clause. Perhaps if you post the actual SQL query you're aiming for we can figure out how to have Cake generate it. Essentially I want information about menus and the entrees on them. Something like: SELECT Menus.title, Entrees.name FROM menus Menus INNER JOIN entrees_menus EntreesMenus ON EntreesMenus.menu_id=Menus.id INNER JOIN entrees Entrees ON EntreesMenus.entree_id=Entrees.id INNER JOIN menu_postings MenuPostings ON MenuPostings.menu_id=Menus.id WHERE MenuPostings.post_start = NOW() AND MenuPostings.post_end NOW (); Of course I'll eventually want more than just the menu title and entree names, but that's good enough for now. I don't think LEFT JOIN is correct for what I need because I'm not interested in a menu without entrees! INNER JOIN is the way to go here. Not sure if we can make CakePHP do that using find() or Containable or unbindModel()/bindModel(). I'm definitely open to suggestions. What are post_start post_end, anyway? Records in the menu_postings table define when each menu is visible on the website. We might have a particular menu visible on the website at various times throughout the year (defined by post_start and post_end). On Sat, Dec 6, 2008 at 10:06 PM, erturne [EMAIL PROTECTED] wrote: I've seen similar questions raised but haven't found a solution that works. Perhaps it's because I'm new to CakePHP and don't fully understand unbindModel(), bindModel(), container behaviors, etc. Anyway, I'll start simple and take suggestions. I have the following models in which a Menu hasAndBelongsToMany Entree and hasMany MenuPosting, and a MenuPosting belongsTo Menu: class Menu extends AppModel { var $name = 'Menu'; var $hasAndBelongsToMany = 'Entree'; var $hasMany = array( 'MenuPosting' = array( 'dependent' = true ) ); } class MenuPosting extends AppModel { var $name = 'MenuPosting'; var $belongsTo = 'Menu'; } class Entree extends AppModel { var $name = 'Entree'; } In my MenusController I have a display_current() action to find all menus that are currently posted: class MenusController extends AppController { var $name = 'Menus'; function display_current() { // Limit the query results to the menu that is visible (i.e. is // currently posted) $conditions = array( 'MenuPosting.post_start =' = date('Y-m-d H:i:s', strtotime (now)), 'MenuPosting.post_end ' = date('Y-m-d H:i:s', strtotime(now)), ); // Find the menus that meets the conditions. $this-set('menu', $this-Menu-find('all', array('conditions' = $conditions))); } } The error I get from this is: Warning (512): SQL Error: 1054: Unknown column 'MenuPosting.post_start' in 'where clause' $sql = SELECT `Menu`.`id`, `Menu`.`old_id`, `Menu`.`created`, `Menu`.`modified`, `Menu`.`title` FROM `menus` AS `Menu` WHERE `MenuPosting`.`post_start` = '2008-12-06 22:02:57' AND `MenuPosting`.`post_end` '2008-12-06 22:02:57' If I remove the conditions from the find I am able to retrieve all Menu and associated Entree, so I believe I have set up my database tables correctly. Any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups
Auth-login() Not working correctly?
So im trying to get the Auth component to work, here is my AppController. function beforeFilter() { // Referer $referer = $this-referer(null, true); if (empty($referer)) { $referer = array('controller' = 'dashboard', 'action' = 'index'); } // Authenticate if (isset($this-Auth)) { $this-Auth-sessionKey = 'User'; //$this-Auth-authorize = 'controller'; $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = $referer; $this-Auth-logoutRedirect = array('controller' = 'site', 'action' = 'index', 'home'); } } That all works fine, its just when I submit my login form (users/ login), the password field does not get encrypted, so it never finds any rows. I read the docs and it said that it should auto-encrypt any field named password, obviously its not. Login action: // Form processing if (!empty($this-data)) { $this-Auth-login($this-data['Form']); } --~--~-~--~~~---~--~~ 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: Auth-login() Not working correctly?
Also heres a debug of $this-data: Array ( [Form] = Array ( [username] = test123 [password] = pass123 ) ) And the query being run by $this-Auth-login(): SELECT `User`.`id`, `User`.`username`, `User`.`password` FROM `users` AS `User` WHERE `User`.`username` = 'test123' AND `User`.`password` = 'pass123' LIMIT 1 --~--~-~--~~~---~--~~ 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: Auth-login() Not working correctly?
try not putting anything in the login action. It does what you are trying to do automatically. You also don't need to redirect to the referrer as the Auth component stores this automatically. The Auth component also looks for logout in a new action logout. Thats where to put your redirect. Also make sure the password you stored in your database is the hashed version. You can view a hash result by putting echo $this-Auth- password(password string here); in an action. On Dec 7, 2008, at 6:15 PM, gearvOsh wrote: So im trying to get the Auth component to work, here is my AppController. function beforeFilter() { // Referer $referer = $this-referer(null, true); if (empty($referer)) { $referer = array('controller' = 'dashboard', 'action' = 'index'); } // Authenticate if (isset($this-Auth)) { $this-Auth-sessionKey = 'User'; //$this-Auth-authorize = 'controller'; $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = $referer; $this-Auth-logoutRedirect = array('controller' = 'site', 'action' = 'index', 'home'); } } That all works fine, its just when I submit my login form (users/ login), the password field does not get encrypted, so it never finds any rows. I read the docs and it said that it should auto-encrypt any field named password, obviously its not. Login action: // Form processing if (!empty($this-data)) { $this-Auth-login($this-data['Form']); } --~--~-~--~~~---~--~~ 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: Well formed XML for RESTful web services ...
We use a debug datasource that routes the showLog output to firebug as well. You can enable this datasource while debugging (instead of using the mysql driver) and when done, re-enable the mysql driver. ex: require_once (LIBS . 'model' . DS . 'datasources' . DS . 'dbo_source.php'); require_once (LIBS . 'model' . DS . 'datasources' . DS . 'dbo' . DS . 'dbo_mysql.php'); class DboMysqlExSource extends DboMysql { var $description = MySQL DBO Driver - Extended; function showLog($sorted = false) { if ($sorted) { $log = sortByKey($this-_queriesLog, 'took', 'desc', SORT_NUMERIC); } else { $log = $this-_queriesLog; } if ($this-_queriesCnt 1) { $text = 'queries'; } else { $text = 'query'; } fb(({$this-configKeyName}) {$this-_queriesCnt} {$text} took {$this-_queriesTime} ms\n); foreach ($log as $k = $i) { fb (($k +1) . . {$i['query']} {$i['error']}\n); fb (\tAffected: {$i['affected']}\tTook:{$i['took']} ms\n); } } } On Sun, Dec 7, 2008 at 2:13 PM, lightglitch [EMAIL PROTECTED] wrote: Maybe this will help you: http://www.firephp.org/Wiki/Libraries/CakePHP On Dec 7, 4:32 am, Rob [EMAIL PROTECTED] wrote: No, I don't expect Cake to format the output at all since we are doing MVC. I want to use the debug output without it affecting my HTTP stream. The bug/problem is that if debug 1, the content type gets flipped to text/html, and the SQL debug gets appended to the XML (after the end of the HTML because it's being output directly from the dbo_source.php If we're truly doing MVC, there should never be debug information going directly to the view, and the debug information should be accessible in the model to the controller so we can decide how to deal with it. Say for instance I have debug set to 1 to catch errors. Now in my controller code, I have to turn off debug for XML, so I don't get any chance to catch those errors, which may or may not need to be dealt with. I know the workaround is to detect that I'm doing XML and set debug to 0, but that doesn't help in development in any way. Formatting the debug data and spitting it into the view like it does is violating the MVC design (while it is nice when you're debugging HTML). On Dec 6, 6:31 pm, James K [EMAIL PROTECTED] wrote: Not sure I understand the problem. Do you expect Cake to format it's debug information based on the content type? It's debug information - it's meant for debugging. You can type Configure::write('debug', 0) at the top of any action in order to lower the debug level selectively per action without having to shut if off for the entire app. I have lots of views in a particular application that return XML or JSON, and of course having debug info at the bottom of that response will break those requests. Once I confirm the response is returning correctly formatted XML or JSON, I turn the debugging off for that action and only turn it back on in that action in the event I need to debug :P Good luck, James On Dec 6, 6:24 pm, Rob [EMAIL PROTECTED] wrote: I'll probably get no response or flames telling me to just set debug to 1, but I've set up my VolunteerCake code to be a RESTful web service by using the Router::parseExtensions() and Router::mapResources() magic. This works fine as long as debug is not greater than 1. When debug is greater than 1 however, the XML that gets returned is broken due to problems with the way the SQL debug is spit out. I traced this down to a call In the close() function of dbo_source.php, to showLog() which spits out the SQL in an HTML table I call the web service and get the XML as expected. The closing XML is followed by the dump of the SQL like: /VolunteerCake!-- 0.9699s --table class=cake-sql-log id=cakeSqlLog_1228604311493b0397a19568_61229664 summary=Cake SQL Log cellspacing=0 border = 0 caption(default) 36 queries took 127 ms/caption Other web service tools I've worked with operate by giving you access to the debug data so you can spit it out as part of the XML if you want to, so you end up with something like: VolunteerCakemyDatanon-debug data/myDatadebugdebug data (usually wrapped in a CDATA)/debug/myData/VolunteerCake Ideally Cake shouldn't be changing the content-type and spitting out HTML after the well-formed document has been created anyway. --~--~-~--~~~---~--~~ 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
Re: ORM, fetching related rows of corresponding model: undefined index..
i have done that.. here is my full questions_controller.php ?php class QuestionsController extends AppController { var $name = 'Questions'; function home() { $this-Question-recursive = 'all'; $this-set('questions', $this-Question-find('all')); } function show( $id = null) { if (!$id) { $this-Session-setFlash('Invalid Question.'); $this-redirect(array('action'='home')); } $this-set('question', $this-Question-read(null, $id)); } } ? === On Dec 8, 12:10 am, Rob [EMAIL PROTECTED] wrote: Well based on your post, you are not getting the related model, and it appears you've only done a find on the Questions without setting recursive in your find('all'), try this: $this-set('questions', $this-Question-find('all', array ('recursive' = 1))); On Dec 7, 9:55 am, Tanay [EMAIL PROTECTED] wrote: MODEL answers.php ?php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = array( 'Question' = array( 'className' = 'Question' ) ); } ? Model questions.php ?php class Question extends AppModel { var $name = 'Question'; var $hasMany = array( 'Answer' = array( 'className' = 'Answer' ) ); } ? === On Dec 7, 11:00 am, thatsgreat2345 [EMAIL PROTECTED] wrote: Post your model code so we can see if you are doing your associations correctly, or if they are spelled correctly. On Dec 6, 9:50 pm, Tanay [EMAIL PROTECTED] wrote: it seems no relationships are working with my cakephp. has it got anything to do with my version of php5? i have got struck at this for a long time. help will be very greatly appreciated. here is the var_dump of $questions as seen in home.ctp array(2) { [0]= array(1) { [Question]= array(5) { [id]= string (1) 1 [question]= string(22) Why do you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:19:04 [modified]= string(19) 2008-02-11 22:19:04 } } [1]= array(1) { [Question]= array(5) { [id]= string(1) 2 [question]= string(25) Why won't you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:22:06 [modified]= string(19) 2008-02-11 22:22:06 } } } coresponding queries sql dump is DESCRIBE `questions` SELECT `Question`.`id`, `Question`.`question`, `Question`.`questioner`, `Question`.`created`, `Question`.`modified` FROM `questions` AS `Question` WHERE 1 = 1 On Dec 7, 1:47 am, thatsgreat2345 [EMAIL PROTECTED] wrote: I see you are using the Packt Publishing book, ensure that your model relations aren't misspelled or anything else it won't load the answers and thus won't exist, in the controller do a debug on the find, that or in the view do a pr($questions) before the foreach this will display the array and see what exactly what is in the array. On Dec 6, 9:40 am, Tanay [EMAIL PROTECTED] wrote: Tanay wrote: i have two dbs questions , and answers.. corresponding models questions has many answers answers belogns to questions in questions_controller, i have this home function function home() { $this-Question-recursive = 1; $this-set('questions', $this-Question-find('all')); } in my home.ctp, i tried to show the corresponding answers using the code below i took a question from an array of questions using foreach foreach question, $question['Answer'] is expected to give array of answers, but it says Undefined index: Answer THAT LIne is marked in code below home.ctp: ?php if(empty($questions)): ? p class=no_answerNo Questions yet. Be the first one to post a Question!/p ?php else: ? dl ?php foreach ($questions as $question): ? dtspan?php e($question['Question']['questioner']); ?/span/dt dd ?php e($html-link($question['Question']['question'] .'?', array('action' = 'show', $question['Question']['id']))); ? ?php $answer_count = count($question ['Answer']); // -ERROR HERE if(!$answer_count) e((no answers yet)); else if($answer_count == 1) e((1 answer)); else e((.$answer_count. answers)); ? /dd ?php endforeach; ? /dl
Re: How can I view the screencasts on Linux
On Sun, Dec 7, 2008 at 10:09 PM, Ed Howland [EMAIL PROTECTED] wrote: I am having trouble playing the screencasts on the cakephp.org site. I am using Ubuntu 8.10 w/FF. Does anyone have any suggestions? What kind of problems? -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [EMAIL PROTECTED] ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told onLost http://www.petitiononline.com/libby423/petition.html --~--~-~--~~~---~--~~ 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: ORM, fetching related rows of corresponding model: undefined index..
recursive = 'all'? Should be set to an integer http://book.cakephp.org/view/439/recursive On Dec 7, 7:19 pm, Tanay [EMAIL PROTECTED] wrote: i have done that.. here is my full questions_controller.php ?php class QuestionsController extends AppController { var $name = 'Questions'; function home() { $this-Question-recursive = 'all'; $this-set('questions', $this-Question-find('all')); } function show( $id = null) { if (!$id) { $this-Session-setFlash('Invalid Question.'); $this-redirect(array('action'='home')); } $this-set('question', $this-Question-read(null, $id)); } } ? === On Dec 8, 12:10 am, Rob [EMAIL PROTECTED] wrote: Well based on your post, you are not getting the related model, and it appears you've only done a find on the Questions without setting recursive in your find('all'), try this: $this-set('questions', $this-Question-find('all', array ('recursive' = 1))); On Dec 7, 9:55 am, Tanay [EMAIL PROTECTED] wrote: MODEL answers.php ?php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = array( 'Question' = array( 'className' = 'Question' ) ); } ? Model questions.php ?php class Question extends AppModel { var $name = 'Question'; var $hasMany = array( 'Answer' = array( 'className' = 'Answer' ) ); } ? === On Dec 7, 11:00 am, thatsgreat2345 [EMAIL PROTECTED] wrote: Post your model code so we can see if you are doing your associations correctly, or if they are spelled correctly. On Dec 6, 9:50 pm, Tanay [EMAIL PROTECTED] wrote: it seems no relationships are working with my cakephp. has it got anything to do with my version of php5? i have got struck at this for a long time. help will be very greatly appreciated. here is the var_dump of $questions as seen in home.ctp array(2) { [0]= array(1) { [Question]= array(5) { [id]= string (1) 1 [question]= string(22) Why do you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:19:04 [modified]= string(19) 2008-02-11 22:19:04 } } [1]= array(1) { [Question]= array(5) { [id]= string(1) 2 [question]= string(25) Why won't you use CakePHP [questioner]= string(5) Ahsan [created]= string(19) 2008-02-11 22:22:06 [modified]= string(19) 2008-02-11 22:22:06 } } } coresponding queries sql dump is DESCRIBE `questions` SELECT `Question`.`id`, `Question`.`question`, `Question`.`questioner`, `Question`.`created`, `Question`.`modified` FROM `questions` AS `Question` WHERE 1 = 1 On Dec 7, 1:47 am, thatsgreat2345 [EMAIL PROTECTED] wrote: I see you are using the Packt Publishing book, ensure that your model relations aren't misspelled or anything else it won't load the answers and thus won't exist, in the controller do a debug on the find, that or in the view do a pr($questions) before the foreach this will display the array and see what exactly what is in the array. On Dec 6, 9:40 am, Tanay [EMAIL PROTECTED] wrote: Tanay wrote: i have two dbs questions , and answers.. corresponding models questions has many answers answers belogns to questions in questions_controller, i have this home function function home() { $this-Question-recursive = 1; $this-set('questions', $this-Question-find('all')); } in my home.ctp, i tried to show the corresponding answers using the code below i took a question from an array of questions using foreach foreach question, $question['Answer'] is expected to give array of answers, but it says Undefined index: Answer THAT LIne is marked in code below home.ctp: ?php if(empty($questions)): ? p class=no_answerNo Questions yet. Be the first one to post a Question!/p ?php else: ? dl ?php foreach ($questions as $question): ? dtspan?php e($question['Question']['questioner']); ?/span/dt dd ?php e($html-link($question['Question']['question'] .'?', array('action' = 'show', $question['Question']['id']))); ? ?php $answer_count = count($question ['Answer']); // -ERROR HERE if(!$answer_count)
Re: How can I view the screencasts on Linux
On Sun, Dec 7, 2008 at 9:32 PM, Marcelo Andrade [EMAIL PROTECTED] wrote: On Sun, Dec 7, 2008 at 10:09 PM, Ed Howland [EMAIL PROTECTED] wrote: I am having trouble playing the screencasts on the cakephp.org site. I am using Ubuntu 8.10 w/FF. Does anyone have any suggestions? What kind of problems? It just says video loading and then quits. Do you know what kind of video format it is? Thanks Ed -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [EMAIL PROTECTED] ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told onLost http://www.petitiononline.com/libby423/petition.html -- Ed Howland http://greenprogrammer.blogspot.com http://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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: How can I view the screencasts on Linux
It is quicktime. On Dec 7, 8:47 pm, Ed Howland [EMAIL PROTECTED] wrote: On Sun, Dec 7, 2008 at 9:32 PM, Marcelo Andrade [EMAIL PROTECTED] wrote: On Sun, Dec 7, 2008 at 10:09 PM, Ed Howland [EMAIL PROTECTED] wrote: I am having trouble playing the screencasts on the cakephp.org site. I am using Ubuntu 8.10 w/FF. Does anyone have any suggestions? What kind of problems? It just says video loading and then quits. Do you know what kind of video format it is? Thanks Ed -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [EMAIL PROTECTED] ~]# linkshttp://pa.slackwarebrasil.org/ For Libby's backstory be told onLost http://www.petitiononline.com/libby423/petition.html -- Ed Howlandhttp://greenprogrammer.blogspot.comhttp://twitter.com/ed_howland --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error when submitting form to a controller using different model name
I'm in the process of creating a website that is for my affiliates and their information is stored into a model called 'User' and I have a controller called businesses with two actions; index and thank_you. When a prospect lands onto the page they are given a sales letter and a form to fill out. This form will use the User model but I want it to submit to the businesses thank_you action. I'm putting the prospects information into the Users model because they could be converted into an affiliate. Where I'm having the problem is that currently my form code looks like this: ===CODE=== echo $form-create('User', array('url' = '/businesses/thank_you')); echo $form-hidden('parent_id', array('value' = $member['User'] ['affiliate_number'])); echo 'span class=required*/span spanName:/span'; echo $form-input('first_name', array('label' = false, 'size' = 20)); echo 'span class=required*/span spanEmail:/span'; echo $form-input('email', array('label' = false, 'size' = 20)); echo 'br /'; echo 'spanstrongPhone: em(optional, for those who really want change)/em/strong/spanbr /'; echo $form-input('phone', array('label' = false)); echo 'br /'; echo $form-end(array('label' = 'I Want Change in My Life')); ===CODE=== The problem is that when I submit this form the url at the top is correct: http://example.com/businesses/thank_you But I get this error: Not Found Error: The requested address '/businesses/thank_you' was not found on this server. What am I doing wrong here? --~--~-~--~~~---~--~~ 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: Error when submitting form to a controller using different model name
Do you have a controller called businesses_controller.php and in that a function called thank_you? On Dec 7, 9:37 pm, Tony [EMAIL PROTECTED] wrote: I'm in the process of creating a website that is for my affiliates and their information is stored into a model called 'User' and I have a controller called businesses with two actions; index and thank_you. When a prospect lands onto the page they are given a sales letter and a form to fill out. This form will use the User model but I want it to submit to the businesses thank_you action. I'm putting the prospects information into the Users model because they could be converted into an affiliate. Where I'm having the problem is that currently my form code looks like this: ===CODE=== echo $form-create('User', array('url' = '/businesses/thank_you')); echo $form-hidden('parent_id', array('value' = $member['User'] ['affiliate_number'])); echo 'span class=required*/span spanName:/span'; echo $form-input('first_name', array('label' = false, 'size' = 20)); echo 'span class=required*/span spanEmail:/span'; echo $form-input('email', array('label' = false, 'size' = 20)); echo 'br /'; echo 'spanstrongPhone: em(optional, for those who really want change)/em/strong/spanbr /'; echo $form-input('phone', array('label' = false)); echo 'br /'; echo $form-end(array('label' = 'I Want Change in My Life')); ===CODE=== The problem is that when I submit this form the url at the top is correct:http://example.com/businesses/thank_you But I get this error: Not Found Error: The requested address '/businesses/thank_you' was not found on this server. What am I doing wrong here? --~--~-~--~~~---~--~~ 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: Auth-login() Not working correctly?
I tried removing the $this-Auth-login() and now it doesnt do anything. No query is fired. --~--~-~--~~~---~--~~ 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: Auth-login() Not working correctly?
Actually nevermind. The $this-data had to be under User, not Form. Now the login is submitting and the query is being fired... BUT now everytime I hit login the password field goes empty and it never works. On Dec 7, 9:50 pm, gearvOsh [EMAIL PROTECTED] wrote: I tried removing the $this-Auth-login() and now it doesnt do anything. No query is fired. --~--~-~--~~~---~--~~ 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: How can I view the screencasts on Linux
Ed Howland wrote: I am having trouble playing the screencasts on the cakephp.org site. I am using Ubuntu 8.10 w/FF. Does anyone have any suggestions? Thanks Ed I'm using the Totem mozplugin to do this on Fedora 10. On my notebook I'm using mplayer and mozplugger. If you can't get the videos to play in your browser,look at the HTML source, search for the .mov files and play them with your favorite player. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ajax and Sessions
I'm trying to upgrade and app from an older beta of cake to RC3. In my app_controller, I have a before filter that checks whether the user is logged in via a session variable, but in the course of debugging I've noticed that the session variable isn't there(i.e. session not started?) when ajax requests are being processed, it is there when normal requests are being processed, I set security in core.php to low (it was on medium) with no difference, $helpers/ $components definetly includes 'Session'. Am I missing something in the update I need to do I have looked through the latest api/manuals but can't see why the session start is being bypassed. Regards Jeremy --~--~-~--~~~---~--~~ 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: How to add line break in text mail layout?
On 6 Gru, 17:32, majna [EMAIL PROTECTED] wrote: Just write \n Examples: ?php echo \n;? ?php echo $name . \n;? Wow! It works! I don't know why, but it works correct. The only thing I had to do was moving \n into inside of echo function. Does not work directly in template: Something: ?php e($Model['field']); ?\n but this code works correct: Something: ?php e($Model['field']).\n; ?\n Thanks all for help ;) On Dec 5, 1:44 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: Well...that's not supposed to happen. Can you check the mail source and mime headers? Maybe you're not sending your email in plain text..? On Dec 5, 1:11 pm, Hipnotik [EMAIL PROTECTED] wrote: On 5 Gru, 12:35, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: What about simply hitting the enter key? :) Doesn't work... displays all lines in one :( On Dec 5, 12:14 pm, Hipnotik [EMAIL PROTECTED] wrote: How to add line break in text mail layout? It's in elements/email/text/default.ctp file. I tried to use: \n \r\n \r and still it doesn't work correct. It breaks the lines but new line character (i.e. \n) appears in the received message too. How to do that? Thanks for help ;) --~--~-~--~~~---~--~~ 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: How to add line break in text mail layout?
On 6 Gru, 17:32, majna [EMAIL PROTECTED] wrote: Just write \n Examples: ?php echo \n;? ?php echo $name . \n;? Wow! It works! I don't know why, but it works correct. The only thing I had to do was moving \n into inside of echo function. Does not work directly in template: Something: ?php e($Model['field']); ?\n but this code works correct: Something: ?php e($Model['field']).\n; ? Thanks all for help ;) On Dec 5, 1:44 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: Well...that's not supposed to happen. Can you check the mail source and mime headers? Maybe you're not sending your email in plain text..? On Dec 5, 1:11 pm, Hipnotik [EMAIL PROTECTED] wrote: On 5 Gru, 12:35, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: What about simply hitting the enter key? :) Doesn't work... displays all lines in one :( On Dec 5, 12:14 pm, Hipnotik [EMAIL PROTECTED] wrote: How to add line break in text mail layout? It's in elements/email/text/default.ctp file. I tried to use: \n \r\n \r and still it doesn't work correct. It breaks the lines but new line character (i.e. \n) appears in the received message too. How to do that? Thanks for help ;) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---