Routing special route to subdomain (Cake 1.3)
Hello, I still use Cake 1.3 and I have a requirement I don't know how to solve: I want to route single an special route to a subdomain. For example the route Router::connect('/news/', array('controller' => 'news', 'action' => 'show')); show be displayed under http://subdomain.domain.com but all other routes/links should show to http://domain.com How can I solve this? Best regards, Timo -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How can I get the ID of a Post as its saved for the first time?
If I'm not mistaken the id of the latest saved record is $this->model->id "Value of the primary key ID of the record that this model is currently pointing to. Automatically set after database insertions." http://api20.cakephp.org/class/model There's also the two functions getInsertID ( http://api20.cakephp.org/class/model#method-ModelgetInsertID ) and getLastInsertID ( http://api20.cakephp.org/class/model#method-ModelgetLastInsertID ) though I cannot tell you the difference between those two. Hope that helps :) Am Freitag, 27. Juli 2012 11:43:52 UTC+2 schrieb bigjimmi: > > Is it possible within a Add() function to find the ID of a post just as > its written to the DB? > > Basically I'm trying to create a ACO for the post when its saved by doing > something like this: > > $aco = $this->Acl->Aco->create(Array('model'=>Post, foreign_key=>'')); > > Where is the ID of the post that's just been saved within the same > function. > > Thanks in advance > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Ajax Pagination only works once (no javascript loaded)
Thank you for your input, lowpass, and excuse my late reply. I found out that what I had to do to get it to work the way I thought it would work was quite simple - despite my having echo $this->Js->writeBuffer(); at the end of my default-layout, I've included the line on every, which of course isn't all too elegant, but somehow just having it in my default layout doesn't work. Timo -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Ajax Pagination only works once (no javascript loaded)
Update: After some questioning in the #cakephp irc channel I've found out or rather was pointed to the fact that I'd need to rebind my javascript functions. I've done so for other divs that are loaded into the current dom, but how would I go about this for my pagination? The links that are created by the PaginatorHelper when using Ajax look like this: $("#link-1983047312").bind("click", function (event) {$.ajax({dataType:"html", evalScripts:true, success:function (data, textStatus) {$("#tableWrap").html(data);}, url:"\/companies\/index\/page:1"}); Inside a $(document).ready block at the end of the page. Or rather the links should be bound by live() instead of bind(), is there an easy way to do this or, alternatively, can someone kindly point me to a Ajax Pagination example viable for Cake 2.1? Thanks in advance again Timo -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Ajax Pagination only works once (no javascript loaded)
Hello everyone :) I'm trying to implement Ajax Pagination as described here: http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#ajax-pagination I've followed all the steps and the ajax loading does work - but only once. When I click another page of the table, the whole webpage is reloaded. It seems that no javascript is loaded or working after the first pagination load, which I can deduce from the fact that other javascript functions do not work either (e.g. function to colour the background of even and uneven table rows differently doesn't work). How do I solve this? Why does no javascript (especially no pagination itself) work after one pagination load via ajax? Thanks in advance for any advice Timo -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Some Issues: multiple views on one page and help with javascript
Hi :) thank you both for your advice, it helped me to get going and so far I was able to implement the design I had in mind using elements and ajax. Should I encounter more difficulties, I will post them here. Oh and bs28723: No worries that you might've been too basic, I'm always glad for any advice, especially since I'm just beginning to learn Cake :) Timo -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Some Issues: multiple views on one page and help with javascript
Thanks a lot for your answer, it helped me a lot! I see how elements can be used for what I am trying to do. I tried the simple example from the link you provided, so now I can populate multiple ares of one page with different views - that's great! What I don't quite grasp is the usefulness of adding a helper as you mentioned in your last paragraph. So basically the helper would get all the data for my elements instead of me calling requestAction multiple times? I was told that AJAX can be used to put content into element areas (via requestAction, too?), e.g. I have my slideout visible which shows a data entry, then, with my table still visible in the main content area, I choose edit on a different entry and instead of loading the page anew, the slideout element loads new content. How would one go about this task? A simple example would be enough to get me started, since I cannot find any useful ones, e.g. a button that triggers an element to be filled with a different view. I am aware of the .load function in JQuery ( http://api.jquery.com/load/ ), but that does not explain how to include such functionality in a CakePhp environment. Can I simply use something like 'controllername/add' as url parameter for load? As I see it, one issue remains despite the element solution (which might result from my limited Cake knowledge) - concrete example: The application has tables for companies, users and posts, each table and corresponding controller has index / add / view(show the data) / edit views. Index is displayed in the main area, the other views are supposed to be displayed in the slideout. Would I not need many different element specifications depending a) on the chosen table b) the chosen option (add / edit / etc) ? Is there a way to put for example the rendered view of "View/Company/add.ctp" into an element? Because as far as I understand requestAction, I can only get the data provided by the controller (which makes sense due to the MVC pattern) and this data still has to be echoed and styled. And that is the problem since there is not a common style for add / edit / view (add and edit would have inputs for data values, view would use labels). My thought would be to put those options into one element and control which style is used by a parameter given to the element, I just want to know if that is viable or if there is another, better way to do this. I hope that was somewhat intelligible :) Many thanks in advance for any helpful advice Timo -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Some Issues: multiple views on one page and help with javascript
Hello everybody, since I am fairly new to CakePhp and since my research has not yielded any definitive results concerning my specific problem so far, I figured the best thing to do would be to ask here. :) Bear with me, this is going to be rather elaborate, I fear... I'm creating an application with CakePhp (2.1) and Javascript / JQuery, one basic functionality is that table entries can be viewed in different ways, to which I will come in a moment. My main content area consists of 2 sub divisions, one is the actual main content, the other is a horizontally sliding area which can be toggled on and off (in the following text referred to as "accordion"). I will attach an image at the end of the post to exemplify what I mean. The afore mentioned different views ( / edits / adds) are: *1. Standard view* would be in accordion which is hidden until a table entry is chosen, once the view is triggered, the area is supposed to slide from the right side into the screen and overlap the underlying table, the area can be toggled on and off. Basically it acts as a horizontal accordion window, the user is able to quickly manipulate table entries, hide the entry to look something up in the table, and show the entry again to continue whatever he was doing before. *2. Fullscreen view *is supposed to be rendered in the actual main content area, in this view the table is transferred to the accordion, basically table and table entry swap positions. Another aspect of the application is that table entries can be stored in "favourites" or "clipboard", those two are small windows which can be shown on any page of the application and which are also part of the start page. Now that I have started to try to implement this layout, I have encountered some problems, which might result from me being a beginner in CakePhp. After baking controllers and models via the console, I created the index view for one controller ("companies") and went on to the "add" view for this controller. Naive as I was I simply put the generated "add" view code in the accordion div and left the table (index view) code in the main area div which led to errors. So if I understand this correctly, I cannot simply fill 2 divs with different view contents from only one query, which makes sense. My research led me to the "elements" functionality of cake, though I could only find the cookbook entry for 1.3 ( http://book.cakephp.org/1.3/view/1081/Elements ). Please tell me whether this will help me with my problem, or if there is a better, simple solution for what I am trying to do. (I might have to fill not only the accordion and the main content area with data entries, but also the "favourites" and "clipboard" area once the user clicks the button to show those). I also searched for a way to "fetch" multiple content in my default layout like echo $this->fetch('content'); echo $this->fetch('accordion'); but I did not find anything. So this is my first issue. A second one: When the user clicks on a table entry in the table, an option menu is shown at the mouse position from which the user can choose to edit, delete or view the clicked entry. This option menu is also shown when the user clicks on an entry in the favourites or clipboard area. Is there a way to combine PHP and Javascript to determine, which kind of data is clicked (e.g. which controller must be used)? And furthermore, is there a way to integrate (cake)php in code in javascript? Example: $('#listEditButton').click(function(){ window.location.href="companyEdit.html"; }); Instead of window.location.href="companyEdit.html"; the cakephp edit view for the correct controller should be triggered. *Breathes deeply* Excuse my excessive question, but I just started with CakePhp (did research, went through the blog tutorial - which as far as I can tell does not cover what I need for my application), maybe I even missed some CakePhp functionalities which provide exactly what I am looking for. To sum it up: *1. Multiple Views on one page: *How does one for example show the index view AND the view of one entry of a controller on a single page with CakePhp. *2. Javascript and CakePhp: *How do you use CakePhp view "calls" in javascript, is this even possible, how would one approach the above problem with the option menu (if there is any way apart from separate option menus for all pages AND for "favourites" and "clipboard"). If you have read all the above - Thank you very much! I would have put this in caps but that is just hurting for the eyes. I hope someone can help me and put me on the right way to what I am trying to do :) Kindest regards Timo Attachment: <https://lh6.googleusercontent.com/--4enSImYE8U/T40rbqL-DFI/AAk/SNHq
Re: Security issue with Model->save() when adding data (Cake 1.2)
My proposed fix in the trac ticket is that if there is a fieldList parameter, 'id' has to be in that list otherwise it won't be set. I think this is really important as a default behaviour for cake. It's rather confusing that you have a whitelist but 'id' gets thru. It's dangerous. Just to make shure you understand what happens: You have an add method in your controller: function add() { $this->Model->create(); $this->Model->save($this->data, true, array('field1,'field2')); } So if someone adds an 'id' field in your add form your add method overwrite existing record, despite you used create() and a whitelist. Don't get me wrong the above sample is just very simplified. Cheers, Timo On 9/4/07, francky06l <[EMAIL PROTECTED]> wrote: > > You could also hash your id in an hidden field, and when receiving the > form, hash again the id and compare with the hidden hashed field. To > trick you would have to find the hash string also ..a bit harder. That > with the Security should cover your needs. > Hope this helps > > On Sep 4, 7:00 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > On 9/4/07, J. Eckert <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi there, > > > > > There seems to be a security issue with the Model->save() function in > > > Cake 1.2 if you are adding data through a form. > > > > I don't know if you already checked it out, but there is a Security > > component that I think might help alleviate some of your fears about > > the exact type of attack you are talking about: > > > > http://manual.cakephp.org/chapter/security > > > > There have also been a few threads on this mailing list about it as > > well, so I also suggest searching those out via the Google Groups > > interface. > > > > Hope that helps. > > > > -- > > Chris Hartjes > > Senior Developer > > Cake Development Corporation > > > > My motto for 2007: "Just build it, damnit!" > > > > @TheBallpark -http://www.littlehart.net/attheballpark > > @TheKeyboard -http://www.littlehart.net/atthekeyboard > > > > > -- Timo Derstappen http://teemow.com mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: Security component and forms
probably to make searches linkable. On 8/14/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > On 8/14/07, Timo Derstappen <[EMAIL PROTECTED]> wrote: > > > > I admit that there are very few use cases, but there is one already > > mentioned by sergerod: searches. Have a look at google's search box. > > So because Google uses a GET form for doing searches, that is somehow > the accepted way to do it? The *real* question is *why* Google chose > to do it as a GET request as opposed to a POST request. Perhaps > something to do with the amount of data submitted as part of a POST? > > I have no idea, but it's an interesting (and totally offtopic) thought. > > > -- > Chris Hartjes > Senior Developer > Cake Development Corporation > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark - http://www.littlehart.net/attheballpark > @TheKeyboard - http://www.littlehart.net/atthekeyboard > > > > -- Timo Derstappen http://teemow.com mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: Security component and forms
I admit that there are very few use cases, but there is one already mentioned by sergerod: searches. Have a look at google's search box. On 8/14/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > On 8/14/07, teemow <[EMAIL PROTECTED]> wrote: > > > > What's the security difference between GET and POST. This has nothing > > to do with security. > > My fault for not fully explaining myself. You are correct that GET > and POST have nothing to do with security. > > > Semantically and for the sake of REST: If you use a form to retrieve > > something from your application, it may even more make sense to use a > > GET. On the other hand if you change something (add/update) with your > > form you should definitely use a POST. > > Interesting advice, but I've made it a personal practice to never > create a form that uses GET. I'd love to hear a good, constructive > reason for when a GET is preferred to a POST when creating a form that > submits information somewhere. I don't see any reason to use GET for > a form. > > -- > Chris Hartjes > Senior Developer > Cake Development Corporation > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark - http://www.littlehart.net/attheballpark > @TheKeyboard - http://www.littlehart.net/atthekeyboard > > > > -- Timo Derstappen http://teemow.com mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: MySQL Dump and Restore with Cake
> I had a look at this before but didn't want to get into it yet until I have > do my first release. Then I might use it for migrations. I never thought of > it for testing though. thinking of automatic deployment it is much worth to even create your very first database tables with migrations. > I've been having some discussions about this topic on some other forums and > I think it'd be more suitable to mock the Model from the controller, but > when testing the Models themselves I should test against a real > database.. I think. i would say that a unit test doesn't test any database presence or functionality, but with cake models i've also done some testing against a database. i keep this test database up to date with migrations and usually do some cleanup (truncate) in the setup/teardown methods. greez, timo -- Timo Derstappen http://teemow.com mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Paradigm shift :: Procedural -> OO Paterns based development
kestrelid, If you set up the model associations correctly, you'll be able to save associations in one transaction. HasMany + HasAndBelongsToMany can both be saved in one cake 'method call'. But this doesn't mean your data is brought back to you by just one query or updated by one. But there's nothing wrong with that. Espically not when its a small and private app like this one. Have a look at the api, if you search for the controller methods youll find a lot of usefull stuff. You can, if you want, hack all the code you please into cake, that's what makes it great, no limitations. If you want to build a function directly in your view you can :-) but cake has helpers so you don't have to. The same with everything else. goodluck! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple form values of the same type
Hey i want to add multiple values of the same type to my database. like this: My question is, can i achieve this with the following html helper tags? input('Price/value')?> selectTag('Price/value')?> I want this because i use 4 selecttags in this form. When it can't be done ill have to write it manually but ill have to loop through the selecttag values 4 times. It is sort of lazy i know, but why do the loop when it can be done by cake! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Mixed up models?
I found out that this problem only occurs when i use a 'requestAction' Anybody? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Mixed up models?
I have built a cms and everything worked fine untill today. Somehow, my models get mixed up. When i call $this->Gallery->findAll(); Cake wants to select the table column names from my Content model :S and reverse.. My Content model wants to select columnnames from my Gallery model. My models are not associated by cake, i only associate them by ref_id or parent_id but this happens manually... Does someone have any idea? thanx tim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Query on a Tree table (id+parent_id)
Hey, I have made a query where i want to select a parent and its childs. I want the array to be like the normal cake structure [PARENT] infomation ---[CHILDS] -[0] information -[1] information -[2] information Im to big of a sql writer. I came up with this: SELECT * FROM content_table AS Content ,content_table AS Childs WHERE Content.id = Childs.parent_id AND Content.id = '$id' ORDER BY Content.position,Childs.position,Content.name,Childs.name I know about the findAllthreaded function but it has limited selecting capability. The findAllThreaded method can't begin somewhere in the middle of the tree and find the childs from that level or id. My query returns another sort of array. Every child gets retrieved and has a parent information array in the row. When the parent has no childs nothing gets returned but i need the parent information nevertheless. Can somebody send me in the right direction with this problem? thanx Tim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problems with TestSuite
Thanks, the test suite works fine now using the test controller. @Larry: I still don't know how to access my models from outside the framework without using the test controller. Can you pls clear things up? Anyway thank you for the nice test suite. Cheers, Timo On 6/9/06, Larry E. Masters aka PhpNut <[EMAIL PROTECTED]> wrote: > > The test suite is in the proper diretory layout to install. Just upload the > app/* directories to your cake install. > You can acess using the controller like you mentioned above, but I recomend > doing it like Dirk is doing, outside of the framework. > > I did find an issue with the defines used in the test suite that do not show > on my install, that is why they are not fixed. > I will be correcting them soon and creating a new release. > > -- > /** > * @author Larry E. Masters > * @var string $userName > * @param string $realName > * @returns string aka PhpNut > * @access public > */ > > > On 6/9/06, Psychie Naill <[EMAIL PROTECTED]> wrote: > > > > Hi Dirk, > > > > Where is your webroot set to? If you can access your controllers like > this: > > http://localhost/controllerA > > then to access the test suite go to: > > http://localhost/tests/ > > > > Notice the 's' on the word 'tests'. This is because the test suite uses a > tests controller. Also, the trailing '/' is neeted for the test suite to > work correctly AFAIK. > > > > HTH, > > > > Sonic. > > > > > > > > > -- Timo Derstappen http://teemow.com mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---