Re: How can I do this query in CakePHP 1.1.x
I don't know for CakePHP v1.1.x. However, if you use CakePHP v1.2.2 - -- Here is the User Model array( 'foreignKey'=>false, 'type'=>'INNER', 'conditions'=>array('Page.user_id=User.id'), ) ); }; -- And in the controller User=ClassRegistry::init('User'); $this->paginate=array('User'=>array('conditions'=> array ( 'Page.status'=>1, 'User.username'=>'tehtreag', ), 'order'=>'User.username', 'fields'=>array( 'User.id', 'User.username', 'Page.id', ), ) ); debug($this->paginate('User')); $this->autoRender=false; } That should work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using PHP to export MySQL data MS excel files
Sorry liaogz82, I don't have any examples to show, and searching google was not fruitful. On Dec 9, 8:15 pm, liaogz82 wrote: > hi Reggie, > > As i am a newbie in cakePHP, I am not sure how to integrate the pear > libraries into the vendor folder of cake. Have you publish any > documents or post any blog that will aid me in getting started? > > On Dec 10, 3:12 am, Reggie Mason wrote: > > > I've had success with the PEAR's Spreadsheet Excel Writer > > --http://pear.php.net/package/Spreadsheet_Excel_Writer, with CakePHP. > > I'm not sure about charts; I'd leave that to Excel. Make sure PEAR is > > in your include path, and include it in your view. Enjoy. > > > On Nov 26, 12:54 am, liaogz82 wrote: > > > > Hi, > > > > I am looking into ways to use cakePHP to query into MySQL database to > > > extract out the relevant data, then export out a report in MS excel > > > that will include several pie charts. Such reports are to review by > > > user on the browser first before it is being exported. Is there anyway > > > to do it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Capturing form errors
Use $form->isFieldError() in your view to check if there is an error for the field, and use $form->error() to display the error message. -ReggieB On Dec 10, 2:19 am, "Arthur Pemberton" <[EMAIL PROTECTED]> wrote: > When using the form helper to bind controls to data, validation errors > are helpfully passed onto the page. How do I replicate this for custom > controlls (PHP in the views)? > > Thank you. > > -- > Fedora 9 : sulphur is good for the skin > (www.pembo13.com) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using Gzip
I have this in a Directory block in my httpd.conf. It uses mod_deflate AddOutputFilterByType DEFLATE text/html text/plain \ text/javascript application/x-javascript text/ css >From howtoforge - http://www.howtoforge.com/apache2_mod_deflate -ReggieB On Dec 10, 8:24 am, "Arak Tai'Roth" <[EMAIL PROTECTED]> wrote: > Is anybody able to help me with this? > > I've seen other ways of doing Gzip, such as mod_gzip, but I'm not sure > if those ways gzip javascript files as well or just delivered html. So > if there is a better way to do this then I am doing, please let me > know. > > On Dec 9, 3:58 pm, "Arak Tai'Roth" <[EMAIL PROTECTED]> wrote: > > > So I have tried to gzip some of my javascript files (primarily > > prototype.js) and using that instead of the normal. However for some > > reason, it's not working. What I used to have and is working is: > > > $javascript->link(array('prototype', 'scriptaculous.js?load=effects', > > 'fade_appear'), false); > > > Then I gzipped prototype.js and changed it to this: > > > $javascript->link(array('prototype.js.gz', 'scriptaculous.js? > > load=effects', 'fade_appear'), false); > > > That didn't work, so I also tried: > > > $javascript->link(array('/js/prototype.js.gz', 'scriptaculous.js? > > load=effects', 'fade_appear'), false); > > > And that doesn't work as well. So I guess what I am wondering is how > > do I go about using gzipped javascript files? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using PHP to export MySQL data MS excel files
I've had success with the PEAR's Spreadsheet Excel Writer -- http://pear.php.net/package/Spreadsheet_Excel_Writer, with CakePHP. I'm not sure about charts; I'd leave that to Excel. Make sure PEAR is in your include path, and include it in your view. Enjoy. On Nov 26, 12:54 am, liaogz82 <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking into ways to use cakePHP to query into MySQL database to > extract out the relevant data, then export out a report in MS excel > that will include several pie charts. Such reports are to review by > user on the browser first before it is being exported. Is there anyway > to do it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Remove password hashing in AuthComponent
Mark, The AuthComponent has an authenticate member. If you set this member to an object with a hashPasswords method, it will be used instead of the default behavior of the AuthComponent. One thing that a.php.programmer left off is to set this member in your app_controller. Here is an example in the beforeFilter. app_controller.php Auth->authenticate = $this->User; // the rest of your beforeFilter } } Next, add the hashPassword described by a.php.programmer to your user model. models/user.php http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to include functionality in models
You can always provide a base class other than AppModel that contains the extra methods you need for text processing. class TextModel extends AppModel { function textProcessing(){...} } class Article extends TextModel { function save(...){ $this->textProcessing(...); ... } } or create other classes as needed, cakePHP still handles regular old PHP without any problems class TextProcessor { function textProcessing(...){...} } -- model/article.php require "textProcessor.php"; class Article extends AppModel { function save(...){ $textProcessor = new TextProcessor(); $textProcessor->textProcessing(); } } -reggieB On Jul 10, 10:30 am, CrazyDave <[EMAIL PROTECTED]> wrote: > Hi, > > I've been wanting to include some extra functionality in a model but > wanted to know the best CakePHP way of going about things. > > For example we've got controllers and components, then views and > helpers. > > I want my model to "behave" as normal but say use something like a > helper to process the text before saving / validation. I did think > about processing certain content in the model with Geshi but could see > no easy way of doing so with adding it in all the models required or > the appmodel. > > Should behaviours be used for this sort of thing? As it doesn't quite > seem right to me at the moment. > > Thanks for any help, > Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: (n00b) Issue setting layout
Or without modifying pages_controller.php In /app/views/pages/one.ctp (for CakePHP1.2) layout='eggs'; ?> This page uses the eggs layout And, in /app/view/pages/about.ctp layout='bacon'; ?> This page uses the bacon layout On Apr 17, 7:59 am, grigri <[EMAIL PROTECTED]> wrote: > If you really need to change the layout per-page, then extending the > page_controller is the way to go. There's a bakery article on this > subject [http://bakery.cakephp.org/articles/view/taking-advantage-of- > the-pages-controller] > > Basically, if you have a page called 'faq' then the pages controller > method 'faq' will be called (if it exists), so you'd go: > > class PagesController extends AppController { > // ... > > function faq() { > $this->layout = 'eggs'; > } > > function about() { > $this->layout = 'bacon'; > } > > // ... > > } > > Do I really need to make an *empty* model, an *empty* database table > > and an *empty* controller - just to set the layout of a static page? > > Nope. You do need a controller, but not a model or database table. The > pages controller is an example of how to do this. > > -- > > If it's just a matter of the javascript though, that doesn't require a > different layout [assuming you're on 1.2 - you didn't say]: > > /app/views/pages/one.thtml > > This page has no extra script > blabla bla > > /app/views/pages/two.thtml > > link('mootoolscomp', false); ?> > codeBlock(<< window.addEvent('domready', function() { > // something here > }); > SCRIPT; > , array('inline' => false)); ?> >This page DOES have extra scripts
>hahaha
> > On Apr 17, 9:54 am, kaffe <[EMAIL PROTECTED]> wrote: > > > But I think my issue is as follows: > > > Do I really need to make an *empty* model, an *empty* database table > > and an *empty* controller - just to set the layout of a static page? > > > I have tried to take the cake page_controller and moving it to my app/ > > controllers/... but still I have this issue that I have pages that are > > mostly HTML that just need to set the layout or for instance just be > > behind a loging. > > > I am not sure if its is possible, but it would seem that making static > > pages are a bit difficult? It might be due to my ignorance... =) > > > Kind regards > > > Kristian > > > On Apr 17, 3:08 am, aranworld <[EMAIL PROTECTED]> wrote: > > > > Here is where you can get this kind of > > > answer:http://book.cakephp.org/view/94/views#layouts-96 > > > > Create two layout templates and put them in the views/layouts > > > directory. Lets say: > > > > default.ctp > > > plain_jane.ctp > > > > Now in your controller action function, add the following: > > > > $this->layout = 'default'; > > > > or > > > > $this->layout = 'plain_jane'; > > > > And either default or plain_jane will be used. > > > > On Apr 16, 11:48 am, kaffe <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I am new to cake, but I have run into an annoying issue (I have spend > > > > a few days reading cakephp.org, searching google, reading the IBM turs > > > > etc). > > > > > Heres the deal I have two problems: > > > > > I am building a site that has some pages with database content that > > > > would require models and controllers; but I am also having several > > > > pages that are static - needless to say they go in: app/views/pages/ > > > > > For instance: about.thtml, faq.thtml - these pages does IMHO not need > > > > to go to the database, its only a few Kb of data and I like just doing > > > > them as plain html. > > > > > We can imagine having one layout for a page with many pictures and > > > > another for a faq that is mostly plain text and just one long column? > > > > > Issue: > > > > How do I load different app/views/layouts/ via app/views/pages/? it > > > > seems that some stuff has already rendered by the time we get to the > > > > app/views/pages/ content ... is there a workaround or proper way of > > > > doing it? > > > > > Also, we can imagine that one type of page would require the inclusion > > > > of a 60 kb Javascript in the layout whereas another page does not need > > > > to include this... > > > > > e.g. > > > > > > > > >> > > > > > > >