Re: Why is Controller::render so complex?
sounds like a good chance to create some unit tests and submit them along with a patch. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
R: accessing different database from a controller
This is a known issue. In your connections in database.php add the clause 'persistent' => false like in this example: class DATABASE_CONFIG { var $global = array( 'driver' => 'mysql', 'connect'=> 'mysql_connect', 'host' => 'localhost', 'login' => '***', 'password' => '***', 'database' => 'global', 'persistent' => false, // <= 'prefix' => '' ); var $en = array( 'driver' => 'mysql', 'connect'=> 'mysql_connect', 'host' => 'localhost', 'login' => '***', 'password' => '***', 'database' => 'en', 'persistent' => false, // <= 'prefix' => '' ); } If this does not work you need separate login passwords for each database. HTH > -Messaggio originale- > Da: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Per conto di cloud > Inviato: sabato 14 aprile 2007 7.02 > A: Cake PHP > Oggetto: Re: accessing different database from a controller > > > Dear Joshua, > > They are all mysql tables and residing in a same server. > I did some more testing and found that if I changed the $uses in the > sites_controller.php: > from : > class SitesController extends AppController { > var $name = 'Sites'; > var $uses = array('Site' , 'Language'); } > > to become : > class SitesController extends AppController { > var $name = 'Sites'; > var $uses = array('Language', 'Site' ); } > > Then now it change: I can access the Site but can't access > the Language model. > It seems that only the latter model (database) mentioned in > the $uses is being used. > > Please advise. > Thank you. > > > > On Apr 14, 8:41 am, "Joshua Benner" <[EMAIL PROTECTED]> wrote: > > Are they entirely different database backends? What type of > databases > > are they? > > > > On Apr 13, 2:24 pm, "cloud" <[EMAIL PROTECTED]> wrote: > > > > > Dear all, > > > > > I just started using CakePHP for developing my company website. > > > Have searched the forum, but couldn't find any info. > > > > > Need to acces 2 tables which located in 2 different > database from a > > > controller. > > > But, I can't get it to work. > > > I read the manual on accessing more than one model from a > controller > > > (http://manual.cakephp.org/chapter/controllers). > > > It seems that it only works if the tables are in one same > database. > > > > > Here is an example : > > > This is the content of language.php : > > > class Language extends AppModel > > > { > > > var $name = 'Language'; > > > var $useDbConfig = 'global'; > > > var $useTable = 'languages; > > > > > } > > > > > This is the content of site.php: > > > class Site extends AppModel > > > { > > > var $name = 'Site'; > > > var $useDbConfig = 'en'; > > > var $useTable = 'sites'; > > > > > } > > > > > Then in sites_Controlller.php I tried to access both of the table. > > > class SitesController extends AppController { > > > var $name = 'Sites'; > > > var $uses = array('Site' , 'Language'); > > > > > function index() > > > { > > > set('test_site', > $this->Site->findByContent('desciption); > > > set('test_language', > $this->Language->findByLanguage('en'); > > > } > > > > > } > > > > > It works for $test_language, it displays the value. > > > But it display nothing for $test_site. It's empty. > > > When I set the DEBUG to 2, I see that it run the query on > > > global.sites, instead of en.sites table. > > > Did I forget anything here ? > > > Or maybe it doesn't allow a control accessing tables in different > > > database? > > > > > Any help will be very appreciated. > > > TIA > > > > > ?> > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
curious to know status of jquery in cakephp 1.2 ??
Hi, For almost last 1 year, I am using cakePHP and I really enjoy using it. Actually, because of cakePHP, I am able to build a wonderful website for article management (http://www.geovista.psu.edu/memento ). To try, use demo/demo as username and password. However, this message is not about boasting my website, but just a thought on the integration of CakePHP and JQuery. Some credit towards my success also goes to jQuery. JQuery provides an excellent and easy to use javascript library. So, I am looking forward for seamless integration of CakePHP and jQuery. In some of the previous google groups disucssions, I saw this matter coming up. But nothing recently, especially when so many things are happening with the release of CakePHP 1.2. I found a jQueryHelper but its lacking documentation. So I am just curious to know about the status of jquery in cakephp 1.2. Regards, bingo --~--~-~--~~~---~--~~ 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: unable to pass url as a parameter
It's not that you *need* them, but that named parameters are SEO friendly while regular are not. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de bingo Enviado el: Sábado, 14 de Abril de 2007 03:28 a.m. Para: Cake PHP Asunto: Re: unable to pass url as a parameter However one question ...using controller/action?site=... basically you are passing named parameters in traditional way...then why do you need "named parameter" logic as developed in the above article.. --~--~-~--~~~---~--~~ 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: unable to pass url as a parameter
Hi MI, great..its working now..after you reply...Probably the problem was due to use of "named parameter code" (http://bakery.cakephp.org/articles/ view/129 ) but I cannot say conclusively However one question ...using controller/action?site=... basically you are passing named parameters in traditional way...then why do you need "named parameter" logic as developed in the above article.. n'ways..thanks for the help.. bingo. On Apr 14, 2:05 am, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > No way, that example I give you works with no problem both on 1.1 or 1.2, > seems like you have issues on your Server installation. Web server, CakePHP > version, etc. etc.? > > -MI > > --- > > Remember, smart coders answer ten questions for every question they ask. > So be smart, be cool, and share your knowledge. > > BAKE ON! > > blog:http://www.MarianoIglesias.com.ar > > -Mensaje original- > De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre > de bingo > Enviado el: Sábado, 14 de Abril de 2007 03:02 a.m. > Para: Cake PHP > Asunto: Re: unable to pass url as a parameter > > thanks for your suggestion. I already tried that and is not working.. > > If I encode the url then the cake shows page not found error.if > you noticed, the first link has encoded url. > > I also tried using site=urlencode('http://cakephp.org') ... and it is > also giving "page not found" error.. > > It seems cakephp decode url before separating controller, action, and > parameter... > > Please let me know if there is any hack that I can use --~--~-~--~~~---~--~~ 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: unable to pass url as a parameter
No way, that example I give you works with no problem both on 1.1 or 1.2, seems like you have issues on your Server installation. Web server, CakePHP version, etc. etc.? -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de bingo Enviado el: Sábado, 14 de Abril de 2007 03:02 a.m. Para: Cake PHP Asunto: Re: unable to pass url as a parameter thanks for your suggestion. I already tried that and is not working.. If I encode the url then the cake shows page not found error.if you noticed, the first link has encoded url. I also tried using site=urlencode('http://cakephp.org') ... and it is also giving "page not found" error.. It seems cakephp decode url before separating controller, action, and parameter... Please let me know if there is any hack that I can use --~--~-~--~~~---~--~~ 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: unable to pass url as a parameter
Hi MI, thanks for your suggestion. I already tried that and is not working.. If I encode the url then the cake shows page not found error.if you noticed, the first link has encoded url. I also tried using site=urlencode('http://cakephp.org') ... and it is also giving "page not found" error.. It seems cakephp decode url before separating controller, action, and parameter... Please let me know if there is any hack that I can use Regards, bingo On Apr 13, 7:46 pm, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > A quick fix is to use parameters: > > $html->link('Tag CakePHP website', 'controller/action?site=' . > urlencode('http://www.cakephp.org')); > > And then on your action: > > function action() { > $url = $this->params['url']['site']; > > } > > -MI > > --- > > Remember, smart coders answer ten questions for every question they ask. > So be smart, be cool, and share your knowledge. > > BAKE ON! > > blog:http://www.MarianoIglesias.com.ar > > -Mensaje original- > De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre > de bingo > Enviado el: Viernes, 13 de Abril de 2007 08:33 p.m. > Para: Cake PHP > Asunto: unable to pass url as a parameter > > I want to allow users to tag any outside website in my application. > For this, I am sending the url of the website as a parameter to my > controller/action > > so for > instance,http://localhost/mysite/controller/action/http%3A%2F%2Fcakephp.org%2F --~--~-~--~~~---~--~~ 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: Why is Controller::render so complex?
On 4/14/07, gwoo <[EMAIL PROTECTED]> wrote: > > what happens when you try to validate two different models in the same > controller? Do you get the validation errors for both models in the > view? > With my code yes - with the prior code no... Tarique -- = PHP for E-Biz: http://sanisoft.com Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org = --~--~-~--~~~---~--~~ 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: Why is Controller::render so complex?
what happens when you try to validate two different models in the same controller? Do you get the validation errors for both models in the view? --~--~-~--~~~---~--~~ 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: accessing different database from a controller
Dear Joshua, They are all mysql tables and residing in a same server. I did some more testing and found that if I changed the $uses in the sites_controller.php: from : class SitesController extends AppController { var $name = 'Sites'; var $uses = array('Site' , 'Language'); } to become : class SitesController extends AppController { var $name = 'Sites'; var $uses = array('Language', 'Site' ); } Then now it change: I can access the Site but can't access the Language model. It seems that only the latter model (database) mentioned in the $uses is being used. Please advise. Thank you. On Apr 14, 8:41 am, "Joshua Benner" <[EMAIL PROTECTED]> wrote: > Are they entirely different database backends? What type of databases > are they? > > On Apr 13, 2:24 pm, "cloud" <[EMAIL PROTECTED]> wrote: > > > Dear all, > > > I just started using CakePHP for developing my company website. > > Have searched the forum, but couldn't find any info. > > > Need to acces 2 tables which located in 2 different database from a > > controller. > > But, I can't get it to work. > > I read the manual on accessing more than one model from a controller > > (http://manual.cakephp.org/chapter/controllers). > > It seems that it only works if the tables are in one same database. > > > Here is an example : > > This is the content of language.php : > > class Language extends AppModel > > { > > var $name = 'Language'; > > var $useDbConfig = 'global'; > > var $useTable = 'languages; > > > } > > > This is the content of site.php: > > class Site extends AppModel > > { > > var $name = 'Site'; > > var $useDbConfig = 'en'; > > var $useTable = 'sites'; > > > } > > > Then in sites_Controlller.php I tried to access both of the table. > > class SitesController extends AppController { > > var $name = 'Sites'; > > var $uses = array('Site' , 'Language'); > > > function index() > > { > > set('test_site', $this->Site->findByContent('desciption); > > set('test_language', $this->Language->findByLanguage('en'); > > } > > > } > > > It works for $test_language, it displays the value. > > But it display nothing for $test_site. It's empty. > > When I set the DEBUG to 2, I see that it run the query on > > global.sites, instead of en.sites table. > > Did I forget anything here ? > > Or maybe it doesn't allow a control accessing tables in different > > database? > > > Any help will be very appreciated. > > TIA > > > ?> --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Why is Controller::render so complex?
While investigating how best to get validationErrors of associated models into views (specially hasOne) I ran into this piece of code in the Controller::render method (v1.2.xxx). if (!empty($this->modelNames)) { $count = count($this->modelNames); for ($i = 0; $i < $count; $i++) { $model = $this->modelNames[$i]; if (!empty($this->{$model}->validationErrors)) { $this->__viewClass->validationErrors[$model] = &$this->{$model}->validationErrors; } } } I overrode render in my appController and replaced the above with $this->__viewClass->validationErrors = &$this->validationErrors; And, hey! it works as I want it to... Now since 20 === $myIQ I am curious to know what I am missing from 140 === $theirIQ folks? I am sure that there is some reason for the complex piece of code above. TIA Tarique -- = PHP for E-Biz: http://sanisoft.com Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org = --~--~-~--~~~---~--~~ 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: Creating a support wiki for CakePHP, any interest?
Why don't we first develop our own wiki utilizing cake then start plugging in content to the wiki afterwords? --~--~-~--~~~---~--~~ 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: Date Formatting
Thank you very much, that solved it! On Apr 13, 8:54 am, "Marcus T. Jaschen" <[EMAIL PROTECTED]> wrote: > EricS wrote: > > I have only spent a few weeks on cakephp but so far I love it. > > However, I have one issue I can't get past. I am having a really hard > > time getting dates formatted. I searched this group but wasn't able > > to get anything working. > > > Thedateis stored in the database as a datetime. I am trying to show > > the last 5 entries to the database sorted by the createddatedesc. I > > have the entries showing fine, in the correct order even. Thedateis > > in a datetime format and I would prefer just MM/DD/. > > > In my view I have the following > > > > > > On the first record I get this error message: "Notice (8): A non well > > formed numeric value encountered [CORE\app\views\restaurants > > \index.ctp, line 16]" > > Use strtotime(): > > > > M.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: accessing different database from a controller
Are they entirely different database backends? What type of databases are they? On Apr 13, 2:24 pm, "cloud" <[EMAIL PROTECTED]> wrote: > Dear all, > > I just started using CakePHP for developing my company website. > Have searched the forum, but couldn't find any info. > > Need to acces 2 tables which located in 2 different database from a > controller. > But, I can't get it to work. > I read the manual on accessing more than one model from a controller > (http://manual.cakephp.org/chapter/controllers). > It seems that it only works if the tables are in one same database. > > Here is an example : > This is the content of language.php : > class Language extends AppModel > { > var $name = 'Language'; > var $useDbConfig = 'global'; > var $useTable = 'languages; > > } > > This is the content of site.php: > class Site extends AppModel > { > var $name = 'Site'; > var $useDbConfig = 'en'; > var $useTable = 'sites'; > > } > > Then in sites_Controlller.php I tried to access both of the table. > class SitesController extends AppController { > var $name = 'Sites'; > var $uses = array('Site' , 'Language'); > > function index() > { > set('test_site', $this->Site->findByContent('desciption); > set('test_language', $this->Language->findByLanguage('en'); > } > > } > > It works for $test_language, it displays the value. > But it display nothing for $test_site. It's empty. > When I set the DEBUG to 2, I see that it run the query on > global.sites, instead of en.sites table. > Did I forget anything here ? > Or maybe it doesn't allow a control accessing tables in different > database? > > Any help will be very appreciated. > TIA > > ?> --~--~-~--~~~---~--~~ 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: Components and Database
Perhaps you could define a method on app/app_controller.php (class AppController) that will store the appropriate information, and have every action call that method ($this->method). Alternately, there may be some method on AppController you could override (and pass to parent) that actually calls the controller action methods. On Apr 13, 10:04 am, "Vincent" <[EMAIL PROTECTED]> wrote: > Hello - > > I am kind of new to Cake and I am unsure about how to structure a > piece of development I need to do. > > I want to create a Tracker feature whereby I will track users actions > on my website. It is fairly simple: > - when a user first arrive on the site, I record his IP in a session > and on a "user" able (no authentication) > - subsequently each time the user perform an action on the site > (navigate through pages) I will record for that user an action : type > of action , parameters for the action. For example the user selected a > Tag to be displayed (action = select tag) and the tag is > "Sun" (parameter = sun). > > I have 2 tables to implement this: user (id, ip adress...) and action > (id, action, parameter, time, user_id). > The user has many action. > > I was thinking of creating a component to implement this that I can > call with all the controllers. Each controllers will add actions to > the tables. > > The component will need to have access (essentially Write) to the two > tables. > > My questions are: > - how can I include a model (for my 2 tables) in a component AND is > this the right thing to do? > - is creating a component the right solution? > > Many thanks! > -Vincent --~--~-~--~~~---~--~~ 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: url issues
Does your web host allow .htaccess overriding? That is required for mod_rewrite to work properly. I know there is a way to work without mod_rewrite, but I've not done it myself. On Apr 13, 8:06 pm, "NicoE" <[EMAIL PROTECTED]> wrote: > Hello everybody! I just uploaded Cake to my webhosting. The problem I > have is that I can´t get to the URL:www.domain.com/cake/controller/action. > The same page appears: "Your database configuration file is present. > Cake is able to connect to the database". --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
url issues
Hello everybody! I just uploaded Cake to my webhosting. The problem I have is that I can´t get to the URL: www.domain.com/cake/controller/action. The same page appears: "Your database configuration file is present. Cake is able to connect to the database". --~--~-~--~~~---~--~~ 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: unable to pass url as a parameter
A quick fix is to use parameters: $html->link('Tag CakePHP website', 'controller/action?site=' . urlencode('http://www.cakephp.org')); And then on your action: function action() { $url = $this->params['url']['site']; } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de bingo Enviado el: Viernes, 13 de Abril de 2007 08:33 p.m. Para: Cake PHP Asunto: unable to pass url as a parameter I want to allow users to tag any outside website in my application. For this, I am sending the url of the website as a parameter to my controller/action so for instance, http://localhost/mysite/controller/action/http%3A%2F%2Fcakephp.org%2F --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How do I use i18n and l10n in CakePHP 1.2?
I have been trying to find any kind of documentation on how to use i18n and l10n in CakePHP 1.2. Any help would be appreciated. -- Aaron Thies "When you're married you'll understand the value of fresh produce." - Tony Soprano --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
unable to pass url as a parameter
hi, I want to allow users to tag any outside website in my application. For this, I am sending the url of the website as a parameter to my controller/action so for instance, http://localhost/mysite/controller/action/http%3A%2F%2Fcakephp.org%2F -- (1) here http%3A%2F%2Fcakephp.org%2F --- (2) is my parameter .. but when I try above url i.e. (1), I get page not found error I tried removing url encoding. But that also didn't work...by removing the url encoding, my action is properly called but cakephp strips out anything after http: ...probably because it thinks anything after / as another parameter is there any way to handle this??? Regards, bingo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Odd Queries for Pagination
Please note, I don't know if this is a bug... if feedback suggests it is, then I'll submit a bug report -- but I'd like to seek input from others first. I'm using the scaffolding on a very basic table for inputting some support data. However, the scaffold does not seem to paginate properly, showing the first 20 records while on page two. The query it sends for page one is straightforward enough... but then the query it sends for page 2 is along the following lines: select * from (select top 20 * from (select top 20 field1 as field1,... from table where 1=1) as Set1) as Set 2 I'm not sure what it's trying to do there... but that query will return just the first twenty rows, not the second set of twenty. Is it possible I have something configured wrong? --~--~-~--~~~---~--~~ 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: Building criteria array using DATE_FORMAT
Does anyone have any idea how to put together an array to make the DATE_FORMAT work? On Apr 8, 7:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm trying to use a findall query and use the MYSQLDATE_FORMAT > function. > > The code is > > $criteria = array(); > $criteria['DATE_FORMAT(Schedule.start,\'%w\')'] = 3; > $this->Schedule->findAll($criteria); > > My code as it runs produces... > > SELECT * FROM `studioschedules` AS > `Schedule`WHEREDATE_FORMAT(`Schedule`.`start,'%w'`) = 3 > > which causes an error. What is the correct way to put this query > together? --~--~-~--~~~---~--~~ 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
Yolabingo, You can use cake's pr() command to do the same thing in the controller with much less effort. Just do... pr($this->data) and the first thing that appears in your view is the data dump. Of course, your way allows you to dump the data into a particular div tag if that is needed. Useful if you have a debug box on the page. I also found it helpful to modify the pr() method so that it's contained within a DIV tag that left justifies the text. Sometimes pr() will print as centered text depending on the style of the context it happens to be in. On Apr 13, 12:21 pm, "yolabingo" <[EMAIL PROTECTED]> wrote: > One thing that has helped me tremendously as I learn this framework is > to print the contents of $this->params and/or $this->data when I'm > working on a function/view and getting stuck. Just do something like > this in your controller (at all points before a view might be > rendered): > > set('currData', $this->data); > set('currParams', $this->params); > > and add this to your view: > > > print_r($currParams); ?> > --~--~-~--~~~---~--~~ 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
One thing that has helped me tremendously as I learn this framework is to print the contents of $this->params and/or $this->data when I'm working on a function/view and getting stuck. Just do something like this in your controller (at all points before a view might be rendered): set('currData', $this->data); set('currParams', $this->params); and add this to your view: --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
accessing different database from a controller
Dear all, I just started using CakePHP for developing my company website. Have searched the forum, but couldn't find any info. Need to acces 2 tables which located in 2 different database from a controller. But, I can't get it to work. I read the manual on accessing more than one model from a controller (http://manual.cakephp.org/chapter/controllers). It seems that it only works if the tables are in one same database. Here is an example : This is the content of language.php : class Language extends AppModel { var $name = 'Language'; var $useDbConfig = 'global'; var $useTable = 'languages; } This is the content of site.php: class Site extends AppModel { var $name = 'Site'; var $useDbConfig = 'en'; var $useTable = 'sites'; } Then in sites_Controlller.php I tried to access both of the table. class SitesController extends AppController { var $name = 'Sites'; var $uses = array('Site' , 'Language'); function index() { set('test_site', $this->Site->findByContent('desciption); set('test_language', $this->Language->findByLanguage('en'); } } It works for $test_language, it displays the value. But it display nothing for $test_site. It's empty. When I set the DEBUG to 2, I see that it run the query on global.sites, instead of en.sites table. Did I forget anything here ? Or maybe it doesn't allow a control accessing tables in different database? Any help will be very appreciated. TIA ?> --~--~-~--~~~---~--~~ 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
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: Pagination through requestAction
when in doubt, you can always pass the controller. try setting $paginator- >options(array('url'=>array('controller'=>'controllerName'))): There was a ticket on this before and I tested it. Try to search https://trac.cakephp.org and see if the previously reported problem is similar to yours. --~--~-~--~~~---~--~~ 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: Pagination through requestAction
Your article on the bakery is great. The only thing I miss is controlling the pagination through the paginator helper. Is there any way to use the functions $paginator->prev and $paginator->next with the requestAction approach? I tried but the links generated alway refers to the controller associated with the current view and not at the one in the requestAction function. thank you so much for your work! On Apr 13, 4:35 am, "gwoo" <[EMAIL PROTECTED]> wrote: > Hisickrandir > > You question prompted me to post an article on the bakery on creating > reusable elements. > Have a look.http://bakery.cakephp.org/articles/view/342 > > Hope it helps. --~--~-~--~~~---~--~~ 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: creating static links to documents
I'm not sure if this is right, but I would personally just put in the static HTML in the view if it's going to be static content. As for where to put the documents, put the somewhere accessible from the web (perhaps somewhere under app/webroot, or somewhere else if you have a system in place). Link Text On Apr 13, 12:29 pm, "jyrgen" <[EMAIL PROTECTED]> wrote: > hi all, > i am wondering how to create static links with the link helper > (for example to a pdf) and where to put the files. > $html->link always rendershttp://host/cake/index.php/controller/action > which i don't want in this case. > thank you ! > jyrgen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
creating static links to documents
hi all, i am wondering how to create static links with the link helper (for example to a pdf) and where to put the files. $html->link always renders http://host/cake/index.php/controller/action which i don't want in this case. thank you ! jyrgen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Usage of query()
>From glancing at the code (1.2), it seems that model::query() can do more than just take a string argument. Is there anywhere that has details as to the possible syntax for the query() function, or should I wade through the code and figure it out? :) I'm using it because I need to pull all the possible values for a single field in a table, and I'd rather not do a findAll, then go through each record and make my own list of possible values. Instead, I'd like to just do a select distinct -- but there is a possibility the table name may change in future applications, so I'd like to keep the query compatible with Cake's other tenants. The query: select distinct academic_year from faculty The return: All possible years in the table --~--~-~--~~~---~--~~ 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
Your add function shouldn't really need a parameter associated with it. Edit/View/Delete controller actions use it, but there is no id associated with an add. When you call add, you are calling /country/ add without a parameter, but your $region_id = null section is defaulting it to 0. I'm assuming you want to call /country/add/3 to make whatever country you next add be placed in the region_id equal to 3 in the following example. function add($region_id = null) { if (empty($this->data)) { $this->set('region_id', $region_id); } else { if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries', 2); } } } You could also do the URL /counter/add?region=3 as follows... function add() { // On first page load, set region id if it was passed in the url if (empty($this->data)) if (isset($this->params['url']['region'])) { $this->data['Country']['region_id'] = $this->params['url'] ['region']; } } else { if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries', 2); } } } and have your HTML tag look something like (not sure if syntax is correct) echo $html->hidden('Country/region_id', array( 'value' => $html->tagValue('Country/region_id')); I use the parameters as "suggestions" for what values should be defaulted to when the page opens. You can then still display a select box for the region if you'd like the user to change it to something else, or continue using the hidden value and just display the text using the $html->tagValue(). On Apr 13, 9:41 am, "ifcanduela" <[EMAIL PROTECTED]> wrote: > 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
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: cake 1.2 paginator modificaions
This is what I did. Page counter(); ?> current() != 1) { $this->params['pass']['page'] = 1; echo $paginator->link("<< First", $this->params['pass'])." | "; } else { echo "<< First | "; } ?> prev('< Previous', null, null, array('class' => 'disabled')); ?> | next('Next >', null, null, array('class' => 'disabled')); ?> current() != $paginator->params['paging'][$paginator->defaultModel()]['pageCount']) { $this->params['pass']['page'] = $paginator->params['paging'][$paginator->defaultModel()]['pageCount']; echo " | ".$paginator->link("Last >>", $this->params['pass']); } else { echo " | Last >>"; } ?> But there are 2 problems with this approach. 1. my main controller is messages, so if I access the page with /messages, then it properly creates the url as /messages/page:1 or /messages/page:xx, etc., If I change the routes to goto /messages if I hit '/' root, then it creates url like /page:1 and /page: instead of creating /messages/index/page:1, where as the next and previous links are created correctly. 2. Sorting, if you click on any sorting and click on the first and last page link this way it misses the sorting information and throws error page. Probably I am missing something here.. can somebody help me ? http://ps.namo-namaha.net/messages http://dev.ps.namo-namaha.net/messages Regards Humble On 4/13/07, byBartus <[EMAIL PROTECTED]> wrote: > > > Hi, > > What I made to achieve the page numbers was simpler than to hack the > core, as Nate explained in another one thread. > > > in the view (list.ctp) === > > $params = $paginator->params(); > > echo $paginator->prev('<< Prev'); > > echo ''; > > for ($i = 1; $i <= $params['pageCount']; $i++) { > if ($i == $params['page']) { > echo ''.$i.''; > } else { > echo ''.$paginator->link($i, array('page' > => $i)).''; > } > } > > echo ''; > > echo $paginator->next('Next >>'); > ?> > > I only added the UL and LI itens for the numbers, that I think to be > more semantic than EM. > > But to achieve the the link to the first or last page i do not know > what to do. > > Perhaps this gives you another idea. > > T+ > > > > > On Apr 12, 9:37 am, "francky06l" <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I am upgrading an application to cake 1.2 and needed to convert to the > > new paginator. > > I have amended the paginator helper to include : > > > > pageNumber : to get the number of pages > > hasFirst: to display an eventual First link > > hasLast: to display an eventual Last link > > > > For this I needed to modify slightly the _paginLink method (only > > little, because it always takes the current page + step ..etc ..) > > > > I also have added '' in the paginator's numbers function in > > order to make easier to apply a style on the current page (which is > > not a link).. > > > > I do not know if this modifications should be shared (maybe someone > > better than me can check the code), I can post the code here if that > > helps someone .. > > I also have done a Component to work with the paginate in controller, > > in order to save the conditions in sessions and be able to do a "back > > to list", when the list have been replaced by an edit view .. but I am > > sure it does not handle all cases (sort etc ...). > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: What is the best source for CakePHP v1.2 documentation?
On 4/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > What and where is doxygen? http://www.google.co.in/search?q=doxygen First link T -- = PHP for E-Biz: http://sanisoft.com Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org = --~--~-~--~~~---~--~~ 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: Date Formatting
You might also look at the Time helper some great functions there http://manual.cakephp.org/chapter/helpers and in the api http://api.cakephp.org/class_time_helper.html HTH Sam D On 4/13/07, Marcus T. Jaschen <[EMAIL PROTECTED]> wrote: > > EricS wrote: > > I have only spent a few weeks on cakephp but so far I love it. > > However, I have one issue I can't get past. I am having a really hard > > time getting dates formatted. I searched this group but wasn't able > > to get anything working. > > > > The date is stored in the database as a datetime. I am trying to show > > the last 5 entries to the database sorted by the created date desc. I > > have the entries showing fine, in the correct order even. The date is > > in a datetime format and I would prefer just MM/DD/. > > > > In my view I have the following > > > > > > > > On the first record I get this error message: "Notice (8): A non well > > formed numeric value encountered [CORE\app\views\restaurants > > \index.ctp, line 16]" > > Use strtotime(): > > > > M. > > > > > -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-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 -~--~~~~--~~--~--~---
Re: Populating a hidden field
It might be a typo but you have a period instead of a comma on the line $this->set('region_id' . $region_id); 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); } } } On Apr 13, 7:03 am, "ifcanduela" <[EMAIL PROTECTED]> wrote: > 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 -~--~~~~--~~--~--~---
Re: Populating a hidden field
On Apr 13, 7:03 am, "ifcanduela" <[EMAIL PROTECTED]> wrote: 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're close - try making the following line: $this->set('region_id' . $region_id); to the first of your function. You're only setting $region_id in the view when (!empty($this->data)). This is only true once the blank form has been filled in and submitted, so the first time Cake generates your blank form $region_id is not being set. --~--~-~--~~~---~--~~ 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: Autocompletion Options
I need to do exactly the same thing. Anyone has found a solution ? --~--~-~--~~~---~--~~ 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: What is the best source for CakePHP v1.2 documentation?
What and where is doxygen? On Apr 12, 9:44 pm, "Copongcopong" <[EMAIL PROTECTED]> wrote: > try to download doxygen to parse the documentation off the cakePHP 1.2 > source. > > On Apr 13, 3:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:> OK, I am > probably doing something else wrong then. Thanks for the > > clarification. > > > A related question then - what controller and method do I need to > > enable the use of $content_for_layout on the home page (app/views/ > > pages/home.ctp) or if this is not correct, what is a viable > > alternative? > > > On Apr 11, 5:19 pm, "nate" <[EMAIL PROTECTED]> wrote: > > > > Uh, not sure where you got that idea, but $content_for_layout is still > > > pretty valid. Right now, there isn't a whole lot of documentation on > > > 1.2, since it's still mostly a moving target. Once the API is stable, > > > you'll see a lot more information out on it. > > > > On Apr 11, 7:44 pm, "Aaron Thies" <[EMAIL PROTECTED]> wrote: > > > > > I recently started playing with CakePHP v1.1 but then decided to start > > > > using v1.2 for the internationalization. Quickly I see there are > > > > several changes. Like $content_for_layout is now no longer valid. > > > > How do I do this in v1.2? What is the best place to go for > > > > documentation on v1.2? > > > > > -- > > > > Aaron Thies > > > > > "When you're married you'll understand the value of fresh produce." > > > > - Tony Soprano --~--~-~--~~~---~--~~ 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
Hi, if you use this [code] if (!empty($this->data)) { $this->set('region_id' , $region_id); if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries', 2); } } [/code] that means, if the $this->data array is not empty, so it contains data.. you are filling the $region_id with the needed data. But you dont need that here. Instead you should do something like this. [code] function add($region_id = null) { if (!empty($this->data)) { if ($this->Country->save($this->data)) { $this->flash('New country added.', '/countries', 2); } } else { $this->set('region_id' , $region_id); } } [/code] (NOTE: there is a , between the region_id and $region and not an . ) So now if you call the add view, your var should be filled with the data, and if you submit the form, it only saves the data.. greets Hawk On 13 Apr., 15:03, "ifcanduela" <[EMAIL PROTECTED]> wrote: > 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 -~--~~~~--~~--~--~---
Components and Database
Hello - I am kind of new to Cake and I am unsure about how to structure a piece of development I need to do. I want to create a Tracker feature whereby I will track users actions on my website. It is fairly simple: - when a user first arrive on the site, I record his IP in a session and on a "user" able (no authentication) - subsequently each time the user perform an action on the site (navigate through pages) I will record for that user an action : type of action , parameters for the action. For example the user selected a Tag to be displayed (action = select tag) and the tag is "Sun" (parameter = sun). I have 2 tables to implement this: user (id, ip adress...) and action (id, action, parameter, time, user_id). The user has many action. I was thinking of creating a component to implement this that I can call with all the controllers. Each controllers will add actions to the tables. The component will need to have access (essentially Write) to the two tables. My questions are: - how can I include a model (for my 2 tables) in a component AND is this the right thing to do? - is creating a component the right solution? Many thanks! -Vincent --~--~-~--~~~---~--~~ 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: how should I set up these complex associations?
You mean in the model? I've tried that before, but it doesn't change the error. I think there's something wrong with my associations in general, because I get an array that looks different from what I had hoped for, and the error stays too. (It goes away when I remove the page->widget association, which is in a way understandable, because a page contains no widgets: a page contains layers, which in turn contain widgets. It's hard for me to have a clear understanding of how I should set this up. On 13 apr, 13:38, "Mike Griffin" <[EMAIL PROTECTED]> wrote: > On 4/13/07, gerbenzomp <[EMAIL PROTECTED]> wrote: > > > But I think this isn't the right approach, because I get the error: > > SQL Error in model Page: 1052: Column 'id' in order clause is > > ambiguous > > You need to use the model name in front of the id as well. > Something like Page.id or Widget.id, depending on which one you want. > > Mike. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Date Formatting
EricS wrote: > I have only spent a few weeks on cakephp but so far I love it. > However, I have one issue I can't get past. I am having a really hard > time getting dates formatted. I searched this group but wasn't able > to get anything working. > > The date is stored in the database as a datetime. I am trying to show > the last 5 entries to the database sorted by the created date desc. I > have the entries showing fine, in the correct order even. The date is > in a datetime format and I would prefer just MM/DD/. > > In my view I have the following > > > > On the first record I get this error message: "Notice (8): A non well > formed numeric value encountered [CORE\app\views\restaurants > \index.ctp, line 16]" Use strtotime(): M. --~--~-~--~~~---~--~~ 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: how to add tracking code in new flash lay out
You may never know what results come of your action, but if you do nothing there will be no result. - Mahatma Gandhi On 4/13/07, rajasekhar <[EMAIL PROTECTED]> wrote: > > Hallo, > > i want to add tracking code in new flash layout, how to add it, and > how to access it. > > urs, > rajasekhar. > > > > > -- = PHP for E-Biz: http://sanisoft.com Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org = --~--~-~--~~~---~--~~ 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: how to add tracking code in new flash lay out
On 4/13/07, rajasekhar <[EMAIL PROTECTED]> wrote: > > > Hallo, > > i want to add tracking code in new flash layout, how to add it, and > how to access it. > Rajasekhar, Please don't take this in a bad way, I just thought I'd give you a word of advice since you're fairly new to the group and you seem to be asking a lot of questions that are very common. In my experience with mailing lists, groups, etc ... people are more willing to help if you demonstrate that you've researched a topic and turned to the group for further advice or help. If for some reason you haven't researched the topic, then you could turn to the group and explain *in detail* what you are trying to accomplish. Your explanation of "i want to add tracking code in new flash layout, how to add it, and how to access it" does not explain very well (to me at least) what you are trying to do, and like I said, it's probably a topic that Google could well return a myriad of hits. If you get stuck somewhere along the way, turning to the group is fine, but you should always give a detailed explanation and always try to research first. Not only will people be more willing to help, but you'll learn lots more along the way by doing it yourself. Hope this helps. Best regards, Gonzalo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to add tracking code in new flash lay out
Hallo, i want to add tracking code in new flash layout, how to add it, and how to access it. urs, rajasekhar. --~--~-~--~~~---~--~~ 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: Passing data between models
I would simply add "is_approved" field to userAdmin table... --~--~-~--~~~---~--~~ 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: cake 1.2 paginator modificaions
Hi, What I made to achieve the page numbers was simpler than to hack the core, as Nate explained in another one thread. in the view (list.ctp) === params(); echo $paginator->prev('<< Prev'); echo ''; for ($i = 1; $i <= $params['pageCount']; $i++) { if ($i == $params['page']) { echo ''.$i.''; } else { echo ''.$paginator->link($i, array('page' => $i)).''; } } echo ''; echo $paginator->next('Next >>'); ?> I only added the UL and LI itens for the numbers, that I think to be more semantic than EM. But to achieve the the link to the first or last page i do not know what to do. Perhaps this gives you another idea. T+ On Apr 12, 9:37 am, "francky06l" <[EMAIL PROTECTED]> wrote: > Hello, > > I am upgrading an application to cake 1.2 and needed to convert to the > new paginator. > I have amended the paginator helper to include : > > pageNumber : to get the number of pages > hasFirst: to display an eventual First link > hasLast: to display an eventual Last link > > For this I needed to modify slightly the _paginLink method (only > little, because it always takes the current page + step ..etc ..) > > I also have added '' in the paginator's numbers function in > order to make easier to apply a style on the current page (which is > not a link).. > > I do not know if this modifications should be shared (maybe someone > better than me can check the code), I can post the code here if that > helps someone .. > I also have done a Component to work with the paginate in controller, > in order to save the conditions in sessions and be able to do a "back > to list", when the list have been replaced by an edit view .. but I am > sure it does not handle all cases (sort etc ...). --~--~-~--~~~---~--~~ 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: how should I set up these complex associations?
On 4/13/07, gerbenzomp <[EMAIL PROTECTED]> wrote: > But I think this isn't the right approach, because I get the error: > SQL Error in model Page: 1052: Column 'id' in order clause is > ambiguous You need to use the model name in front of the id as well. Something like Page.id or Widget.id, depending on which one you want. Mike. --~--~-~--~~~---~--~~ 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: how should I set up these complex associations?
I'll try to be a bit more specific: my main problem is that a Widget belongs only to the combination of layer and page, and is linked through layer_id and page_id. A page in turn only has an association with a layer through the design model. Right now I have this: class Page extends AppModel { var $name = 'Page'; var $belongsTo = array('Design' => array('className' => 'Design', 'conditions'=> '', 'order' => '', 'foreignKey'=> 'design_id' ) ); var $hasMany = array('Widget' => array('className' => 'Widget', 'conditions'=> '', 'order' => 'Page.url', 'foreignKey'=> 'page_id' ) ); } class Layer extends AppModel { var $name = 'Layer'; // a layer holds many widgets var $hasMany = array('Widget' => array('className' => 'Widget', 'conditions'=> '', 'order' => 'Widget.order_id DESC', 'limit' => '', 'foreignKey'=> 'layer_id', 'dependent' => true, 'exclusive' => false, 'finderQuery' => '' ) ); // a layer belongs to a design var $belongsTo = array('Design' => array('className' => 'Design', 'conditions'=> '', 'order' => 'Design.id DESC', 'limit' => '', 'foreignKey'=> 'design_id', 'dependent' => true, 'exclusive' => false, 'finderQuery' => '' ) ); } But I think this isn't the right approach, because I get the error: SQL Error in model Page: 1052: Column 'id' in order clause is ambiguous The error only goes away when I remove the association between Page- >Widget I could also do a custom query: query("SELECT * from widgets_table WHERE page_id = $page_id AND layer_id = $layer_id); but I think that would be a hack. I just don't know how to set up the associations. Any help is appreciated! On 13 apr, 00:03, "gerbenzomp" <[EMAIL PROTECTED]> wrote: > I've been trying to get the associations right, but I somehow got lost > in my thinking about how every model relates to the other. Maybe > someone can have a fresh view on my problem. > > I've put all my models between "" in this explanation, so it is easier > to read. > > I have several models: > > All the "Pages" in a "Site" share the same "Design" > Each "Design" has many "Layers", and each "Layer" can have many > "Widgets", BUT the widgets in each layer are also dependant of the > current "Page". > > Every "Page" in a site uses the same "Design" and thus the same > "Layers", but the widgets in the layers can vary from page to page. > > I hope I'm being clear in my description above. > > I was able to set up the relations to a good degree, but got stuck > when I realised that widgets don't belong to a layer, but ONLY to the > combination of "Page" and "Layer". And layers belong to a design, but > widgets DON'T belong to a design. > > Any ideas how this would translate to Cake associations? > > Any help in my thinking about this would be appreciated as well :) --~--~-~--~~~---~--~~ 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: brainstorming: associations for user types?
On Apr 13, 3:39 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On 4/13/07, R. Rajesh Jeba Anbiah <[EMAIL PROTECTED]> wrote: > > This is what I would do but probably a better solution exists > > > 1. I'm totally lost what should be the foreign key in other tables, > > say transactions? > >user_id or admin_id/clerk_id/waiter_id ? > > user_id and for a good measure I would store the role as well in this > table (a bit of redundant data will not hurt much but help a lot in > easily pulling up the associated profile data > > > 2. What would be the ideal setup: > > (a) All users profiles should be accessible with user/view/ with > > view slightly altered for different user types? > > (b) User profiles are accessible with their user types, say admin/ > > view/, cleark/view/, waiter/view/ > > (b) more code but more clear Amazing, thanks a lot. I'm convinced:) -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ 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: brainstorming: associations for user types?
On 4/13/07, R. Rajesh Jeba Anbiah <[EMAIL PROTECTED]> wrote: This is what I would do but probably a better solution exists > 1. I'm totally lost what should be the foreign key in other tables, > say transactions? >user_id or admin_id/clerk_id/waiter_id ? user_id and for a good measure I would store the role as well in this table (a bit of redundant data will not hurt much but help a lot in easily pulling up the associated profile data > 2. What would be the ideal setup: > (a) All users profiles should be accessible with user/view/ with > view slightly altered for different user types? > (b) User profiles are accessible with their user types, say admin/ > view/, cleark/view/, waiter/view/ (b) more code but more clear HTH Tarique -- = PHP for E-Biz: http://sanisoft.com Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org = --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
brainstorming: associations for user types?
Situation: Say for the restaurant website, I have user types: admin, clerk, and waiter and they have different kind of profile pages. Current setup: * users table with common fields for all user types (mostly othAuth users table) * profiles are maintained in admins, clerks and waiters table with user_id as foreign key * Associations: Admin belongsTo User, Clerk belongsTo User and Waiter belongsTo User Questions: 1. I'm totally lost what should be the foreign key in other tables, say transactions? user_id or admin_id/clerk_id/waiter_id ? 2. What would be the ideal setup: (a) All users profiles should be accessible with user/view/ with view slightly altered for different user types? (b) User profiles are accessible with their user types, say admin/ view/, cleark/view/, waiter/view/ (admin, clerk and waiter have different access levels) TIA -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Email Component - sendAs 'both'
Does anybody managed to send a proper email using sendAs='both' ? I mean, the email get sent though it doesn't render in Outlook. When I take a look at the content it looks fine, let me show you : --2c465d8ee9966e81e9538e3c53d623d2 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Here is the template body text. check for value --2c465d8ee9966e81e9538e3c53d623d2 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Here is the template body text. check for value --2c465d8ee9966e81e9538e3c53d623d2-- Here's what get sent with 'both' .. not sure but there's something wrong with headers if it is not showing up in Outlook (blank page) ? Any suggestions ? Thanks, Andrzej --~--~-~--~~~---~--~~ 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: Storing settings / Persistent data
http://bakery.cakephp.org/articles/view/243 On Apr 12, 6:44 am, "AD7six" <[EMAIL PROTECTED]> wrote: > On 10 abr, 15:48, "cherrio" <[EMAIL PROTECTED]> wrote: > > > > > Hey All, > > > a question about persistent data. I was using a Config method that I > > got from the old Wiki, but when I upgraded to 1.1.14.4797 this broke. > > So I checked the Bakery again and found > > thishttp://bakery.cakephp.org/articles/view/61, > > having trouble getting this one working too. But both (the old and new > > method) have the same problem I think, namely for each configuration/ > > setting lookup it has to query the database. > > > So I am trying to roll my own (or can some one suggest an > > alternative?) that has the following features I want, > > > 1. One static instance, available to all controllers > > > 2. Lazy instantiation of database connection, i.e. when the first > > get($key) called > > > 3. When it is instantiated it should select all key/value pairs from > > the database and store them in an associative array > > > 4. when the second and subsequent get($key) function call occurs, > > should return the value from the associative array rather than DB > > lookup > > > 5. Have a method called set($key, $value), that updates the > > associative array and possible the database (depending on where/how db > > is updated). > > What does the bakery article not tick off your list? > > Regarding point 1 you would just want to create an init method which > you would call as the first line of your read/write method to do "if > there is not instance loadModel('Setting'); $this->Instance = new > Setting(); etc. > > If you make the change to 1.2, I think the Configure:: class will > probably do most if not all of what you want. > > hth, > > AD --~--~-~--~~~---~--~~ 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: how to create new flash layout and a corresponding function
hallo Gerben, thank you for the reply, its useful, On Apr 13, 12:21 am, "gerbenzomp" <[EMAIL PROTECTED]> wrote: > Take a look at RosSoft's excellent > pdf:http://rossoft.wordpress.com/2006/06/24/blog-tutorial-chapter-3-done/ > > It contains a section about how to create your own custom flash > layouts, and how to write a function that calls this layout. > > I've found it quite useful. > > Gerben. > > On 12 apr, 16:16, "rajasekhar" <[EMAIL PROTECTED]> wrote: > > > hallo, > > > i have some doubts in generating a new flash layout, and which > > function want to use to execute/call this flash layout. > > > Rajasekhar. --~--~-~--~~~---~--~~ 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: CakePHP on shared hosting
On 13 abr, 09:31, "mark-magoo" <[EMAIL PROTECTED]> wrote: > I have a shared hosting account through Aplus ( i know not the best > hosting). But since i have an account there i'd like to setup cakePHP > if possible. The problem is i only have a html folder , no www, or > root or var..is there any way i can get cakephp to work on a > shared hosting account? I didn't find any documentation that told me > it was possible. > > thanks Whether you use a shared host or not, the installation process is the same - unzip cake somewhere web accessible, browse to it. hth, AD --~--~-~--~~~---~--~~ 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: What does define('LOG_ERROR', 2); do?
Cool. it is a error constant. Maybe that should go into the comment in the code. Else some one else will go down this path which I had taken! Chin Yong http://www.ablewise.com On Apr 12, 9:46 pm, "nate" <[EMAIL PROTECTED]> wrote: > It basically fills in for PHP on an error constant that's not there > but should be. Seehttp://us.php.net/syslog > > On Apr 12, 7:33 am, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote: > > > On 4/12/07, redhex <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > Under the config core.php. line 64 there is this line: > > > define('LOG_ERROR', 2); > > > The manual does not state what LOG_ERROR does or what the constant > > > means. Hence I am asking what does it do? Any changes that is required > > > for this constant for a developement or production server? > > > I didn't know what it did either until now :) I did a grep -r 'LOG_ERROR' of > > my cake dir and it looks like it is used as the "type" for the function > > "log" (defined in libs/object.php): > > > function log($msg, $type = LOG_ERROR) { } > > > In core.php, the phpdoc comments says: > > > /** > > * Error constant. Used for differentiating error logging and debugging. > > * Currently PHP supports LOG_DEBUG > > */ > > > Which is reflected in object.php as it only differentiates between LOG_DEBUG > > and anything else in the log function. So, going back to your question, I'm > > not entirely sure what that number does since the log function doesn't seem > > to do much with it. > > > HTH, somewhat :) > > > Regards, > > Gonzalo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP on shared hosting
I have a shared hosting account through Aplus ( i know not the best hosting). But since i have an account there i'd like to setup cakePHP if possible. The problem is i only have a html folder , no www, or root or var..is there any way i can get cakephp to work on a shared hosting account? I didn't find any documentation that told me it was possible. thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---