Re: Layout code being overlooked
Hey, thanks for the tips! I found the error: Call to undefined function: stripos(). I had to replace it with two calls to strpos() and then it worked fine. I didn't know the case-insensitive version didn't work in PHP 4. Anyways, problem solved, thanks a lot. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Layout code being overlooked
I've been tinkering with it for a while with absolutely no success, so if anybody has any insight, it would be great to hear it. -Igor On Oct 10, 5:00 pm, ifcanduela <[EMAIL PROTECTED]> wrote: > Hello everybody, > > I have a strange problem: the HTML and PHP/Cake code in the layout > THTML document is not being sent to the client. The page returned is > just the lines in the view, without the doctype and the header tags, > > If you take a look at the source code > athttp://escaparatetactil.es/demoav/index.php/travels/display/223/1 > you'll see everything's OK, but if you click on any of the six 'Tonga' > dummy links and peek at source for the next page (o go > tohttp://escaparatetactil.es/demoav/index.php/routes/display/4), you'll > see it lacks the head information. > > The controllers for the 'display' action are virtually identical, the > layout names are correct in the $this->layout = 'layout_name'; > assignments and the layout thtml files only differ in the document > title and (obviously) filename. > > Any help is greatly appreciated, thanks in advance. > > -Igor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Layout code being overlooked
Hello everybody, I have a strange problem: the HTML and PHP/Cake code in the layout THTML document is not being sent to the client. The page returned is just the lines in the view, without the doctype and the header tags, If you take a look at the source code at http://escaparatetactil.es/demoav/index.php/travels/display/223/1 you'll see everything's OK, but if you click on any of the six 'Tonga' dummy links and peek at source for the next page (o go to http://escaparatetactil.es/demoav/index.php/routes/display/4), you'll see it lacks the head information. The controllers for the 'display' action are virtually identical, the layout names are correct in the $this->layout = 'layout_name'; assignments and the layout thtml files only differ in the document title and (obviously) filename. Any help is greatly appreciated, thanks in advance. -Igor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: A problem with paths
Thanks, a lot, after some chats with the hosting people, they deleted the .htaccess files specified in the blog tutorial and almost everything is working now. I have another problem though, and this time it's related to including javascript files. I use echo $javascript->link('prototype'); to include Prototype in the templates. I've already tried with some other methods listed in the API docs. I guess this should add something like to the page, but it doesn't. PHP just halts execution of the script and the page returned to the browser is 7 lines long -- from the doctype declaration to a css link made with $html->link(). If instead of the cake code I write the HTML
Re: A problem with paths
C'mon guys, anyone knows what could be happening here? -Igor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
A problem with paths
Hello there, I have developed a fairly simple application, and it works flawlessly... on my local server. When it has come the time to upload the files to the client's host, only the 'home' page is displayed, without CSS styling, and the links lead to 404s. When I try to reach another model/action page, the same error (404) appears. There's no option to enable mod_rewrite in the server or modify their htaccess files, so I've enabled Cake's own routing, and I guess this is giving problems. The thing is, in my local server, it al works, wit mod_rewrite or without. Could it be that I haven't FTP'd a hidden file or something? The app is hosted at http://www.escaparatetactil.es/demoav/ and I've setup a phpinfo() script (http://www.escaparatetactil.es/demoav/ phpinfo.php) for anyone to check. Although I've discarded a problem with Apache or MySQL, I'm no expert whatsoever, so all options are plausible. Thanks a lot for any help. -Igor F. Canduela --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange behaviour when saving data
Thanks Cheeze, I'll try that... on Monday :) -If --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange behaviour when saving data
I'll follow your advice and paste the relevant code :) The Region model: class Region extends AppModel { var $name = "Region"; var $validate = array( 'name' => VALID_NOT_EMPTY ); var $hasMany = array( 'Country' => array( 'className' => 'Country', 'foreignKey' => 'region_id' ) ); } The Country model: class Country extends AppModel { var $name = "Country"; var $validate = array( 'name' => VALID_NOT_EMPTY ); var $belongsTo = array( 'Region' => array( 'className' => 'Region', 'conditions' => '', 'order' => '', 'foreignKey' => 'region_id' ) ); var $hasMany = array( 'Travel' => array( 'className' => 'Travel', 'foreignKey' => 'country_id' ) ); } The add() action in countries_controller: function add($region_id = null) { if (!empty($this->data)) { $this->data['Country']['region_id'] = $region_id; if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries/index/' . $region_id, 2); } } else { $this->set('region_id', $region_id); } } And the add.thtml view: New contry *Country name: input('Country/name', array('size' => '25')) ?> tagErrorMsg('Country/name', 'A name is mandatory.') ?> submit('Save'); ?> All fields marked * are mandatory. If thre's something missing, just tell me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange behaviour when saving data
Come on guys, somebody must've stumbled upon this before... I guess I could add some more info: this only happens when I try to add a new child (a country) to the parent (the region) to which the country with id=1 already belongs to. If I manually delete that id=1 country, all works right, and if I add countries to any other region, they are inserted ok. But if, as I said before, I try to insert a new child with the same region_id of the country with id=1, this last country's record gets updated insead of a new one inserted. Any help would be great, thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Strange behaviour when saving data
Hello, I'm having a strange problem when using the 'save' method to insert new records. This is what is happening: I have a Country with id=0 that belongs to a region with, say, id=3. When the 'add' action of the countries_controller is called, instead of adding a new country with id=2 and region_id=3, it updates the country with id=0. I'm pretty sure the rest of the code is right, however I've had some problems with this "saving related model" stuff before, since the 'Blog Tutorial' finishes without adding comments to the mix. Anybody knows what might be causing this odd behaviour? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Populating a hidden field
Thank you very much for your help, Scott. Well I've finally managed to get it to work by placing things like this: function add($region_id = null) { if (!empty($this->data)) { $this->data['Country']['region_id'] = $region_id; if ($this->Country->save($this->data)) { $this->flash('El país se ha añadido a la lista.', '/countries/index/' . $region_id, 2); } } else { $this->set('region_id', $region_id); } } And I'm now able to drop the hidden field by appending $region_id to the form's "action" url. Apparently everything else didn't work for me. It's gonna be interesting if I keep on having more problems like these... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [EMAIL PROTECTED] 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: Populating a hidden field
Ugh, I'm such a newbie... The view gets the value for region_id OK, but when I submit the form, it inserts a 0 in the region_id field of the new record instead of the real region_id. Am I missing something? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [EMAIL PROTECTED] 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: Populating a hidden field
Wow, thanks everybody. I've moved the set() call to the 'else' clause instead of putting it before the 'if' and it works like a charm now. I guess I still have to learn the mechanics of it all. And Scott, thank you for pointing me that, it wasn't a typo, I had it that way in the code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [EMAIL PROTECTED] 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 -~--~~~~--~~--~--~---
Populating a hidden field
Hello, I'm new to CakePHP and have what I think is a very simple question, but I'm apparentyly unable to find a straight answer anywhere. I have a couple of MySQL tables, regions and countries, and I have already setup models, views and controllers for both of them, so I can display tables listing regions and I can click a region to see countries in that region. Everywhit working fine. I've placed an "add country" link in the country listing for each region, so that I can click the "add" link and enter a new country for the region. The problem is, I don't know how to pass the region_id to the country- add view, and when the country is inserted in the table it remains regionless. Since I know what the region_id is and I append it to the url (e.g. /cake/countries/add/8), I've tried to use set() to pass it to the view. This is my add function, almost straight from the blog tutorial: function add($region_id = null) { if (!empty($this->data)) { $this->set('region_id' . $region_id); if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries', 2); } } } and I've written this in the view: echo $html->hidden('Country/region_id', array( 'value' => $region_id)) However the variable isn't defined and I can't use it in the form. Anybody can help me? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [EMAIL PROTECTED] 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 -~--~~~~--~~--~--~---