Re: CookBook PDF
Apart from the Bookmarks, page numbers and fluffwhat's the big deal in hitting "All on one page" and print to PDF? It isn't asking for the moon, but still, the thing just got off the ground last month. As John has confirmed, this has been planned for... I think y'all need to recruit some more members to the team. All this talk about "community" and "team" usually makes me forget it's really just a handful of you guys working your butts off. With that said, I just wanna say to nate, phpnut, john, etc. all the hard work is MUCH APPRECIATED!!! -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ --~--~-~--~~~---~--~~ 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: Dynamic Error Messages in 1.2?
Awesome!! Thank you very much! (I do understand that this decision was made independent of my questions about this feature, but I figure that it's a nice feature that I'm looking forwards to, and so saying 'Thanks' seems to be a good thing to do :) ) Thanks! --Mike On Mar 8, 6:42 am, nate <[EMAIL PROTECTED]> wrote: > This will be implemented before the next release. > > On Mar 7, 8:26 pm, Mike <[EMAIL PROTECTED]> wrote: > > > > > Thanks for your suggestion - I was thinking about that, and here's > > what I came up with. If you can see any holes/offer any refinements, > > I'd love to hear about them :) > > > Part of the reason I'm against this is that I've already got a > > function that does what I want, and I'm looking to reuse it in > > CakePHP, rather than redo everything the Cake way. > > > Another part is that I think that if I redo this in Cake, it'll end up > > being more awkward, because I want this functionality to be used for > > multiple fields (so I'll need the same collection of rules, for each > > and every field). > > > My goal: > > I want to create a directory on the server, so that users can upload > > files to the server. When the 'superuser' creates the directory, I > > want there to be 2 options: > > 1) Use an existing directory > > 2) Use an existing directory if it's there, and create it if not. > > > So, breaking this down into pieces, it seems like there are a couple > > of steps: > > 1) If the directory exists: > > 1.1) If it's writable, then we're done & we're good > > 1.2) If it's NOT writable, then we're done & we've got an error > > > 2) If it doesn't exist: > > 2.1) If the user has elected to create the directory when it doesn't > > exist, > > then create it > > 2.1.1) We may encounter errors trying to create the directory > > > 2.2) If the user has elected to NOT create the directory when it > > doesn't exist > > then we're done, and we've got an error > > > Basically, the user types the directory into a textbox, then checks a > > checkbox to indicate 'create if not present' > > > So - if I have a rule which says 'check for the existence (and > > writability) of the directory', and it finds that the directory isn't > > there, then we may need to give the user an error, OR we may not > > (depending on the 'create if not already there' checkbox). That would > > be 1 rule, I guess. > > > Next, if the directory doesn't exist, but we want to create it, we'll > > try to do that. Which is a second rule. There are a couple of > > different things that could go wrong, so I guess we'll use a semi- > > generic error message, and hope that's helpful enough :) > > > This all gets further complicated by a desire to reuse this for > > several different fields - now I need to copy this set of validation > > rules into the second (and third, etc, etc) fields, too, which is > > getting kind of awkward. It's not the end of the world, but having > > all the (related) logic in one function is kinda nice, and this way, > > that one function can produce exact error messages. > > > Thanks! > > --Mike > > > On Mar 7, 4:19 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > > > Why not just create a second validation method and narrow the first > > > one to whatever concerns the message you've set for it? > > > > On Fri, Mar 7, 2008 at 6:46 PM, Mike <[EMAIL PROTECTED]> wrote: > > > > > Thanks for the reply! One of the big reasons I went with Cake is that > > > > it seemed to have an active, friendly community. I'm glad to be part > > > > of it! :) > > > > > I tried this out, and it doesn't seem to work. Looking at the code in > > > > cake/libs/model/model.php, specifically the invalidFields method, just > > > > below where the call_user_func_array function is called, it appears > > > > that if the user-defined validation method (i.e., my method) returns > > > > false, then the Cake code will call Model::invalidate using the > > > > default error message for that rule. > > > > > Since this happens after my method has finished executing, this means > > > > that the error message that my method set is now overwritten with the > > > > default 'message'. > > > > > As a matter of fact - looking at the code in the invalidFields, it > > > > looks like it's impossible to have a validation method create a > > > > dynamic error message, given the code that's there, now. > > > > > Does anybody else have an interest in being able to create dynamic > > > > error messages from within a validation method/function? If so, how > > > > do we ask for this feature to be incorporated into Cake? > > > > > Thanks! > > > > --Mike > > > > > On Mar 7, 7:31 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > > > > > Have you tried Model::invalidate(...)? > > > > > >http://api.cakephp.org/1.2/class_model.html#81c94997c2d6158c40efd9c70... > > > > > > On Mar 6, 10:29 pm, Mike <[EMAIL PROTECTED]> wrote: > > > > > > > Hello! > > > > > > > In CakePHP 1.2, one can define a va
Re: CookBook PDF
On Mar 8, 2008, at 9:04 PM, the_woodsman wrote: > > I think it would be great if the big name contributors to the group > welcomed ideas more openly! Resistance is usually a side effect of being over stressed. When you already feel like you've dumped too much into something and people blue-sky for you, it's a little frustrating sometimes. We're an open community but please realize that you're essentially brainstorming on how to use other's time. Maybe I've just got thicker skin, but one thing you'll need to get used to here is Chris'... uh... frank way of expressing his views. :) > I also think that a lot of people would benefit from at least an > easily printable form of the book and api - and perhaps the cake devs > don't entirely disagree, seeing as the new cook book has options for > displaying the entire manual in one page. No, we've planned on other output formats from the beginning. It's a resource and priority issue. Once we've got some other priority issues out of the way the PDF stuff will come next. As will all things Cake (and open source in general) these things usually happen 1000 times faster if someone offers to actually offers to code it up. It really shouldn't be too bad. There's a plethora of PDF libraries out there, something we just need to hook up to a traversal of the book tree(s). > Another 'living and breathing document', the wikipedia, thinks people > find a printable version useful too. > > Asking for a DF version of the manual is not asking for the moon on a > stick! No I agree. It's coming, but I'm not exactly sure when just now. Thanks for the input. -- John > On Mar 9, 1:01 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: >> On Sat, Mar 8, 2008 at 6:14 PM, Mech7 <[EMAIL PROTECTED]> wrote: >> >>> The API in pdf would be nice too :p >> >> A pony to ride would be nice as well, but that's not happening >> either. >> >> The API is likely to change before 1.2 is labeled as being final, >> so I >> would say providing a PDF of it is a waste. >> >> The Cookbook is a "living and breathing document", so again, creating >> a PDF of that would be a waste of time as well. >> >> Just my opinion. >> >> -- >> Chris Hartjes >> Internet Loudmouth >> Motto for 2008: "Moving from herding elephants to handling snakes..." >> @TheKeyBoard:http://www.littlehart.net/atthekeyboard > > --~--~-~--~~~---~--~~ 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: CookBook PDF
On Mar 8, 2008, at 6:01 PM, Chris Hartjes wrote: > > On Sat, Mar 8, 2008 at 6:14 PM, Mech7 <[EMAIL PROTECTED]> wrote: >> >> The API in pdf would be nice too :p >> > > A pony to ride would be nice as well, but that's not happening either. > > The API is likely to change before 1.2 is labeled as being final, so I > would say providing a PDF of it is a waste. It shouldn't be too hard too make it dynamically create PDFs on the fly - allowing for a snapshot of the live document at any point. We're planning on a number of different output formats (HTML and PDF first), but we're taking it one step at a time. -- John --~--~-~--~~~---~--~~ 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: CookBook PDF
I agree with Woodsman. But it's a nice to have. I think the goal should be to complete the "manual" 1st. Chris using your logic, what's the use of the 2 books coming out if 1.2 isn't finalized yet? On Mar 8, 11:04 pm, the_woodsman <[EMAIL PROTECTED]> wrote: > I think it would be great if the big name contributors to the group > welcomed ideas more openly! > I also think that a lot of people would benefit from at least an > easily printable form of the book and api - and perhaps the cake devs > don't entirely disagree, seeing as the new cook book has options for > displaying the entire manual in one page. > > Another 'living and breathing document', the wikipedia, thinks people > find a printable version useful too. > > Asking for a DF version of the manual is not asking for the moon on a > stick! > > Just my 0.02, obviously,,, > > On Mar 9, 1:01 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > On Sat, Mar 8, 2008 at 6:14 PM, Mech7 <[EMAIL PROTECTED]> wrote: > > > > The API in pdf would be nice too :p > > > A pony to ride would be nice as well, but that's not happening either. > > > The API is likely to change before 1.2 is labeled as being final, so I > > would say providing a PDF of it is a waste. > > > The Cookbook is a "living and breathing document", so again, creating > > a PDF of that would be a waste of time as well. > > > Just my opinion. > > > -- > > Chris Hartjes > > Internet Loudmouth > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: CookBook PDF
I think it would be great if the big name contributors to the group welcomed ideas more openly! I also think that a lot of people would benefit from at least an easily printable form of the book and api - and perhaps the cake devs don't entirely disagree, seeing as the new cook book has options for displaying the entire manual in one page. Another 'living and breathing document', the wikipedia, thinks people find a printable version useful too. Asking for a DF version of the manual is not asking for the moon on a stick! Just my 0.02, obviously,,, On Mar 9, 1:01 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Sat, Mar 8, 2008 at 6:14 PM, Mech7 <[EMAIL PROTECTED]> wrote: > > > The API in pdf would be nice too :p > > A pony to ride would be nice as well, but that's not happening either. > > The API is likely to change before 1.2 is labeled as being final, so I > would say providing a PDF of it is a waste. > > The Cookbook is a "living and breathing document", so again, creating > a PDF of that would be a waste of time as well. > > Just my opinion. > > -- > Chris Hartjes > Internet Loudmouth > Motto for 2008: "Moving from herding elephants to handling snakes..." > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: CookBook PDF
On Sat, Mar 8, 2008 at 6:14 PM, Mech7 <[EMAIL PROTECTED]> wrote: > > The API in pdf would be nice too :p > A pony to ride would be nice as well, but that's not happening either. The API is likely to change before 1.2 is labeled as being final, so I would say providing a PDF of it is a waste. The Cookbook is a "living and breathing document", so again, creating a PDF of that would be a waste of time as well. Just my opinion. -- Chris Hartjes Internet Loudmouth Motto for 2008: "Moving from herding elephants to handling snakes..." @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: User Based RSS
OK...I got it! Thanks everyone for your help! So to document and help anyone in the future that might need to do this, here is what I did. 1) followed the tutorial at http://bakery.cakephp.org/articles/view/rss-feed-them-cake 2) changed the rss() function to become rss($user_hash). With this the URL to subscribe becomes /controller/function/user_hash. 3) last, I changed my query to only return the records that have that $user_hash in them from the table. 4) rejoice and cheer that you've got it working! Thanks again, daniel On Mar 8, 2:50 pm, dsgndvlp <[EMAIL PROTECTED]> wrote: > Thanks Jelmer but my confusion is that the function you're mentioning > goes into the controller, yet the code I am working with is suppose to > go into the model. When I add the function to the model, how do I > make the controller get the $user_hash value? Specifically, I need to > take the $user_hash value and compare it from the model into the > controller like so > var $feed = array( > 'conditions' => array('Thank.rss_hash' => '$user_hash'), > 'titleField' => 'Thank.title', > 'descField' => 'Thank.title', > 'link' => '/thanks', > 'orderby' => array('Thank.created' => 'DESC'), > 'limit' => 10 > ); > > but alas, it does not work. I get the error on my model of > Parse error: syntax error, unexpected T_VARIABLE in /Applications/MAMP/ > htdocs_attractionapp/app/models/thank.php on line 6 > > Thanks so much for your help but I'm stuck. Right now I am kicking > myself that I didn't migrate to 1.2 before beginning this project! ;) > > daniel > > On Mar 8, 9:45 am, jelmer <[EMAIL PROTECTED]> wrote: > > > You are indeed close, just add the has after the controller url, like > > this: > > my_controller/my_rss/user_hash > > > it will automatically expect auserhashbecause that's what you've > > setup in the function: function my_rss($user_hash) > > sometimes you may also need multiple variables: > > function my_function($category, $url) > > > the url structure will be like this: > > my_controller/my_function/category/url > > > I hope you understand it now, pretty easy after all huh? > > > On Mar 8, 7:21 am, dsgndvlp <[EMAIL PROTECTED]> wrote: > > > > I guess I spoke too soon! I tried it and just realized its still not > > > working as I thought. Specifically my issue is that how can CakePHP > > > know that the user_hash part in my url > > > ofhttp://myapp.com/my_controller/my_rss/user_hash > > > is set without declaring a var > > > likehttp://myapp.com/my_controller/my_rss?user_hash=12048489009112 > > > > I tried using this in the controller but the explode keeps giving me > > > an error and I am not sure why. I am so close i can taste it too! > > > > class Thank extends AppModel > > > { > > > var $name = 'Thank'; > > > > var $thispage = explode('/',$_SERVER['REQUEST_URI']); > > > > var $feed = array( > > > 'conditions' => array('Thank.rss_hash' => '$thispage[2]'), > > > 'titleField' => 'Thank.title', > > > 'descField' => 'Thank.title', > > > 'link' => '/thanks', > > > 'orderby' => array('Thank.created' => 'DESC'), > > > 'limit' => 10 > > > ); > > > > } > > > > On Mar 8, 12:09 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > Thanks so much Johan - this makes a lot of sense now. The > > > > clarification is super helpful! > > > > > Take care, > > > > daniel > > > > > On Mar 3, 8:56 am, "Johan @ Notitia.nl" <[EMAIL PROTECTED]> wrote: > > > > > > With the example url (http://myapp.com/my_controller/my_rss/user_hash) > > > > > you should create a controller like this: > > > > > > > > > > > class MyController extends AppController { > > > > > $name = 'MyController'; > > > > > $uses = array('MyModel'); > > > > > $components = array('MyRssComponent'); > > > > > > function my_rss($user_hash = null) > > > > > { > > > > > if(!$user_hash) > > > > > { > > > > > $this->set('data', 'No UserHash defined'); > > > > > } > > > > > else > > > > > { > > > > > $data = $this->MyModel->findAll(array('user_hash' => > > > > > $user_hash)); > > > > > $this->set('data', $data); > > > > > } > > > > > } > > > > > > } > > > > > > All you have to have now is a view which transforms the $data array to > > > > > a RSS feed. > > > > > > On Mar 3, 7:06 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > > > I tried getting this all working and am > > > > > > usinghttp://bakery.cakephp.org/articles/view/automagic-rss-feed-generator-... > > > > > > on my build of CakePHP 1.1. > > > > > > > My only issue, is I don't understand how to find out thehashfor the > > > > > >userthat is given in the URL. For instance, in a URL > > > > > >likehttp://myapp.com/my_controller/my_rss/user_hashhowcanIonlygetthe > > > > > > user_hash from the URL to compare to myhashin theusertable? > > > > >
Admin Homepage Troubles
I have turned on admin routing and I have put the following in my routes.php file: Router::connect('/admin', array('controller' => 'dashboard', 'action' => 'admin_index')); The problem is that I get the following error: Error: DashboardController::admin_index() cannot be accessed directly. How do I fix this? Thanks for any help you can provide me with. --~--~-~--~~~---~--~~ 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: Updating a select box using ajax in cake php
Here is the piece of Code and link to the tutorial http://www.grahambird.co.uk/cake/tutorials/ajax.php '; print ' '; print '' . $item['title'] . ''; print $ajax->link('Delete', 'delete/' . $item['id'], array('update'=>'tasks_done')); print ''; } } ?> http://www.grahambird.co.uk/cake/tutorials/ajax.php On Mar 8, 5:20 am, Rahulk <[EMAIL PROTECTED]> wrote: > Hello > > i have a selectbox which is populated with states when form is > loaded. > i want to populate the cities for the corresponding states in another > selectbox when i will select the > state from the selectbox > > please help me by some example and code > > thanks --~--~-~--~~~---~--~~ 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: using $ajax->link to update a div
Here is one method Check out this piece of code from this link http://www.grahambird.co.uk/cake/tutorials/ajax.php It will help you, if this confuses you, please paste enough of your code here that can be understood, and will make suggestions based on that. '; print ' '; print '' . $item['title'] . ''; print $ajax->link('Delete', 'delete/' . $item['id'], array('update'=>'tasks_done')); print ''; } } ?> On Mar 8, 4:05 pm, paulsc <[EMAIL PROTECTED]> wrote: > i need help but can't find any actual examples. I'm looking for a simple > stupid example. > I have a html table and each row has a link. I want to be able to click that > link and have it use ajax to update a div with an element. I would like to > give this element data, say an object id, or an array of of the objects > attributes for the particular row of the table that was clicked. How can I > do this? Thanks. > > -- > View this message in > context:http://www.nabble.com/using-%24ajax-%3Elink-to-update-a-div-tp1592050... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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: $form->submit("submit"); question
My question is why does it wrap this tag in a div? because it's the default. Is it possible to prevent cake from doing this? yes.. here is how. Try using $form->submit('Submit', array('div' => false)); That should disable the div around submit and the lable for it. Hope it helps On Mar 8, 6:52 pm, Kyle Decot <[EMAIL PROTECTED]> wrote: > Whenever I create a $form->submit("submit"); I get the following: > > > > My question is why does it wrap this tag in a div? Is it possible to > prevent cake from doing this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$form->submit("submit"); question
Whenever I create a $form->submit("submit"); I get the following: My question is why does it wrap this tag in a div? Is it possible to prevent cake from doing this? --~--~-~--~~~---~--~~ 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: Form create controller naming?
I'm not really sure why it does this because I'm still pretty new to cakePHP but I had the same problem and this is how I solved it: echo $form->create(null, array('id'=> 'form', 'type' => 'file', 'action' => '/admin/portfolio/add')); Just give it null for the first parameter. I'm not sure if this is the correct solution but it sure worked for me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CookBook PDF
The API in pdf would be nice too :p On Mar 8, 11:48 pm, Greg Baker <[EMAIL PROTECTED]> wrote: > Anyone have the cookbook in PDF format? I tried printing it using my > pdf writer in linux but it only prints the first two pages for some > reason. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Form create controller naming?
I have a controller portfolio, but the form create keeps going to portfolios instead of portfolio, how can i set the name for the controller myself? i tried this allready: echo $form->create('Portfolio', array('id'=> 'form', 'type' => 'file', 'action' => '/admin/portfolio/add')); echo $form->create('Portfolio', array('id'=> 'form', 'type' => 'file', 'controller' => 'portfolio')); Both did not work :p --~--~-~--~~~---~--~~ 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: __call() in Controller? controller actions with underscores
I just want urls (actions) like 'something_something_else' in all my controllers changing dynamically, because naming style of functions in my php code is somethingSomethingElse. (sorry for my poor english). On Mar 7, 2:58 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote: > On Fri, Mar 7, 2008 at 10:55 AM, Pablo Viojo <[EMAIL PROTECTED]> wrote: > > On Fri, Mar 7, 2008 at 5:44 AM, grassoalvaro <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I was searching for solution but i didn't find anything. So, for > > > example: > > > > class DictionariesController extends AppController > > > { > > >function myAction() > > >{ > > >} > > > } > > > > I need smart solution to call myFunction when url is > > >http://host/dictionaries/my_action > > > and i need to do that for all my actions in all controllers. I was > > > trying to do that using __call() method in app_controller.php, but > > > didn't work. > > > > Any idea? > > > Try this at routes.php: > > > Router::connect('/dictionaries/:action/*', array('controller' => > > 'dictionaries')); > > > And the defining any action you like in the controller. > > > Regards, > > After reading again, I don't understand what you're trying to do. Can you > explain a bit more? BTW, what I propose is just the standard behavior of > cakephp so it's not really needed. > > -- > Pablo Viojo > [EMAIL PROTECTED]://pviojo.net --~--~-~--~~~---~--~~ 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: overriding tags
thanks, works perfectly. On Mar 7, 1:58 pm, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > If you are on 1.2: > > http://www.cricava.com/blogs/index.php?blog=6&title=overriding_specif... > _tags_before_usi&more=1&c=1&tb=1&pb=1 > > -MI > > --- > > CakeFest Hispano: December, 2008 - Buenos Aires, Argentina > -http://es.cakefest.org > > 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: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre > de Greg Baker > Enviado el: Viernes, 07 de Marzo de 2008 9:08 a.m. > Para: Cake PHP > Asunto: Re: overriding tags > > Is there a standard way of changing a tag format? I notice in 1.2 > they're moved to htmlhelper.. I don't want to create a custom helper > just to override a tag in htmlhelper. --~--~-~--~~~---~--~~ 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: Scaffolding and NULLable Values?
Btw, I'm using 1.2. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Scaffolding and NULLable Values?
Hi All, Just wondering if this is possible: I'm in the process of shelling out an app for one of our websites. I've setup all of the many model associations. I'm using scaffold to see how the associations work by adding data to each relationship. One problem though, lets says for example I have a list of fruits in a select box that cake generated due to a specified association. I was under the assumption (not sure why I assumed this) that if I set the field in MySQL able to be null, that Cake would insert an option to the select box with either a 0 value or a "" (empty) value. Doesn't seem like thats the case. Is there anything I can do to make this happen automatically? I'd like to use scaffolding until I know that all the associations make sense. Any way around that? Any ideas appreciated. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CookBook PDF
Anyone have the cookbook in PDF format? I tried printing it using my pdf writer in linux but it only prints the first two pages for some reason. --~--~-~--~~~---~--~~ 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: textarea
You could also wrap your text in a or a special with styles set to preserve whitespace. http://webdesign.about.com/od/styleproperties/p/blspwhitespace.htm On Mar 7, 6:59 pm, bob <[EMAIL PROTECTED]> wrote: > In a textarea, how do you retain the spacings and carriage returns when you > save to the database or output in the view? > > for example, if i enter > "first line > > third line" > > I want to output to the user keeping all the carriage returns. But right > now, it just outputs "first line third line" --~--~-~--~~~---~--~~ 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: Using a model in app_controller
Thanks, I actually did what I was trying to do by adding an App::import() to my routes.php and using my model in there. It works perfect. On Mar 8, 1:58 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > AppController var $uses = array('Conference'); > AppController::beforeFilter() { $this->Conference->find('all'); // do > your stuff here } > > You are better encapsulating this in a component. > > On Sat, Mar 8, 2008 at 12:06 PM, Greg Baker <[EMAIL PROTECTED]> wrote: > > > I want to generate a few routes automatically in my application by > > finding all 'conferences' and using the 'path' field from each. Do do > > this I need to findAll conferences in my app_controller, but I don't > > know how. --~--~-~--~~~---~--~~ 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: HABTM: missing FROM-clause entry
I got this working by using Andy's workaround here: http://groups.google.com/group/cake-php/browse_frm/thread/8cbf01f7a9acda57/9e84f7aacbf3cd85?#9e84f7aacbf3cd85 Essentially, I had to bind a dummy a hasOne relationship: function listByDisciplineAndType() { $discipline = $this->__getDisciplineBySlug($this->params['discipline_slug']); $fund_type = $this->__getFundTypeBySlug($this->params['fund_type_slug']); $this->Fund->recursive = 0; $this->Fund->bindModel(array('hasOne'=>array('FundsDisciplines'=>array(; $fields = array('Fund.id', 'Fund.name', 'Fund.short_description'); $criteria = array( 'conditions' => array( 'Fund.fund_type_id' => $fund_type_id, 'FundsDisciplines.discipline_id' => $discipline_id ) ); $this->set('discipline', $discipline); $this->set('fund_type', $fund_type); //$this->set('funds', $this->paginate('Fund', $criteria)); $this->set('funds', $this->Fund->find('all', $criteria, $fields)); } Two things, though: 1)the $fields array is being ignored. I'd love to hear from anyone who can tell me why as I'm getting far more data than I need or want, because ... 2) pagination doesn't work at all. If I try the commented paginate() call abaove, I get the all-too familiar error that FundsDisciplines is not in the FROM clause. I guess I can understand why that's happening (and, after 8+ hours on this one problem, I really should understand it better) but this seems like a huge omision in pagination. Or I'm still just missing something. I checked out this article: http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/ but that's no help here because it still does nothing for the join on disciplines. Anyone? On Sat, Mar 8, 2008 at 3:17 PM, b logica <[EMAIL PROTECTED]> wrote: > Yes, I got my associationForeignKey and foreignKey entries reversed. I > fixed that but still the same. > > I've also tried 'FundsDisciplines.discipline_id' => $discipline_id in > the conditions but that just makes Cake neglect to put that table in > the FROM clause, instead. > > Ignore the "ask_" and "ASK" stuff: I wanted to simplify the names and > forgot to remove those. > > > > On Sat, Mar 8, 2008 at 3:00 PM, b logica <[EMAIL PROTECTED]> wrote: > > Anyone? I've been hashing over this for hours now and the clue-fairy > > hasn't made an appearance yet. Ican't believe this is impossible to do > > with Cake so I must have something wrong somewhere. > > > > > > > > > > class Fund extends AppModel > > { > > var $name = 'Fund'; > > > > var $useTable = 'funds'; > > var $belongsTo = array('FundType'); > > > > var $hasAndBelongsToMany = array( > > 'Discipline' => array( > > 'className' => 'Discipline', > > 'joinTable' => 'funds_disciplines', > > 'foreignKey' => 'discipline_id', > > 'associationForeignKey' => 'fund_id' > > ) > > ); > > > > } > > > > class AskFundType extends AppModel > > { > > var $name = 'AskFundType'; > > > > var $useTable = 'fund_types'; > > var $hasMany = 'Fund'; > > > > } > > > > class Discipline extends AppModel > > { > > var $name = 'Discipline'; > > > > var $hasAndBelongsToMany = array( > > 'AskFunder' => array( > > 'className' => 'AskFunder', > > 'joinTable' => 'ask_funders_disciplines', > > 'foreignKey' => 'ask_funder_id', > > 'associationForeignKey' => 'discipline_id' > > ), > > ); > > } > > > > > > class FundsController extends AppController > > { > > var $name = 'Funds'; > > > > var $paginate = array( > > 'limit' => 10, > > 'page' => 1, > > 'order'=>array('Fund.name' => 'ASC'), > > 'fields' => array( > > 'Fund.id', > > 'Fund.name', > > 'Fund.short_description' > > ) > > ); > > > > function listByDisciplineAndType() > > { > > > > ... > > > > $conditions = array( > > 'Fund.fund_type_id' => $fund_type_id, > > 'Discipline.id' => $discipline_id > > ); > > > > $this->set('funds', $this->paginate('Fund', $conditions)); > > } > > ... > > > > The really strange thing is, if i remove "'Discipline.id' => > > $discipline_id" from the $conditions, I get: > > > > Array > > ( > > [0] => Array > > ( > > [Fund] =>
using $ajax->link to update a div
i need help but can't find any actual examples. I'm looking for a simple stupid example. I have a html table and each row has a link. I want to be able to click that link and have it use ajax to update a div with an element. I would like to give this element data, say an object id, or an array of of the objects attributes for the particular row of the table that was clicked. How can I do this? Thanks. -- View this message in context: http://www.nabble.com/using-%24ajax-%3Elink-to-update-a-div-tp15920505p15920505.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
First Normal Form belongsTo and hasMany query
Thanks in advance for any clarification you can provide. I'm trying to get my mind around understanding the model relationship. In short, I'm looking to understand how to manipulate an already queried result set. My (simplified) database model and code are below. Products id oem_id spec_id Oems id code_description Specifications -- id spec_description Model Relationships (First Normal Form) --- Product belongsTo: Specification, Code (several others mapped similarly) Specification, Color and Code all hasMany Product In my ProductsController I have defined: var $uses = array('Product', 'Oem', 'Specification'); Question On Product index page I show a list of all Oems, which I'm generating via: $this->set('oems', $this->Product->Oem->generateList()); These link to /products/display/4 where I am displaying all products of that Oem with: $this->set('products', $this->Product->findAllByOem_id($id) ); (php 4 reason for _, not my hosting) What I'm not sure how to do is get a list of all of the Specifications (and other attributes) within this "result" In the controller display function, I can call: $this->set('specs', $this->Specification->findAll() ); which will give me EVERY specification, but I am looking for the proper cakephp way (of using my model relationship) to get just the specifications related to my result set. I hope I've made my question clear. And thanks again for listening! Tyler --~--~-~--~~~---~--~~ 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: Trailing Whitespace Prevented a Session From Being Started
Hi rtconner, On Mar 8, 1:52 am, rtconner <[EMAIL PROTECTED]> wrote: > FYI, It might be a good practive not to use the '?>' to close off your > php files. PHP closes when it hits the EOF anyways. I've seen some > projects that do this, it works well. It's a nice thing to know. Do you know of any open-source project that use this as their coding guidelines? If this is even a somewhat used coding convention (I must admit I never saw it before) in some big/medium open-source projects I will want to consider using it too. Regards and thanks for your tip, Guy --~--~-~--~~~---~--~~ 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: SQL Error: 1066: Not unique table/alias when deleting data
On Feb 12, 4:36 am, nate <[EMAIL PROTECTED]> wrote: > Could you post the full SQL query that generated the error? How about > the method call you made to generate the error? Maybe your model code/ > associations? As it is, we can't really help you much with that > description. > > On Feb 11, 10:00 pm, Action <[EMAIL PROTECTED]> wrote: > > > Warning (512): SQL Error: 1066: Not unique table/alias: 'PostsTag' > > > Warning (512): SQL Error: 1066: Not unique table/alias: 'Post' > > > This only happens on my shared host (mysql 4.0), not my local host > > (mysql 5.0.45). --~--~-~--~~~---~--~~ 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: SQL Error: 1066: Not unique table/alias when deleting data
Hi nate, i had the same error > Warning (512): SQL Error: 1066: Not unique table/alias: it's simple to reproduce... - a model with TreeBehavior - try to delete a node-with-subnodes That works fine on MySQL5 - but not on MySQL4 hope that helps Roland (c: --~--~-~--~~~---~--~~ 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: How can include another page
create filename.thtml in the /app/views/elements/ then use it in your Use renderElement("filename"); ?> // please notice that the filename extention is not included in the quotes Use can use .thtml or .ctp I hope it helps On Mar 8, 5:59 am, sushil <[EMAIL PROTECTED]> wrote: > Hi, > > I want to use Tabs with the cake php pages, means i need more than one > page in a single view > so i just include these pages through > > > > But its mapping is not being with the controller and model ..So any > one can tell me hoe can i include another page with cake php > > Thanks --~--~-~--~~~---~--~~ 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: Session lost after redirect
Turns out this was being caused by session auto start being enabled. So problem fixed! On Mar 8, 12:52 pm, Baz <[EMAIL PROTECTED]> wrote: > Damn, that sucks. > > On Sat, Mar 8, 2008 at 10:43 AM, Action <[EMAIL PROTECTED]> wrote: > > > Also, their tech support gave me this response: > > > " May I also point out that certain scripting engines that seek to > > control "everything" including GPC ($_GET,$_POST, etc) sometimes take > > and destroy the session variable. As a result you may wish to utilize > > the session_name(...) function and then ensuring the GPC control does > > not touch that variable-key in its cleaning." > > > On Mar 8, 11:31 am, Action <[EMAIL PROTECTED]> wrote: > > > It turns outsessionswork fine on my host...justnotwithin Cake. If > > > I usesessions, either using cake's built-insessionsor from scratch, > > > within CakePHP, they are lost once I change/reload pages within my > > > site. My webhost is Medialayer. > > > > Any idea what could cause this? > > > > On Mar 7, 4:46 pm, Joel <[EMAIL PROTECTED]> wrote: > > > > > Sounds more like a server configuration issue than a Cake one. What > > > > server is the host running? Apache? > > > > > On Mar 7, 4:41 pm, Action <[EMAIL PROTECTED]> wrote: > > > > > > I recently switched web hosts and this problem arose: > > > > > > I have a login form. If the login info is correct, it creates a > > > > > session and redirects you to an admin page. The admin page checks if > > > > > the session is set and redirects you back to the login page if it is > > > > >not. > > > > > > This worked fine on my old host, but on my new host the session info > > > > > is lost once I redirect to the admin page after logging in (which > > > > > redirects you back to to the login page because the session is > > gone). > > > > > > How can I fix this? > > > > > > Thanks! --~--~-~--~~~---~--~~ 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: HABTM: missing FROM-clause entry
Yes, I got my associationForeignKey and foreignKey entries reversed. I fixed that but still the same. I've also tried 'FundsDisciplines.discipline_id' => $discipline_id in the conditions but that just makes Cake neglect to put that table in the FROM clause, instead. Ignore the "ask_" and "ASK" stuff: I wanted to simplify the names and forgot to remove those. On Sat, Mar 8, 2008 at 3:00 PM, b logica <[EMAIL PROTECTED]> wrote: > Anyone? I've been hashing over this for hours now and the clue-fairy > hasn't made an appearance yet. Ican't believe this is impossible to do > with Cake so I must have something wrong somewhere. > > > > > class Fund extends AppModel > { > var $name = 'Fund'; > > var $useTable = 'funds'; > var $belongsTo = array('FundType'); > > var $hasAndBelongsToMany = array( > 'Discipline' => array( > 'className' => 'Discipline', > 'joinTable' => 'funds_disciplines', > 'foreignKey' => 'discipline_id', > 'associationForeignKey' => 'fund_id' > ) > ); > > } > > class AskFundType extends AppModel > { > var $name = 'AskFundType'; > > var $useTable = 'fund_types'; > var $hasMany = 'Fund'; > > } > > class Discipline extends AppModel > { > var $name = 'Discipline'; > > var $hasAndBelongsToMany = array( > 'AskFunder' => array( > 'className' => 'AskFunder', > 'joinTable' => 'ask_funders_disciplines', > 'foreignKey' => 'ask_funder_id', > 'associationForeignKey' => 'discipline_id' > ), > ); > } > > > class FundsController extends AppController > { > var $name = 'Funds'; > > var $paginate = array( > 'limit' => 10, > 'page' => 1, > 'order'=>array('Fund.name' => 'ASC'), > 'fields' => array( > 'Fund.id', > 'Fund.name', > 'Fund.short_description' > ) > ); > > function listByDisciplineAndType() > { > > ... > > $conditions = array( > 'Fund.fund_type_id' => $fund_type_id, > 'Discipline.id' => $discipline_id > ); > > $this->set('funds', $this->paginate('Fund', $conditions)); > } > ... > > The really strange thing is, if i remove "'Discipline.id' => > $discipline_id" from the $conditions, I get: > > Array > ( > [0] => Array > ( > [Fund] => Array > ( > [id] => 168 > [name] => THE_FUND_NAME > [short_description] => THE_FUND_DESCRIPTION > ) > > [Discipline] => Array > ( > ) > ) > ... > ) > > So, why is it that Cake refuses to select on disciplines but still > adds the Discipline array (albeit empty) here? What the heck is going > on? > > > > > > On Sat, Mar 8, 2008 at 2:10 AM, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > > (Cake1.2, using Bindable) > > > > Just when I thought I had this figured out... > > > > I have 3 models: > > > > Fund => belongsTo (FundType), HABTM(Discipline) > > FundType => hasMany(Fund) > > Discipline => HABTM(Fund) > > > > FundsController: > > > > function listByDisciplineAndType() > > { > > $discipline_slug = $this->params['discipline_slug']; > > $fund_type_slug = $this->params['fund_type_slug']; > > > > $fields = array('Fund.name', [Fund.etc...]); > > $criteria = array( > > 'conditions' => array( > > 'Discipline.slug' => $discipline_slug, > > 'FundType.slug' => $fund_type_slug > > ), > > 'restrict' => array( > > 'Discipline(name, slug)', > > 'FundType(name)' > > ) > > ); > > > > $this->set('funders', $this->Fund->find('all', $criteria, > $fields)); > > } > > > > For some reason beyond my ken, Cake isn't selecting on Discipline > > (I've also tried adding it to the $fields array). > > > > Can anyone point out out my error? > > > > > > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RequestAction with pagination ?
Hello All, I have a controller action named listclients and here is the code Conroller class ClientsController extends AppController { function listclients() { Configure::write('debug', '0'); $this->Relation->recursive = 0; $this->set('clients', $this->paginate()); } } Element requestAction('/clients/listclients'); ?> Code in View renderElement('ralistclients'); ?> I am able to pull the $clients Multi-dimmentional array fine and een display it, but I can't Paginate . I get undefined variable $paginate... has anyone encountered this problem before and how was it solved? Thanks --~--~-~--~~~---~--~~ 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: HABTM: missing FROM-clause entry
Anyone? I've been hashing over this for hours now and the clue-fairy hasn't made an appearance yet. Ican't believe this is impossible to do with Cake so I must have something wrong somewhere. class Fund extends AppModel { var $name = 'Fund'; var $useTable = 'funds'; var $belongsTo = array('FundType'); var $hasAndBelongsToMany = array( 'Discipline' => array( 'className' => 'Discipline', 'joinTable' => 'funds_disciplines', 'foreignKey' => 'discipline_id', 'associationForeignKey' => 'fund_id' ) ); } class AskFundType extends AppModel { var $name = 'AskFundType'; var $useTable = 'fund_types'; var $hasMany = 'Fund'; } class Discipline extends AppModel { var $name = 'Discipline'; var $hasAndBelongsToMany = array( 'AskFunder' => array( 'className' => 'AskFunder', 'joinTable' => 'ask_funders_disciplines', 'foreignKey' => 'ask_funder_id', 'associationForeignKey' => 'discipline_id' ), ); } class FundsController extends AppController { var $name = 'Funds'; var $paginate = array( 'limit' => 10, 'page' => 1, 'order'=>array('Fund.name' => 'ASC'), 'fields' => array( 'Fund.id', 'Fund.name', 'Fund.short_description' ) ); function listByDisciplineAndType() { ... $conditions = array( 'Fund.fund_type_id' => $fund_type_id, 'Discipline.id' => $discipline_id ); $this->set('funds', $this->paginate('Fund', $conditions)); } ... The really strange thing is, if i remove "'Discipline.id' => $discipline_id" from the $conditions, I get: Array ( [0] => Array ( [Fund] => Array ( [id] => 168 [name] => THE_FUND_NAME [short_description] => THE_FUND_DESCRIPTION ) [Discipline] => Array ( ) ) ... ) So, why is it that Cake refuses to select on disciplines but still adds the Discipline array (albeit empty) here? What the heck is going on? On Sat, Mar 8, 2008 at 2:10 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > (Cake1.2, using Bindable) > > Just when I thought I had this figured out... > > I have 3 models: > > Fund => belongsTo (FundType), HABTM(Discipline) > FundType => hasMany(Fund) > Discipline => HABTM(Fund) > > FundsController: > > function listByDisciplineAndType() > { > $discipline_slug = $this->params['discipline_slug']; > $fund_type_slug = $this->params['fund_type_slug']; > > $fields = array('Fund.name', [Fund.etc...]); > $criteria = array( > 'conditions' => array( > 'Discipline.slug' => $discipline_slug, > 'FundType.slug' => $fund_type_slug > ), > 'restrict' => array( > 'Discipline(name, slug)', > 'FundType(name)' > ) > ); > > $this->set('funders', $this->Fund->find('all', $criteria, $fields)); > } > > For some reason beyond my ken, Cake isn't selecting on Discipline > (I've also tried adding it to the $fields array). > > Can anyone point out out my error? > > > > > --~--~-~--~~~---~--~~ 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: User Based RSS
Thanks Jelmer but my confusion is that the function you're mentioning goes into the controller, yet the code I am working with is suppose to go into the model. When I add the function to the model, how do I make the controller get the $user_hash value? Specifically, I need to take the $user_hash value and compare it from the model into the controller like so var $feed = array( 'conditions' => array('Thank.rss_hash' => '$user_hash'), 'titleField' => 'Thank.title', 'descField' => 'Thank.title', 'link' => '/thanks', 'orderby' => array('Thank.created' => 'DESC'), 'limit' => 10 ); but alas, it does not work. I get the error on my model of Parse error: syntax error, unexpected T_VARIABLE in /Applications/MAMP/ htdocs_attractionapp/app/models/thank.php on line 6 Thanks so much for your help but I'm stuck. Right now I am kicking myself that I didn't migrate to 1.2 before beginning this project! ;) daniel On Mar 8, 9:45 am, jelmer <[EMAIL PROTECTED]> wrote: > You are indeed close, just add the has after the controller url, like > this: > my_controller/my_rss/user_hash > > it will automatically expect auserhashbecause that's what you've > setup in the function: function my_rss($user_hash) > sometimes you may also need multiple variables: > function my_function($category, $url) > > the url structure will be like this: > my_controller/my_function/category/url > > I hope you understand it now, pretty easy after all huh? > > On Mar 8, 7:21 am, dsgndvlp <[EMAIL PROTECTED]> wrote: > > > I guess I spoke too soon! I tried it and just realized its still not > > working as I thought. Specifically my issue is that how can CakePHP > > know that the user_hash part in my url > > ofhttp://myapp.com/my_controller/my_rss/user_hash > > is set without declaring a var > > likehttp://myapp.com/my_controller/my_rss?user_hash=12048489009112 > > > I tried using this in the controller but the explode keeps giving me > > an error and I am not sure why. I am so close i can taste it too! > > > class Thank extends AppModel > > { > > var $name = 'Thank'; > > > var $thispage = explode('/',$_SERVER['REQUEST_URI']); > > > var $feed = array( > > 'conditions' => array('Thank.rss_hash' => '$thispage[2]'), > > 'titleField' => 'Thank.title', > > 'descField' => 'Thank.title', > > 'link' => '/thanks', > > 'orderby' => array('Thank.created' => 'DESC'), > > 'limit' => 10 > > ); > > > } > > > On Mar 8, 12:09 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > Thanks so much Johan - this makes a lot of sense now. The > > > clarification is super helpful! > > > > Take care, > > > daniel > > > > On Mar 3, 8:56 am, "Johan @ Notitia.nl" <[EMAIL PROTECTED]> wrote: > > > > > With the example url (http://myapp.com/my_controller/my_rss/user_hash) > > > > you should create a controller like this: > > > > > > > > > class MyController extends AppController { > > > > $name = 'MyController'; > > > > $uses = array('MyModel'); > > > > $components = array('MyRssComponent'); > > > > > function my_rss($user_hash = null) > > > > { > > > > if(!$user_hash) > > > > { > > > > $this->set('data', 'No UserHash defined'); > > > > } > > > > else > > > > { > > > > $data = $this->MyModel->findAll(array('user_hash' => > > > > $user_hash)); > > > > $this->set('data', $data); > > > > } > > > > } > > > > > } > > > > > All you have to have now is a view which transforms the $data array to > > > > a RSS feed. > > > > > On Mar 3, 7:06 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > > I tried getting this all working and am > > > > > usinghttp://bakery.cakephp.org/articles/view/automagic-rss-feed-generator-... > > > > > on my build of CakePHP 1.1. > > > > > > My only issue, is I don't understand how to find out thehashfor the > > > > >userthat is given in the URL. For instance, in a URL > > > > >likehttp://myapp.com/my_controller/my_rss/user_hashhowcanIonlyget the > > > > > user_hash from the URL to compare to myhashin theusertable? > > > > > > Any help is super appreciated because I am just spinning my wheels at > > > > > tthis point. I know I am s close to! > > > > > > Thanks, > > > > > daniel > > > > > > On Jan 6, 1:19 pm, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > > > Thanks so much Williamg! I understand now! > > > > > > > I'm going to try this out tonight and let you guys know how it goes. > > > > > > If I create any good code out of it I'll be sure to share. > > > > > > > Thanks so much, > > > > > > daniel > > > > > > > On Dec 26 2007, 2:44 pm, Williamg <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi Daniel, if you use the link I sent earlier.. you should be > > > > > > > able to set up > > > > > > > a quick and easy feed. > > > > > > > > Now, about customising it so that eachuserhas
Re: Session lost after redirect
Damn, that sucks. On Sat, Mar 8, 2008 at 10:43 AM, Action <[EMAIL PROTECTED]> wrote: > > Also, their tech support gave me this response: > > " May I also point out that certain scripting engines that seek to > control "everything" including GPC ($_GET,$_POST, etc) sometimes take > and destroy the session variable. As a result you may wish to utilize > the session_name(...) function and then ensuring the GPC control does > not touch that variable-key in its cleaning." > > On Mar 8, 11:31 am, Action <[EMAIL PROTECTED]> wrote: > > It turns outsessionswork fine on my host...justnotwithin Cake. If > > I usesessions, either using cake's built-insessionsor from scratch, > > within CakePHP, they are lost once I change/reload pages within my > > site. My webhost is Medialayer. > > > > Any idea what could cause this? > > > > On Mar 7, 4:46 pm, Joel <[EMAIL PROTECTED]> wrote: > > > > > Sounds more like a server configuration issue than a Cake one. What > > > server is the host running? Apache? > > > > > On Mar 7, 4:41 pm, Action <[EMAIL PROTECTED]> wrote: > > > > > > I recently switched web hosts and this problem arose: > > > > > > I have a login form. If the login info is correct, it creates a > > > > session and redirects you to an admin page. The admin page checks if > > > > the session is set and redirects you back to the login page if it is > > > >not. > > > > > > This worked fine on my old host, but on my new host the session info > > > > is lost once I redirect to the admin page after logging in (which > > > > redirects you back to to the login page because the session is > gone). > > > > > > How can I fix this? > > > > > > Thanks! > > > --~--~-~--~~~---~--~~ 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: Importing vendor files
I should have added that if you want to stick witth App::import() then you should call it with 'phpthumb' as the 2nd param and the full path to the class fil as the 4th. http://api.cakephp.org/1.2/class_app.html#2a84eb340fe947c7fdc753c3bf8cd053 On Sat, Mar 8, 2008 at 12:02 PM, b logica <[EMAIL PROTECTED]> wrote: > vendor('phpThumb/phpthumb.class'); or vendor('phpThumb' . DS . > 'phpthumb.class'); > > > > On Fri, Mar 7, 2008 at 8:19 PM, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > > > > I'm trying to use > > > > App::import('Vendor','phpthumb' . DS . 'phpthumb.class'); > > > > ... but the "." throws it off. Apparently CakePHP wants to see the "." > > as a directory separator? > > > > How does one import vendor files that are named like > > phpthumb.class.php? > > > > > > > --~--~-~--~~~---~--~~ 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: Importing vendor files
vendor('phpThumb/phpthumb.class'); or vendor('phpThumb' . DS . 'phpthumb.class'); On Fri, Mar 7, 2008 at 8:19 PM, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > > I'm trying to use > > App::import('Vendor','phpthumb' . DS . 'phpthumb.class'); > > ... but the "." throws it off. Apparently CakePHP wants to see the "." > as a directory separator? > > How does one import vendor files that are named like > phpthumb.class.php? > > > --~--~-~--~~~---~--~~ 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: Incorrect usage of TINYINT(1)
Bottom line: MySQL's BOOLEAN is a synonym for TINYINT. If you want to argue that this convention should be changed you should bring it up with them. It's much better for Cake core to go along with MySQL on this, given the the install-base. There are few simple solutions to this. Note that Postgres (my favourite) has a BOOLEAN type, yet it returns the chars "t" or "f" which is kind of sucky, itself. On Fri, Mar 7, 2008 at 10:57 PM, Collin Grady <[EMAIL PROTECTED]> wrote: > > This issue has been raised as far back as two years ago[1] before, but > has been consistently closed with invalid information. > > #3903[2] contains this comment: > > > This is intentional. MySQL does not support boolean field types (up until > BIT), > > so Cake uses tinyint(1) to "fake" boolean field support. > > However it is slightly incorrect; MySQL has had a BIT type since even > before 4.1[4], and while MySQL does treat BIT as a TINYINT(1) until > 5.0.3, that is not true in the reverse; nothing in MySQL has ever > treated TINYINT(1) as how CakePHP currently treats it. Using BIT > instead of TINYINT(1) would result in the forced conversion to 0 or 1 > making far more sense, as even though MySQL converts a BIT to > TINYINT(1) in older versions, the intent there is clear - not so with > a true TINYINT(1). > > #4026[3] states that conventions turn a TINYINT(1) into a boolean, but > I would argue that it's a convention which should be changed - > booleans should be stored in a BIT column, and TINYINT(1) should not > be handled as a boolean/BIT, since it is not treated as such > elsewhere. > > [1] https://trac.cakephp.org/ticket/1253 > [2] https://trac.cakephp.org/ticket/3903 > [3] https://trac.cakephp.org/ticket/4026 > [4] > http://dev.mysql.com/doc/refman/4.1/en/numeric-type-overview.html#id4426984 > > > > --~--~-~--~~~---~--~~ 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: Using a model in app_controller
AppController var $uses = array('Conference'); AppController::beforeFilter() { $this->Conference->find('all'); // do your stuff here } You are better encapsulating this in a component. On Sat, Mar 8, 2008 at 12:06 PM, Greg Baker <[EMAIL PROTECTED]> wrote: > > I want to generate a few routes automatically in my application by > finding all 'conferences' and using the 'path' field from each. Do do > this I need to findAll conferences in my app_controller, but I don't > know how. > > > --~--~-~--~~~---~--~~ 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: Session lost after redirect
Also, their tech support gave me this response: " May I also point out that certain scripting engines that seek to control "everything" including GPC ($_GET,$_POST, etc) sometimes take and destroy the session variable. As a result you may wish to utilize the session_name(...) function and then ensuring the GPC control does not touch that variable-key in its cleaning." On Mar 8, 11:31 am, Action <[EMAIL PROTECTED]> wrote: > It turns outsessionswork fine on my host...justnotwithin Cake. If > I usesessions, either using cake's built-insessionsor from scratch, > within CakePHP, they are lost once I change/reload pages within my > site. My webhost is Medialayer. > > Any idea what could cause this? > > On Mar 7, 4:46 pm, Joel <[EMAIL PROTECTED]> wrote: > > > Sounds more like a server configuration issue than a Cake one. What > > server is the host running? Apache? > > > On Mar 7, 4:41 pm, Action <[EMAIL PROTECTED]> wrote: > > > > I recently switched web hosts and this problem arose: > > > > I have a login form. If the login info is correct, it creates a > > > session and redirects you to an admin page. The admin page checks if > > > the session is set and redirects you back to the login page if it is > > >not. > > > > This worked fine on my old host, but on my new host the session info > > > is lost once I redirect to the admin page after logging in (which > > > redirects you back to to the login page because the session is gone). > > > > How can I fix this? > > > > Thanks! --~--~-~--~~~---~--~~ 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: Indexing a HABTM table
Before creating indexes, measure your application (profile). If you discover the database is the bottleneck and need some covering index (use EXPLAIN in MySQL) then go and make and index. http://dev.mysql.com/doc/refman/5.0/en/optimization.html http://www.mysqlperformanceblog.com/ http://video.google.com/videoplay?docid=2524524540025172110 http://forge.mysql.com/wiki/Top10SQLPerformanceTips On Sat, Mar 8, 2008 at 10:18 AM, Greg Baker <[EMAIL PROTECTED]> wrote: > > Is it normally good practice to index a HABTM table? If so how do you > do this? > > > --~--~-~--~~~---~--~~ 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: Session lost after redirect
It turns out sessions work fine on my host...just not within Cake. If I use sessions, either using cake's built-in sessions or from scratch, within CakePHP, they are lost once I change/reload pages within my site. My webhost is Medialayer. Any idea what could cause this? On Mar 7, 4:46 pm, Joel <[EMAIL PROTECTED]> wrote: > Sounds more like a server configuration issue than a Cake one. What > server is the host running? Apache? > > On Mar 7, 4:41 pm, Action <[EMAIL PROTECTED]> wrote: > > > I recently switched web hosts and this problem arose: > > > I have a login form. If the login info is correct, it creates a > > session and redirects you to an admin page. The admin page checks if > > the session is set and redirects you back to the login page if it is > > not. > > > This worked fine on my old host, but on my new host the session info > > is lost once I redirect to the admin page after logging in (which > > redirects you back to to the login page because the session is gone). > > > How can I fix this? > > > Thanks! --~--~-~--~~~---~--~~ 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: Updating a select box using ajax in cake php
Just search this group, this has been discussed so many times. There is a really simple tutorial in devmoz blog. Just use google. On Sat, Mar 8, 2008 at 8:20 AM, Rahulk <[EMAIL PROTECTED]> wrote: > > Hello > > i have a selectbox which is populated with states when form is > loaded. > i want to populate the cities for the corresponding states in another > selectbox when i will select the > state from the selectbox > > > please help me by some example and code > > > thanks > > > > --~--~-~--~~~---~--~~ 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: How can include another page
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction On Sat, Mar 8, 2008 at 8:59 AM, sushil <[EMAIL PROTECTED]> wrote: > > Hi, > > I want to use Tabs with the cake php pages, means i need more than one > page in a single view > so i just include these pages through > > > > But its mapping is not being with the controller and model ..So any > one can tell me hoe can i include another page with cake php > > Thanks > > > > --~--~-~--~~~---~--~~ 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: cakephp on kubuntu...no way
try: $ sudo a2enmod rewrite $ sudo invoke-rc.d apache2 restart HTH PD: using cakephp in kubuntu for 1+ years. On Sat, Mar 8, 2008 at 9:37 AM, Marcos Hernández <[EMAIL PROTECTED]> wrote: > > Hi! > > I think your problem is the .htaccess file. Read here > http://manual.cakephp.org/chapter/installing, in section 5. I'm using > CakePHP in Ubuntu for 5 months now and works fine. > > Good luck!! > > Kchopein. > > mcphisto escribió: > > Hi, > I'm using cakeph since 1 year and never had problems with windows xp > and easy php 2.0.1. > Now I installed kubuntu and I can't get my applications working. I > only see the home page without any style css and when i try a link it > says "page not found". The only doubt I've is my httpd.conf file. > I post here the configuration. I want my applications run under /var/ > www. Is there something wrong. > > DocumentRoot /var/www/ > > > > LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so > > > # > # Possible values for the Options directive are "None", "All", > # or any combination of: > # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI > MultiViews > # > # Note that "MultiViews" must be named *explicitly* --- "Options > All" > # doesn't give it to you. > # > # The Options directive is both complicated and important. Please > see > # http://httpd.apache.org/docs/2.2/mod/core.html#options > # for more information. > # > Options Indexes FollowSymLinks > > # > # AllowOverride controls what directives may be placed > in .htaccess files. > # It can be "All", "None", or any combination of the keywords: > # Options FileInfo AuthConfig Limit > # > AllowOverride All > > # > # Controls who can get stuff from this server. > # > Order allow,deny > Allow from all > > > > > > > > > > --~--~-~--~~~---~--~~ 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: User Based RSS
You are indeed close, just add the has after the controller url, like this: my_controller/my_rss/user_hash it will automatically expect a user hash because that's what you've setup in the function: function my_rss($user_hash) sometimes you may also need multiple variables: function my_function($category, $url) the url structure will be like this: my_controller/my_function/category/url I hope you understand it now, pretty easy after all huh? On Mar 8, 7:21 am, dsgndvlp <[EMAIL PROTECTED]> wrote: > I guess I spoke too soon! I tried it and just realized its still not > working as I thought. Specifically my issue is that how can CakePHP > know that the user_hash part in my url > ofhttp://myapp.com/my_controller/my_rss/user_hash > is set without declaring a var > likehttp://myapp.com/my_controller/my_rss?user_hash=12048489009112 > > I tried using this in the controller but the explode keeps giving me > an error and I am not sure why. I am so close i can taste it too! > > class Thank extends AppModel > { > var $name = 'Thank'; > > var $thispage = explode('/',$_SERVER['REQUEST_URI']); > > var $feed = array( > 'conditions' => array('Thank.rss_hash' => '$thispage[2]'), > 'titleField' => 'Thank.title', > 'descField' => 'Thank.title', > 'link' => '/thanks', > 'orderby' => array('Thank.created' => 'DESC'), > 'limit' => 10 > ); > > } > > On Mar 8, 12:09 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > Thanks so much Johan - this makes a lot of sense now. The > > clarification is super helpful! > > > Take care, > > daniel > > > On Mar 3, 8:56 am, "Johan @ Notitia.nl" <[EMAIL PROTECTED]> wrote: > > > > With the example url (http://myapp.com/my_controller/my_rss/user_hash) > > > you should create a controller like this: > > > > > > > class MyController extends AppController { > > > $name = 'MyController'; > > > $uses = array('MyModel'); > > > $components = array('MyRssComponent'); > > > > function my_rss($user_hash = null) > > > { > > > if(!$user_hash) > > > { > > > $this->set('data', 'No UserHash defined'); > > > } > > > else > > > { > > > $data = $this->MyModel->findAll(array('user_hash' => > > > $user_hash)); > > > $this->set('data', $data); > > > } > > > } > > > > } > > > > All you have to have now is a view which transforms the $data array to > > > a RSS feed. > > > > On Mar 3, 7:06 am, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > I tried getting this all working and am > > > > usinghttp://bakery.cakephp.org/articles/view/automagic-rss-feed-generator-... > > > > on my build of CakePHP 1.1. > > > > > My only issue, is I don't understand how to find out thehashfor the > > > >userthat is given in the URL. For instance, in a URL > > > >likehttp://myapp.com/my_controller/my_rss/user_hashhowcanIonly get the > > > > user_hash from the URL to compare to myhashin theusertable? > > > > > Any help is super appreciated because I am just spinning my wheels at > > > > tthis point. I know I am s close to! > > > > > Thanks, > > > > daniel > > > > > On Jan 6, 1:19 pm, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > > Thanks so much Williamg! I understand now! > > > > > > I'm going to try this out tonight and let you guys know how it goes. > > > > > If I create any good code out of it I'll be sure to share. > > > > > > Thanks so much, > > > > > daniel > > > > > > On Dec 26 2007, 2:44 pm, Williamg <[EMAIL PROTECTED]> wrote: > > > > > > > Hi Daniel, if you use the link I sent earlier.. you should be able > > > > > > to set up > > > > > > a quick and easy feed. > > > > > > > Now, about customising it so that eachuserhas a unique URL, you > > > > > > could > > > > > > follow my earlier recommendation of adding ahashfield in your users > > > > > > table. > > > > > > -- > > > > > > | users | > > > > > > -- > > > > > > id > > > > > > username > > > > > > rss_hash > > > > > > - > > > > > > > In your controller, (using the techniques) at that link i sent you > > > > > > can check > > > > > > if the request is anrssrequest. > > > > > > > If it is, retrieve thehashfrom the url and get theuserfrom the > > > > > > database > > > > > > wherehash=hashretrieved from the url. > > > > > > > That should work nicely. This will allow you to issue unique urls > > > > > > to each > > > > > >userwithout explicit authentication. Obviously if the data in the > > > > > >feed is > > > > > > sensitive then you probably want to add a few security measures to > > > > > > the above > > > > > > method. I hope this helps.. > > > > > > > P.S: I use cake 1.2 > > > > > > > On Dec 26, 2007 6:11 PM, graphicdefine <[EMAIL PROTECTED]> wrote: > > > > > > > > Thanks for the response! That sounds easy enough but i am not > > > > > > > sure > > > > > > > what the method should look like. My usual login code? > > >
Reusable Elements
How to translate this code in smarty? View Template: $posts = $this->requestAction('posts/index'); foreach($posts as $post): echo $post['Post']['title']; endforeach; --~--~-~--~~~---~--~~ 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: Sanitize and validation
Hi Nate, thank you for examine my problem... I thought I've read anywhere that cake does not santize data automatically on a save action. Thats why I thought i need to build a method in app_model.php which does this automatically. If cake escapes automatically then all its fine. I delete my method and it will work properly... Thank you! Regards, Alexander On 4 Mrz., 00:52, nate <[EMAIL PROTECTED]> wrote: > All database inputs are automatically escaped when you save. What are > you trying to sanitize for exactly? If you continue to have problems, > try using debug() to examine the data before and after sanitizing to > see what the differences are. > > On Mar 3, 6:42 pm, cronet <[EMAIL PROTECTED]> wrote: > > > Nobody else having problems with sanitzing data and validate on save ? > > > I'm still having this problem. I would like to know how to get my data > > mysql safe and validating correctly. > > Anybody has some hints for me? > > > Regards, > > Alexander --~--~-~--~~~---~--~~ 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: Dynamic Error Messages in 1.2?
This will be implemented before the next release. On Mar 7, 8:26 pm, Mike <[EMAIL PROTECTED]> wrote: > Thanks for your suggestion - I was thinking about that, and here's > what I came up with. If you can see any holes/offer any refinements, > I'd love to hear about them :) > > Part of the reason I'm against this is that I've already got a > function that does what I want, and I'm looking to reuse it in > CakePHP, rather than redo everything the Cake way. > > Another part is that I think that if I redo this in Cake, it'll end up > being more awkward, because I want this functionality to be used for > multiple fields (so I'll need the same collection of rules, for each > and every field). > > My goal: > I want to create a directory on the server, so that users can upload > files to the server. When the 'superuser' creates the directory, I > want there to be 2 options: > 1) Use an existing directory > 2) Use an existing directory if it's there, and create it if not. > > So, breaking this down into pieces, it seems like there are a couple > of steps: > 1) If the directory exists: > 1.1) If it's writable, then we're done & we're good > 1.2) If it's NOT writable, then we're done & we've got an error > > 2) If it doesn't exist: > 2.1) If the user has elected to create the directory when it doesn't > exist, > then create it > 2.1.1) We may encounter errors trying to create the directory > > 2.2) If the user has elected to NOT create the directory when it > doesn't exist > then we're done, and we've got an error > > Basically, the user types the directory into a textbox, then checks a > checkbox to indicate 'create if not present' > > So - if I have a rule which says 'check for the existence (and > writability) of the directory', and it finds that the directory isn't > there, then we may need to give the user an error, OR we may not > (depending on the 'create if not already there' checkbox). That would > be 1 rule, I guess. > > Next, if the directory doesn't exist, but we want to create it, we'll > try to do that. Which is a second rule. There are a couple of > different things that could go wrong, so I guess we'll use a semi- > generic error message, and hope that's helpful enough :) > > This all gets further complicated by a desire to reuse this for > several different fields - now I need to copy this set of validation > rules into the second (and third, etc, etc) fields, too, which is > getting kind of awkward. It's not the end of the world, but having > all the (related) logic in one function is kinda nice, and this way, > that one function can produce exact error messages. > > Thanks! > --Mike > > On Mar 7, 4:19 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > > Why not just create a second validation method and narrow the first > > one to whatever concerns the message you've set for it? > > > On Fri, Mar 7, 2008 at 6:46 PM, Mike <[EMAIL PROTECTED]> wrote: > > > > Thanks for the reply! One of the big reasons I went with Cake is that > > > it seemed to have an active, friendly community. I'm glad to be part > > > of it! :) > > > > I tried this out, and it doesn't seem to work. Looking at the code in > > > cake/libs/model/model.php, specifically the invalidFields method, just > > > below where the call_user_func_array function is called, it appears > > > that if the user-defined validation method (i.e., my method) returns > > > false, then the Cake code will call Model::invalidate using the > > > default error message for that rule. > > > > Since this happens after my method has finished executing, this means > > > that the error message that my method set is now overwritten with the > > > default 'message'. > > > > As a matter of fact - looking at the code in the invalidFields, it > > > looks like it's impossible to have a validation method create a > > > dynamic error message, given the code that's there, now. > > > > Does anybody else have an interest in being able to create dynamic > > > error messages from within a validation method/function? If so, how > > > do we ask for this feature to be incorporated into Cake? > > > > Thanks! > > > --Mike > > > > On Mar 7, 7:31 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > > > > Have you tried Model::invalidate(...)? > > > > >http://api.cakephp.org/1.2/class_model.html#81c94997c2d6158c40efd9c70... > > > > > On Mar 6, 10:29 pm, Mike <[EMAIL PROTECTED]> wrote: > > > > > > Hello! > > > > > > In CakePHP 1.2, one can define a validation rule (in a model) that > > > > > calls a method to do the validation. If the method returns false, > > > > > then whatever message was specified for that rule is displayed in the > > > > > view, which is great for most of data validation needs. > > > > > > However, in the case that the method returns false, I'd to have that > > > > > method change the 'message' to be something new (which the method > > > just > > > > > generated). It looks like I can do this by hack
Re: Reusable elements
I know for that article,but there in no answer on my question On Mar 8, 12:57 pm, Jason <[EMAIL PROTECTED]> wrote: > Isn't there an article on that here: > > http://bakery.cakephp.org/articles/view/how-to-use-smarty-with-cake-s... > > or is that not what you're asking? > > On Mar 8, 11:55 am, herc <[EMAIL PROTECTED]> wrote: > > > How to create 'cake' reusable elements in Smarty Template engine? --~--~-~--~~~---~--~~ 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: multiple submit buttons in a form
Check out the $param array in your Controller when the submit occurs: Array ( ... [form] => Array ( [b] => Submit ) ... ) BTW, I changed the 'name' for your submit button to 'b', so it is different to the edit button. Obviously if the edit button was clicked you'd see [a] => Edit. On Mar 8, 8:47 am, bob <[EMAIL PROTECTED]> wrote: > How can I have multiple submit buttons in a form? > > echo $form->create('Form', array('url'=>$url)); > > echo $form->submit('Edit',array('div'=>false,'name'=>'a','value'=>'edit')); > echo > $form->submit('Submit',array('div'=>false,'name'=>'a','value'=>'submit')); > > echo $form->end(); > > in the above, how do i determine which button i clicked on? > > thanks --~--~-~--~~~---~--~~ 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: Unit Testing Controller using fixture in test_suit config
I've spent the last two days working with this and whilst I have had some success I eventually came to the conclusion that it's not really the best way to test controllers, at least not for me. I don't think that's the way they intended it to be used and I'm starting to agree with them. Either that or they've just beaten me down *until* I agree with them... Here's one way I got it to use the test suite settings in my controller: function testTest() { $controller = new MembersController(); $controller->Member = new MemberTest(); $controller->MemberProfile = new MemberProfileTest(); $controller->Project = new ProjectTest(); $controller->get(1); debug($controller->viewVars); /* assert things here */ } It's really naff which is why I eventually decided on another course of action, but it does force my controller to use the test suite Models (obviously you need to declare those test Models somewhere so that they use the test suite tables set up by your fixtures). $controller->viewVars should contain any of the things which have been set in your Controller for passing to the View, and I assume that's what you'd be wanting to inspect. Trouble is that this isn't strictly unit testing since you're not testing the Controller in isolation, you're testing the Controller and the Model (and the View if you use testAction). The way I'm now trying to work it is to put a lot of the logic from my Controllers into the Model so it can be tested. To be honest I should have done it that way in the first place since things like login validation for passwords and the like probably belong there. That means I can test more of the application with the test suite doing what it is best at and testing of the Controllers is much less of an issue. I suggest that if you want to test the Controller then you create mocks for your Models, i.e. Models that don't really interact with the database but have predefined data in them. That isolates the Controller for testing and means the database is no longer an issue. Even then you may have problems with Model associations should you want to test anything that uses that. Probably not what you wanted to hear and if anyone else does have a good (and simple - if it ain't simple then people won't do it) way of doing it then I'd be very interested. But for now I rather write code than struggle to actually test it in a repeatable way! Jason. On Mar 6, 1:16 am, Micro <[EMAIL PROTECTED]> wrote: > Does anyone know how to test controller in CakePhp 1.2 using the > test_suit controller? I am using the testAction function to test my > controller. However, it goes to the non-test_suit database. Any idea? --~--~-~--~~~---~--~~ 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: Reusable elements
Isn't there an article on that here: http://bakery.cakephp.org/articles/view/how-to-use-smarty-with-cake-smartyview or is that not what you're asking? On Mar 8, 11:55 am, herc <[EMAIL PROTECTED]> wrote: > How to create 'cake' reusable elements in Smarty Template engine? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How can include another page
Hi, I want to use Tabs with the cake php pages, means i need more than one page in a single view so i just include these pages through But its mapping is not being with the controller and model ..So any one can tell me hoe can i include another page with cake php Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Updating a select box using ajax in cake php
Hello i have a selectbox which is populated with states when form is loaded. i want to populate the cities for the corresponding states in another selectbox when i will select the state from the selectbox please help me by some example and code thanks --~--~-~--~~~---~--~~ 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: Reusable elements
How to connect view element (smarty) with controller? On Mar 8, 12:55 pm, herc <[EMAIL PROTECTED]> wrote: > How to create 'cake' reusable elements in Smarty Template engine? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using a model in app_controller
I want to generate a few routes automatically in my application by finding all 'conferences' and using the 'path' field from each. Do do this I need to findAll conferences in my app_controller, but I don't know how. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Helpers in rss ?
I just read this rss fnctionality in cake.. http://natealicio.us/posts/view/5 But how can i use helpers in the transform rss ? --~--~-~--~~~---~--~~ 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: Form posting and AJAX problem.
More info would be required - does the second select box not show up on the server side, or have you inspected the AJAX call itself to see its not being passed in the first place? What does populate_sub_types() actually do? This might not relate to Cake... On Mar 7, 4:59 pm, Manu0310 <[EMAIL PROTECTED]> wrote: > Hi I have a standard cakePHP form with 2 select boxes. > > The 2nd select box is populated with an AJAX call based on what is > selected in the first one. > > The ajax call replaces the entire contents of the div with this > id="sub_type_select". > > Problem is when I submit the form the 2nd select box's value isn't > being posted. Any help or insight would be appreciated. > > The code is as follows: > > //First select box > onchange="Javascript:populate_sub_types()" name="data[User][type]" > style="width:180px;"> > some options > > > //2nd select box which is being populated based on first select box. > > > Select a Sub type > > > > Thanks a lot. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple submit buttons in a form
I believe the name and value of the submit button pressed is usually passed in POST requests (but doesn't make it into $data unless you name it correctly). Check $_POST, or Cake equivalents, to see if your submit button info was passed along with the request. I'm sure this has been asked before on this group with a more thorough explanation, keep searching if you need more info On Mar 8, 8:47 am, bob <[EMAIL PROTECTED]> wrote: > How can I have multiple submit buttons in a form? > > echo $form->create('Form', array('url'=>$url)); > > echo $form->submit('Edit',array('div'=>false,'name'=>'a','value'=>'edit')); > echo > $form->submit('Submit',array('div'=>false,'name'=>'a','value'=>'submit')); > > echo $form->end(); > > in the above, how do i determine which button i clicked on? > > thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Indexing a HABTM table
Is it normally good practice to index a HABTM table? If so how do you do this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Reusable elements
How to create 'cake' reusable elements in Smarty Template engine? --~--~-~--~~~---~--~~ 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: 404 for simplest setup.
Hi!! Cake gives always a 404 error, whatever the real problem was. To change this you should set DEBUG to 1 in the app/config/core.php file. Maybe you problem has to do with the Apaches rewrite module: http://manual.cakephp.org/chapter/installing, section 5. Goos luck!! Kchopein. sooonism escribió: hi guys, I just setting up for my windows xp using WAMP as my server locally and having a 404 error. i tried "localhost/cake/app" and i get what i wanted. but after the blog tutorial that after i created model, controller and views, i tried "localhost/cake/app/posts/index", i get an 404 error. but i check all the folder and files it's all there. any idea of the setting side that i missed out?? i mean i practically follow all the setting from the main blog tutorial. by the way, i installed it to my mac running on XAMP and it works. thanks! sooon --~--~-~--~~~---~--~~ 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: cakephp on kubuntu...no way
Hi! I think your problem is the .htaccess file. Read here http://manual.cakephp.org/chapter/installing, in section 5. I'm using CakePHP in Ubuntu for 5 months now and works fine. Good luck!! Kchopein. mcphisto escribió: Hi, I'm using cakeph since 1 year and never had problems with windows xp and easy php 2.0.1. Now I installed kubuntu and I can't get my applications working. I only see the home page without any style css and when i try a link it says "page not found". The only doubt I've is my httpd.conf file. I post here the configuration. I want my applications run under /var/ www. Is there something wrong. DocumentRoot /var/www/ LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cakephp on kubuntu...no way
Hi, I'm using cakeph since 1 year and never had problems with windows xp and easy php 2.0.1. Now I installed kubuntu and I can't get my applications working. I only see the home page without any style css and when i try a link it says "page not found". The only doubt I've is my httpd.conf file. I post here the configuration. I want my applications run under /var/ www. Is there something wrong. DocumentRoot /var/www/ LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
multiple submit buttons in a form
How can I have multiple submit buttons in a form? echo $form->create('Form', array('url'=>$url)); echo $form->submit('Edit',array('div'=>false,'name'=>'a','value'=>'edit')); echo $form->submit('Submit',array('div'=>false,'name'=>'a','value'=>'submit')); echo $form->end(); in the above, how do i determine which button i clicked on? thanks --~--~-~--~~~---~--~~ 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: Optional Form Field
On Mar 7, 8:11 pm, Greg Baker <[EMAIL PROTECTED]> wrote: > I did this by adding 'required' => false, 'allowEmpty' => true in my > validation array One thing that is often overlooked (IMHO) is that the validation option is for the model; not exactly for the form. -- 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 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 -~--~~~~--~~--~--~---