Re: Media View / Download: How to count finished downloads?
Hey, I modified the MediaView to be a Component, and added some stuff - you can find the component here: http://bin.cakephp.org/view/599576961 1. Add to components array in the controller. 2. Parameters are the same, only you should use $this->Download- >download($params); instead of $this->set($params); (And no need to set the view to 'media' 3. the download-method returns true only successful download, false if interrupted/cancelled 4. Additional variables are available after a file has been downloaded (or not): $this->Download->speed (KB/s), $this->Download->time (How long did it take to send the file), $this->Download->sent (If interrupted, how much was sent to the user) On Jan 3, 6:10 pm, DigitalDude wrote: > Hey, > > in my app I have some type of file uploading, and also downloading. > I'm using Cake's Media View, so I can send the file to the user after > authenticating that he/she is allowed to get that file. > > So I was wondering, is there any chance to COUNT these downloads? All > I have in my action is a view-like action which sets the params. I > could then just save a counting value to my databse, but I think > that's not really the way to go... > > (basic usage of the media view...) > > $this->view = 'media'; > $params = array( > 'id' => $file['Upload']['hash'], > 'name' => $file['Upload']['name'], > 'download' => true, > 'extension' => $file['Upload']['type'], > 'path' => APP . '/uploads/'.$modelpath.'/' > ); > $this->set($params); > > Is there any kind of callback or so after a user has successfully > downloaded a file? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: $this->passedArgs breaking my Routes
Have you tried Router::connectNamed(array('images')); ? Each named parameter needs to be connected like this for url generation to function correctly. On 6 Mar., 08:53, geoff wrote: > Hey all. > > I have a fairly troublesome problem that has really been grating my > goat for the past little while. It has to do with the supplying of > named parameters to a URL, and having them break my pagination. I have > a feeling that the example below might explain this better: > > --- > > __Route configuration__ > Router::connect('/wap/', array('controller' => 'categories', 'action' > => 'index', 'prefix' => 'wap')); > Router::connect('/wap/:controller/:action/*', array('prefix' => 'wap', > 'wap' => true)); > [ As far as I can understand, this will map /wap/users/view/4 => > userscontroller/wap_view/4 ] > > --- > > __Pagination__ > options(array('url' => $this->passedArgs))?> > [ This is what I am using to set the pagination URL options. ] > > --- > > Now, this works fine when I have no named parameters (e.g. URL: /wap/ > products/index/22/page:3/). However, as soon as I add in another named > parameter - no matter what the named parameter - the URLs used in the > pagination are broken; they don't seem to use the reverse routing > anymore. This is an example of the kinds of URLs that are generated > once another named parameter is added: /products/wap_index/22/page:3/ > images:on. > > So, as you can see, it merely takes the user to the controller/action > URL, which is not the way that I would want it. > > I'm suspecting that this might actually just be because there is some > silly parameter that I haven't included or something. If there is > anyone that can help me, or at least point in the a decent direction, > I would really appreciate it! > > Cheers, > Geoff --~--~-~--~~~---~--~~ 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: Warning (2): fopen(cakephp/app/tmp/cache/persistent/cake_core_dir_map) [function.fopen]: failed to open stream: Permission denied [CORE/cake/libs/file.php, line 146]
Are you executing the cake app using cron? If so, try to put umask(002); in bootstrap and purge tmp files. On Nov 3, 10:50 am, Malcolm Krugger <[EMAIL PROTECTED]> wrote: > Sorry I should have mentioned earlier > > I set 777 perms for /app/tmp and all of its subdirectories too already > > Mal > > On Nov 2, 7:36 pm, Anupom <[EMAIL PROTECTED]> wrote: > > > I think you need to set writable permission to the /app/tmp directory and > > its subdirectories. --~--~-~--~~~---~--~~ 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: Custom Routes & Back Tracing with CakePHP 1.2
TAke a look at http://groups.google.com/group/cake-php/browse_thread/thread/1a53136e5d9825de/5d8fb07be683c39e?lnk=gst&q=biesbjerg#5d8fb07be683c39e On 25 Aug., 15:17, Adrian <[EMAIL PROTECTED]> wrote: > I am working on a site that will need 3 themes, one each for the games > the community is playing. After reading about custom routes I thought > I had the brilliant idea of using prefix routes to set the variable of > the game. So I set up 3 routes like so > > Router::connect('/jge/:controller/:action', array('prefix' => 'jge'); > Router::connect('/potbs/:controller/:action', array('prefix' => > 'potbs'); > Router::connect('/war/:controller/:action', array('prefix' => 'war'); > > Each controller would then have an appropriately prefixed action that > would set the flag indicating what game data the controller was > supposed to use and then would call a more generic action to handle > the actual processing. However this is not quite working like I > thought it would and may turn out to be more work than is necessary. > > So I did some more searching and found this post here > > http://groups.google.com/group/cake-php/browse_thread/thread/debd9269... > > and I'm wondering if something like this may be possible: > > Router::connet('/:game/:controller/:action', array('game' =>'[a-z]+') > > Also, I seemed to have run into some issues with Form helper > defaulting to the first prefix when creating the action attribute of > the form despite not being in that path. For example I was playing > around with the Auth component and accessed /users/login directly > without any of the prefix paths, but this line > > $form->create('Login', array('action' => 'login')) > > automatically decided that the action for the form should be /jge/ > users/login. Is this supposed to happen? --~--~-~--~~~---~--~~ 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: parameter 0 in requestAction do not work
Hi Klaus, Try $this->requestAction(array('controller'=>'repairs', 'action'=>'getData'), array('pass' => array(0))); On 18 Aug., 11:11, Klaus Schwarzkopf <[EMAIL PROTECTED]> wrote: > Hi, > > i use the requestAction funktion with a parameter. The value of the > parameter is 0. > > My cake version is 1.2.0.7296 RC2. > > Controller: > > $action='/repairs/getData/0'; > > $this->set('repairs', $this->requestAction($action)); > > I get this error: > > Warning (2): Missing argument 1 for RepairsController::getData(), called > in /var/www/auftragnew/cake/cake/libs/object.php on line 115 and defined > [APP/controllers/repairs_controller.php, line 22] > > Code > > function getData($id) > > RepairsController::getData() - APP/controllers/repairs_controller.php, > line 22 > Object::dispatchMethod() - CORE/cake/libs/object.php, line 115 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 261 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 234 > Object::requestAction() - CORE/cake/libs/object.php, line 99 > OrdersController::view() - APP/controllers/orders_controller.php, line 652 > Object::dispatchMethod() - CORE/cake/libs/object.php, line 117 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 261 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 234 > [main] - APP/webroot/index.php, line 90 > > This function call does not work, too. > > $this->requestAction(array('controller'=>'repairs', 'action'=>'getData', > 0)); > > Thanks > > Klaus --~--~-~--~~~---~--~~ 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: how to handle multiple gaming categories?
I would do it like this: Router::connect('/:cat/sells', array('controller' => 'sells', 'action' => 'index'), array('cat' => 'wow|uo')); Now you can access: domain.com/wow/sells domain.com/uo/sells in your controller's action you can check $this->params['cat'] which will contain either wow or uo. On 20 Aug., 19:29, rocket <[EMAIL PROTECTED]> wrote: > Wait sorry. Is generic() some built in feature? > I don't quite get it o_O. > > On Aug 19, 4:48 pm, Adrian <[EMAIL PROTECTED]> wrote: > > > I'm doing something similar. If you look towards the bottom of that > > link there is a section about prefixes. So your routes look like > > > Router::connect('/wow/:controller/:action'); > > > What I'm doing is in the controllers I have an action that takes care > > of all the generic logic that can't be accessed by the users: > > > function _sell() { > > //some code here that uses $this->game > > > } > > > Then other publicly accessible functions for each category that set > > the category flag and then call the generic function: > > > function wow_sell(){ > > $this->game = 'wow'; > > $this->_generic(); > > > } > > > This way you have all code that is generic the same for each call in > > one location and the specific actions just set the proper flag. Hope > > this helps. > > > On Aug 19, 4:16 pm, rocket <[EMAIL PROTECTED]> wrote: > > > > i thought i relpied to tis is there a delay? test > > > > On Aug 19, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote: > > > > > Should be easily handled with > > > > routes...http://book.cakephp.org/view/46/routes-configuration > > > > > There are some good tutorials "out there" as well. > > > > > On Aug 19, 12:28 pm, rocket <[EMAIL PROTECTED]> wrote: > > > > > > hello > > > > > i'm building a trading post for my two favorite games, WoW and Ultima > > > > > Online, but i'm not sure how to handle categories. > > > > > > It will be a common buy/selll/trade pos. > > > > > > Ideally URLs would look like this: > > > > > >www.tradingpost.com/wow/www.tradingpost.com/uo/ > > > > > > I know I can create separate folders to do this in the controller, wow > > > > > and uo respectivley, but then if i do something like this > > > > > >www.tradingpost.com/wow/sellwww.tradingpost.com/uo/sell > > > > > > How do I just share the "sell" controller between them, and rely on > > > > > the wow/uo section of the URL to declare the "category ID" for my SQL > > > > > database? > > > > > > does anyone have any tips? thanks --~--~-~--~~~---~--~~ 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: Automatic propagation of named params?
Overwrite url method in your app_helper.php. Here's what I've done for keeping language in my urls: class AppHelper extends Helper { function url($url = null, $full = false) { if (is_array($url)) { $default = Configure::read('Config.defaultLanguage'); if (empty($url['lang']) && isset($this->params['lang']) && $this- >params['lang'] != $default) { $url['lang'] = $this->params['lang']; } elseif (isset($url['lang']) && $url['lang'] == $default) { unset($url['lang']); } } return parent::url($url, $full); } } class AppController . function redirect($url, $status = null, $exit = true) { if (is_array($url)) { if (empty($url['lang']) && isset($this->params['lang']) && $this- >params['lang'] != Configure::read('Config.defaultLanguage')) { $url['lang'] = $this->params['lang']; } elseif (isset($url['lang']) && $url['lang'] == Configure::read('Config.defaultLanguage')) { unset($url['lang']); } } return parent::redirect($url, $status, $exit); } function beforeFilter() { if (empty($this->params['lang'])) { $this->params['lang'] = Configure::read('Config.defaultLanguage'); } } This will put language param into all generated urls but for the default one (I don't want language prefix for default language - Shorter urls = better SEO) Hope this helps. On Jul 8, 10:20 am, sam <[EMAIL PROTECTED]> wrote: > The thing is: I actually want the parameter in my URL, since it is > significant to the user -- so storing it in the session is really not > an option. I'd rather not rely on sessions (and thus enabled Cookies) > for a critical part of the application anyway. (Of course, login/ > logout is critical too and does require a Cookie, but you can expect > users to activate them if they need to authenticate for a specific > task). > > So if there is no automated way, I'll probably solve it by adding a > method __link() to my controller that adds the "layout" argument to > any array passed and that I call wherever a link needs to be built. > > However, if anyone can suggest a better strategy I'll be happy to > consider it. > > On 8 Jul., 04:31, "b logica" <[EMAIL PROTECTED]> wrote: > > > You could store it in the session and have your controllers check that > > in beforeFilter(). Or, rather, check to see if it's in $this->params > > first, then session, and finally have a default to fall back on. > > > On Mon, Jul 7, 2008 at 5:52 AM, sam <[EMAIL PROTECTED]> wrote: > > > > Dear Cake pros, > > > > I have a route that allows me to switch the layout by supplying it as > > > the first parameter in de URI. Example for using the "green" layout: > > > >http://myhost/green/items/index > > > > Here's the route: > > > > Router::connect('/:layout/:controller/:action/*', array('controller' > > > => 'items', 'action' => 'index') ,array('layout' => 'red|green')); > > > > Now, I would like my controllers to propagate the "layout" parameter > > > automatically, without requiring me to code this manually wherever I > > > create a link or redirect to a page. Is this possible? > > > > If not, what would be the best way to achieve this? > > > > Thank you very much. > > > Sam --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Besøg denne side "CakePHP In The Wild"
Added Hotel Domir Odense, CAKEPHP app to the list. http://groups.google.com/group/cake-php/web/cakephp-in-the-wild --~--~-~--~~~---~--~~ 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: cake extract in different files problem
What rev. are you using? https://trac.cakephp.org/ticket/3519 - Fixed 8 months ago On Jun 23, 9:41 pm, Alberto <[EMAIL PROTECTED]> wrote: > Hi, I was using cake extract and I realized a possible bug in the > script. > > I used the function __d(domain, text) to set the text in different > files. > > When I use the "cake extract" to create the .po file and I answer 'no' > to: > > "Would you like to merge all translations into one file? (y/n)" > > the result is that each output file adds the text of the previous > files. I mean, the first file processed has it's own text, but the > second has the text from the first file and the second... and so on > > What I'm doing wrong? --~--~-~--~~~---~--~~ 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: Cakephp 1.2 l10n and i18n - how to switch current language?!
I don't think it's possible to change language mid-page, as you just said, i18n is a singleton and the po/mo file is parsed and loaded once per request. On Jun 25, 6:47 pm, Pento <[EMAIL PROTECTED]> wrote: > Thanks, but it not work correctly when for example auth component is > used. > Problem because of Singlton pattern used in "cake/libs/i18n.php" > translate function: $_this =& I18n::getInstance(); > When I call $this->Session->write('Config.language', 'ru'); > it's already called in auth component before, so I can't change > immediately current language in controller method. Only in next page > loading it will be changed. > But my method generates some report on various languages and I need to > change current language for correct genetaration in the scope of > method. > > On Jun 25, 2:00 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > > > On Wed, Jun 25, 2008 at 3:02 PM, Pento <[EMAIL PROTECTED]> wrote: > > > > Hello, everybody! > > > > How can I control current langauge for l10n and i18n in my controller? > > > $this->Session->write('Config.language', 'new lang TLA'); > > > ?? > > > T > > > -- > > = > > Cheesecake-Photoblog:http://cheesecake-photoblog.org > > PHP for E-Biz:http://sanisoft.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: Cakephp 1.2 l10n and i18n - how to switch current language?!
Like this: $this->Session->write('Config.language', 'dan'); On 25 Jun., 11:32, Pento <[EMAIL PROTECTED]> wrote: > Hello, everybody! > > How can I control current langauge for l10n and i18n in my controller? --~--~-~--~~~---~--~~ 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: TreeBehavior and callbacks
Okay, solved =) function deleteAll($conditions, $cascade = true, $callbacks = true) { $this->Behaviors->disable('Tree'); $return = parent::deleteAll($conditions, $cascade, $callbacks); $this->Behaviors->enable('Tree'); return $return; } On 11 Jun., 11:52, biesbjerg <[EMAIL PROTECTED]> wrote: > Hi again, > > I put the following in my Asset model : > > function deleteAll($conditions, $cascade = true, $callbacks = true) { > $this->Behaviors->detach('Tree'); > $return = parent::deleteAll($conditions, $cascade, > $callbacks); > $this->Behaviors->attach('Tree'); > return $return; > } > > I placed a $this->log('Tree::beforeDelete was called for Asset.id ' . > $model->id) in beforeDelete callback in TreeBehavior. Even though I > detach TreeBehavior in Asset::deleteAll Tree::beforeDelete gets called > for every cascaded row delete. That's strange. Any ideas? > > On 7 Jun., 19:21,biesbjerg<[EMAIL PROTECTED]> wrote: > > > Hi grigri, > > > thanks for your feedback. > > > I get what you're saying, but is it just me or does it seem "wrong" to > > corrupt the tree, even though we fix it again (re-sync it)? > > > On Jun 5, 5:09 pm, grigri <[EMAIL PROTECTED]> wrote: > > > > > Then the children will not get deleted and I'll end up with orphans.. > > > > Really? I admit I don't use the TreeBehavior, but I am familiar with > > > MPTT hierarchies, and I've got the code in front of me. > > > > I might well be wrong, but it seems like this: > > > > With the above code: > > > > 1. You call Asset::del(), maps to Model::del(); > > > 2. Upload::beforeDelete() is called, file is deleted () > > > 3. Tree::beforeDelete() is called with , Tree:deleteAll() is > > > called (once) for all descendants of (not just direct children) > > > 4. Tree::deleteAll() detaches Tree behavior > > > 5. Tree::deleteAll() calls Model::deleteAll() with cascade and > > > callbacks > > > 6. Model::deleteAll() performs a find('all') - retrieving the ids of > > > all the descendants, calls Asset::del() on each descendant (maps to > > > Model::del()) > > > 7. [each descendant] Model::del() calls Asset::beforeDelete, file is > > > deleted > > > (Tree::beforeDelete() is not called because it's still detached) > > > 8. Tree::deleteAll() re-attaches Tree behavior and exits > > > 9. Upload::beforeDelete re-syncs the tree > > > 10. rest of Asset::del() > > > > I could be completely wrong here, but looking at the code it seems to > > > me this is how it would play out. --~--~-~--~~~---~--~~ 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: TreeBehavior and callbacks
Hi again, I put the following in my Asset model : function deleteAll($conditions, $cascade = true, $callbacks = true) { $this->Behaviors->detach('Tree'); $return = parent::deleteAll($conditions, $cascade, $callbacks); $this->Behaviors->attach('Tree'); return $return; } I placed a $this->log('Tree::beforeDelete was called for Asset.id ' . $model->id) in beforeDelete callback in TreeBehavior. Even though I detach TreeBehavior in Asset::deleteAll Tree::beforeDelete gets called for every cascaded row delete. That's strange. Any ideas? On 7 Jun., 19:21, biesbjerg <[EMAIL PROTECTED]> wrote: > Hi grigri, > > thanks for your feedback. > > I get what you're saying, but is it just me or does it seem "wrong" to > corrupt the tree, even though we fix it again (re-sync it)? > > On Jun 5, 5:09 pm, grigri <[EMAIL PROTECTED]> wrote: > > > > Then the children will not get deleted and I'll end up with orphans.. > > > Really? I admit I don't use the TreeBehavior, but I am familiar with > > MPTT hierarchies, and I've got the code in front of me. > > > I might well be wrong, but it seems like this: > > > With the above code: > > > 1. You call Asset::del(), maps to Model::del(); > > 2. Upload::beforeDelete() is called, file is deleted () > > 3. Tree::beforeDelete() is called with , Tree:deleteAll() is > > called (once) for all descendants of (not just direct children) > > 4. Tree::deleteAll() detaches Tree behavior > > 5. Tree::deleteAll() calls Model::deleteAll() with cascade and > > callbacks > > 6. Model::deleteAll() performs a find('all') - retrieving the ids of > > all the descendants, calls Asset::del() on each descendant (maps to > > Model::del()) > > 7. [each descendant] Model::del() calls Asset::beforeDelete, file is > > deleted > > (Tree::beforeDelete() is not called because it's still detached) > > 8. Tree::deleteAll() re-attaches Tree behavior and exits > > 9. Upload::beforeDelete re-syncs the tree > > 10. rest of Asset::del() > > > I could be completely wrong here, but looking at the code it seems to > > me this is how it would play out. --~--~-~--~~~---~--~~ 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: TreeBehavior and callbacks
Hi grigri, thanks for your feedback. I get what you're saying, but is it just me or does it seem "wrong" to corrupt the tree, even though we fix it again (re-sync it)? On Jun 5, 5:09 pm, grigri <[EMAIL PROTECTED]> wrote: > > Then the children will not get deleted and I'll end up with orphans.. > > Really? I admit I don't use the TreeBehavior, but I am familiar with > MPTT hierarchies, and I've got the code in front of me. > > I might well be wrong, but it seems like this: > > With the above code: > > 1. You call Asset::del(), maps to Model::del(); > 2. Upload::beforeDelete() is called, file is deleted () > 3. Tree::beforeDelete() is called with , Tree:deleteAll() is > called (once) for all descendants of (not just direct children) > 4. Tree::deleteAll() detaches Tree behavior > 5. Tree::deleteAll() calls Model::deleteAll() with cascade and > callbacks > 6. Model::deleteAll() performs a find('all') - retrieving the ids of > all the descendants, calls Asset::del() on each descendant (maps to > Model::del()) > 7. [each descendant] Model::del() calls Asset::beforeDelete, file is > deleted > (Tree::beforeDelete() is not called because it's still detached) > 8. Tree::deleteAll() re-attaches Tree behavior and exits > 9. Upload::beforeDelete re-syncs the tree > 10. rest of Asset::del() > > I could be completely wrong here, but looking at the code it seems to > me this is how it would play out. --~--~-~--~~~---~--~~ 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: TreeBehavior and callbacks
Then the children will not get deleted and I'll end up with orphans.. I'm attaching a proposed patch to the ticket (Not fully implemented - Only for beforeDelete/afterDelete callbacks) On 5 Jun., 16:13, grigri <[EMAIL PROTECTED]> wrote: > > Unfortunately, enabling callbacks in deleteAll corrupts the tree... > > Yeah, that makes sense. What about deactivating the tree behavior, > performing the delete, then reactivating it? > > function deleteAll($conditions, $cascade=true, $callbacks=true) { > $this->Behaviors->detach('Tree'); > $ret = parent::deleteAll$conditions, $cascade, $callbacks); > $this->Behaviors->attach('Tree'); > return $ret; > > } > > Will that 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: TreeBehavior and callbacks
Unfortunately, enabling callbacks in deleteAll corrupts the tree... Opened a ticket here https://trac.cakephp.org/ticket/4846#preview On 5 Jun., 12:13, grigri <[EMAIL PROTECTED]> wrote: > Just override the Asset::deleteAll function: > > class Asset extends AppModel { > // ... > > function deleteAll($conditions, $cascade=true, $callbacks=true) { > // Note the default parameter change : $callbacks is now true if > unspecified > return parent::deleteAll($conditions, $cascade, $callbacks); > } > > } > > On Jun 5, 10:56 am, biesbjerg <[EMAIL PROTECTED]> wrote: > > > Hi guys, > > > I could use some ideas here. Here's the deal: > > > I have this model, Assets, which holds references to uploaded files in > > my app. > > My UploadBehavior has some callbacks, one of them is beforeDelete > > which makes sure the file gets deleted from the filesystem before > > deleting the row in the database. > > > The problem I'm facing is that when you delete an asset with children, > > TreeBehavior deletes children using deleteAll without invoking > > callbacks, so my files aren't deleted from the filesystem. > > > I would like some ideas to put this together, so that when an asset > > (an asset can be a folder too) is deleted, all children gets deleted, > > including the files in the filesystem. Any ideas? > > > Here's my model, for reference: > > > > class Asset extends AssetsAppModel { > > var $name = 'Asset'; > > var $displayField = 'filename'; > > > var $order = array( > > 'folder' => 'DESC', > > 'lft' => 'ASC', > > 'filename' => 'ASC' > > ); > > > var $actsAs = array( > > 'Assets.Upload', > > 'Tree' > > ); > > > function find($type, $options = array()) { > > switch ($type) { > > case 'folders': > > return parent::find('all', Set::merge(array( > > 'conditions' => array('folder' => > > 1), > > 'fields' => array('id', 'lft', > > 'rght', 'parent_id', 'filename'), > > ), $options)); > > case 'images': > > return parent::find('all', Set::merge(array( > > 'conditions' => array('image' => 1), > > ), $options)); > > default: > > return parent::find($type, $options); > > } > > }} > > > ?> > > > And my UploadBehavior's beforeDelete callback, which isn't being > > called when TreeBehavior does it's stuff: > > > function beforeDelete(&$model) { > > extract($this->settings[$model->alias]); > > if ($this->Folder->rm($path . $model->id . DS)) { > > return true; > > } > > return false; > > > } > > > Hope you guys have some ideas, thanks for your time! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
TreeBehavior and callbacks
Hi guys, I could use some ideas here. Here's the deal: I have this model, Assets, which holds references to uploaded files in my app. My UploadBehavior has some callbacks, one of them is beforeDelete which makes sure the file gets deleted from the filesystem before deleting the row in the database. The problem I'm facing is that when you delete an asset with children, TreeBehavior deletes children using deleteAll without invoking callbacks, so my files aren't deleted from the filesystem. I would like some ideas to put this together, so that when an asset (an asset can be a folder too) is deleted, all children gets deleted, including the files in the filesystem. Any ideas? Here's my model, for reference: 'DESC', 'lft' => 'ASC', 'filename' => 'ASC' ); var $actsAs = array( 'Assets.Upload', 'Tree' ); function find($type, $options = array()) { switch ($type) { case 'folders': return parent::find('all', Set::merge(array( 'conditions' => array('folder' => 1), 'fields' => array('id', 'lft', 'rght', 'parent_id', 'filename'), ), $options)); case 'images': return parent::find('all', Set::merge(array( 'conditions' => array('image' => 1), ), $options)); default: return parent::find($type, $options); } } } ?> And my UploadBehavior's beforeDelete callback, which isn't being called when TreeBehavior does it's stuff: function beforeDelete(&$model) { extract($this->settings[$model->alias]); if ($this->Folder->rm($path . $model->id . DS)) { return true; } return false; } Hope you guys have some ideas, thanks for your time! --~--~-~--~~~---~--~~ 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: Plugin Model Association Problem
Add var $name = 'User'; & var $name = 'UserProfile'; as properties in your models and I think you're golden :-) On May 24, 10:19 am, francky06l <[EMAIL PROTECTED]> wrote: > Can you pass your model definition code ? > I have the same kind of plugin and not much problems, maybe I declare > the association in different way. > I set the plugin name into the className parameter ie : > belongTo => array('Profile' => array('className' => > 'user.Profile') > > Wich cake version are you using ? > > On May 24, 12:05 am, "Christopher E. Franklin, Sr." > > <[EMAIL PROTECTED]> wrote: > > On May 23, 2:49 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > > If the user model is in the plugin it should not a problem.. Maybe the > > > problem is how you call the find and from where ? > > > I do the find in the UsersController::read() function. It seems to me > > that it is a problem with the association because, when I set > > $this->User->recursive = -1; I get back just the user. But, anything else, > > > it tries to pull the UserProfile and screws up. > > > > I guess this is when you try to find user from the application and not > > > the plugin ? > > > No, I make the call from the users_controller in the plugin. > > > >Maybe the problem comes from the "calling" rather than > > > the callee ? > > > I don't see a problem with $this->User->findById(1); but, like I said, > > if I set recursive to -1 I get the user I want but, not the > > user_profile. I wanted to get both. > > > Alternatively, I can set the UserModel and UserProfileModel both to > > recursive = -1 and just live with the extra calls but, this would be a > > pain if I want to find all users. > > > I have also tried declaring different $hasOne and $belongsTo without > > the plugin name like, 'User' instead of 'users.User' but, if I do > > that, it says that it cannot find the database table user_profiles for > > the 'UserProfile' model. > > > > hth > > > Thank you for replying :) --~--~-~--~~~---~--~~ 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: Why custom model functions inside plugin models are not called?
Hi Aranworld, You should use var $belongsTo = array('Comment' => array('className' => 'PluginName.Comment')) On Apr 22, 9:02 pm, aranworld <[EMAIL PROTECTED]> wrote: > Here is what I had to do: > > in pluginname/models/article.php > > App::import('Model', 'Pluginname.Comment'); > > class Article extends PluginnameModel { > > $belongsTo = array('Comment'); > > } > > Now in pluginname/controllers/articles_controller.php > > I do > > $uses = array('Pluginname.Article'); > > On Apr 21, 3:59 pm, Max <[EMAIL PROTECTED]> wrote: > > > Consider a scenario: > > > In file /app/controllers/users_controller.php > > > //review is the plugin model which is here: /app/plugins/reviews/ > > models/review.php > > var $uses = array('User', 'Review'); > > > function getUserReviews() > > { > > $reviews = $this->Review->getRecent(); //this will throw sql > > error.. anyone knows a reason? findAll() still works > > > } > > > On the other hand, if in bootstrap.php, I manually modify $modelPaths > > array to add the model location. It works just fine. I dont like this > > hack however... > > > uses('Folder'); > > $Folder =& new Folder(APP.'plugins'); > > $plugins = $Folder->ls(); > > > foreach($plugins[0] as $plugin) > > { > > array_push($modelPaths, APP.DS.'plugins'.DS.$plugin.DS.'models'.DS); > > > } > > > Abhimanyu --~--~-~--~~~---~--~~ 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: Why custom model functions inside plugin models are not called?
I'll bet echo get_class($this->Review) will output 'AppModel'. The reason is you need to define $uses like this when accessing plugin models: var $uses = array('User', 'Reviews.Review'); You should do the same when creating associations within the plugin's models: PluginName.ModelName. Good luck. On Apr 22, 12:59 am, Max <[EMAIL PROTECTED]> wrote: > Consider a scenario: > > In file /app/controllers/users_controller.php > > //review is the plugin model which is here: /app/plugins/reviews/ > models/review.php > var $uses = array('User', 'Review'); > > function getUserReviews() > { > $reviews = $this->Review->getRecent(); //this will throw sql > error.. anyone knows a reason? findAll() still works > > } > > On the other hand, if in bootstrap.php, I manually modify $modelPaths > array to add the model location. It works just fine. I dont like this > hack however... > > uses('Folder'); > $Folder =& new Folder(APP.'plugins'); > $plugins = $Folder->ls(); > > foreach($plugins[0] as $plugin) > { > array_push($modelPaths, APP.DS.'plugins'.DS.$plugin.DS.'models'.DS); > > } > > Abhimanyu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
TreeBehavior belongsTo scope
Hi guys, I'm trying to store multiple MPTTs in a single table using these model associations: Menu hasMany MenuItem MenuItem belongsTo Menu 'ASC'); var $actsAs = array('Tree' => array('scope' => 'Menu')); var $belongsTo = array( 'Menu' => array( 'className' => 'Menus.Menu', 'foreignKey' => 'menu_id', 'conditions' => '', 'fields' => '', 'order' => '', 'counterCache' => '') ); } ?> Above attaches the TreeBehavior using this scope: MenuItem.menu_id = Menu.id The problem is that the whole table is treated as one big tree, making TreeBehavior::up()/down() etc. behave rather funky (obviously). Anyone have an idea how to make this 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Email Component Minor Fix in 1.2
Hi MikeK, Register yourself on the trac site. https://trac.cakephp.org/register You'll then be able to submit tickets. On Oct 31, 2:13 am, MikeK <[EMAIL PROTECTED]> wrote: > I use the email component and it was driving me nuts inserting a > newline in the front of every email (any 1.2 version including pre > beta). I finally traced it to this: > > file cake/lib/controller/component/email.php on or around line 477: > $this->__header .= 'Content-Transfer-Encoding: 7bit' . $this- > > >_newLine; > > This is the final line in the __createHeader routine and the linefeed > here causes every email to have a linefeed at the top. I tried to > write a ticket but didn't have permission in Trac. > > WHat do I need to do to be able to submit prs? --~--~-~--~~~---~--~~ 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: I can no longer directly access the index method?
Where is your index method defined? in app_controller or in a normal controller? On Sep 14, 12:37 am, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > "You are seeing this error because the private class method index > should not be accessed directly." > > Apparently this is part of the latest SVN update of 1.2. Ideas? > Thoughts? Explanation? > > Thanks, > > Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange routes/Router::url() behavior
Hi, Correct way to implement above route would be: Router::connectNamed(array('community_id')); Router::connect('/:community_id/bulletins/:action/*', array('controller' => 'bulletins'), array('community_id' => '[0-9]+')); On Sep 10, 10:40 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have been working all morning on this without any luck. This is on > Cake 1.2 (branch) / 5626. The only nonstandard thing I'm doing is app > and webroot dirs outside the normal locations (and renamed), but that > shouldn't make a difference with this. > > ROUTE > $Route->connect('/:community_id/bulletins/:action/*', > array('controller' => 'bulletins')); > > CONTROLLER/VIEW > echo $html->url(array('community_id'=>203, 'controller'=>'bulletins', > 'action'=>'view', 'bulletin_id'=>23423)); > > EXPECTED URL: > /203/bulletins/view/bulletin_id:23423 > > RETURNED URL: > /bulletins/view > > MODIFICATION (bulletin_id param removed) > echo $html->url(array('community_id'=>203, 'controller'=>'bulletins', > 'action'=>'view')); > > RETURNED URL: > /203/bulletins/view --~--~-~--~~~---~--~~ 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: Customizing HTML Tags
You can either extend the core HtmlHelper and overload the tags property, or you could copy the html helper from cake core into you app folder and edit the tags in there. On Jun 15, 9:42 pm, rtconner <[EMAIL PROTECTED]> wrote: > Maybe some of you old school cakers might know this one. I was just > reading some older Cake articles. It seems there used to be this thing > where you could create a tags.ini.php file and customize your HTML > tags. Does this feature still exist in any fashion? I can't find a > tags.ini.php file at all. It would be great to be able to format some > of the HTML the way our designers like it as a default behavior. Just > curious. > > Thanks, > Rob --~--~-~--~~~---~--~~ 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: poEdit and translations messes up!
Not 100% sure, but maybe I misinterpreted how poEdit / getText works. I think maybe the translations I thought had shifted places is actually translations marked as 'fuzzy'. Seems poEdit tries to automagically 'guess' translations for new strings when updating from a pot file. On Jun 5, 3:01 pm, biesbjerg <[EMAIL PROTECTED]> wrote: > Hi, > > When opening po files in poEdit (created with poEdit) for updating I > get an alert saying 'We don't support state callbacks yet!' and I can > chose to ignore further warnings. > > If I do that it loads the in file with translations, but some > translations have shifted a place down no longer matching their > original translation. > > Am I the only one experiencing this? > > Haven't been able to find any alternatives to poEdit on windows, to > check if this is a poEdit issue or not. > > Any help is 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 -~--~~~~--~~--~--~---
poEdit and translations messes up!
Hi, When opening po files in poEdit (created with poEdit) for updating I get an alert saying 'We don't support state callbacks yet!' and I can chose to ignore further warnings. If I do that it loads the in file with translations, but some translations have shifted a place down no longer matching their original translation. Am I the only one experiencing this? Haven't been able to find any alternatives to poEdit on windows, to check if this is a poEdit issue or not. Any help is 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 -~--~~~~--~~--~--~---
Re: CakePHP 1.2 validation - userDefined function
Okay, looks like userDefined isn't implemented yet. So I tried my luck with beforeValidate() callback, and got it to work - sort of. function beforeValidate() { $data = $this->data; if(!empty($this->id)) { $assetType = ife($this->isFolder($this->id), 0, '> 0'); $result = $this->hasAny( array( "{$this->name}.name" => $data[$this->name]['name'], "{$this->name}.{$this->primaryKey}" => "!= {$data[$this->name] [$this->primaryKey]}", "{$this->name}.parent_id" => $data[$this->name]['parent_id'], "{$this->name}.asset_type_id" => $assetType ) ); } else { $assetType = ife($this->isFolder($this->id), 0, '> 0'); $result = $this->hasAny( array( "{$this->name}.name" => $data[$this->name]['name'], "{$this->name}.parent_id" => $data[$this->name]['parent_id'], "{$this->name}.asset_type_id" => $assetType ) ); } if($result) { $this->invalidate('name'); return false; } return true; } This code prevents Model::save() when appropiate, but I can't get it to show an error message in the view? Have tried : input('name', array('error' => 'Invalidated')));?> No luck so far. Thoughts and comments are very welcome!! On Mar 20, 8:42 am, "biesbjerg" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I'm trying to check if a record already exists (based on a filename), > if it does it should fail validation. > > I'm using CakePHP 1.2 and had a look at 'userDefined' which looks like > it should call a custom function. > This function I'm talking > about:http://api.cakephp.org/1.2/validation_8php-source.html#l00633 > > Here's what I've tried: > > function uniqueFilename() > { > return false; > > } > > var $validate = array( > 'name' => array( > 'rule' => array( > 'userDefined' => array('Asset', > 'uniqueFilename', array('param1', > 'param2')) > ), > 'message' => 'Filename already exists!' > ) > ); > > Above code gives me a couple of errors: > > Notice (8): Undefined offset: 0 [CORE/cake/libs/model/model.php, line > 1683] > > Context | Code > > $this = Asset object > $data = array("parent_id" => "574", "name" => "Lloyd Banks ft. 50 Cent > - Hands Up (Dirty).mp3", "id" => "576") > $Validation = Validation object > $validator = array("allowEmpty" => true, "message" => "Angiv > venligst > en titel for siden", "rule" => array, "on" => null) > $fieldName = "name" > > $this->invalidate($fieldName, > $validator['message']); > > } elseif (isset($data[$fieldName])) { > > if (is_array($validator['rule'])) { > > $rule = $validator['rule'][0]; > > unset($validator['rule'][0]); > > Model::invalidFields() - CORE/cake/libs/model/model.php, line 1683 > Model::validates() - CORE/cake/libs/model/model.php, line 1633 > Model::save() - CORE/cake/libs/model/model.php, line 993 > AssetsController::admin_edit() - APP/controllers/ > assets_controller.php, line 123 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 348 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 330 > [main] - ROOT//www/index.php, line 84 > > Notice (8): Undefined property: SessionComponent::$themeWeb [CORE/ > cake/libs/controller/components/session.php, line 195] > > Context |
CakePHP 1.2 validation - userDefined function
Hi guys, I'm trying to check if a record already exists (based on a filename), if it does it should fail validation. I'm using CakePHP 1.2 and had a look at 'userDefined' which looks like it should call a custom function. This function I'm talking about: http://api.cakephp.org/1.2/validation_8php-source.html#l00633 Here's what I've tried: function uniqueFilename() { return false; } var $validate = array( 'name' => array( 'rule' => array( 'userDefined' => array('Asset', 'uniqueFilename', array('param1', 'param2')) ), 'message' => 'Filename already exists!' ) ); Above code gives me a couple of errors: Notice (8): Undefined offset: 0 [CORE/cake/libs/model/model.php, line 1683] Context | Code $this = Asset object $data = array("parent_id" => "574", "name" => "Lloyd Banks ft. 50 Cent - Hands Up (Dirty).mp3", "id" => "576") $Validation = Validation object $validator = array("allowEmpty" => true, "message" => "Angiv venligst en titel for siden", "rule" => array, "on" => null) $fieldName = "name" $this->invalidate($fieldName, $validator['message']); } elseif (isset($data[$fieldName])) { if (is_array($validator['rule'])) { $rule = $validator['rule'][0]; unset($validator['rule'][0]); Model::invalidFields() - CORE/cake/libs/model/model.php, line 1683 Model::validates() - CORE/cake/libs/model/model.php, line 1633 Model::save() - CORE/cake/libs/model/model.php, line 993 AssetsController::admin_edit() - APP/controllers/ assets_controller.php, line 123 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 348 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 330 [main] - ROOT//www/index.php, line 84 Notice (8): Undefined property: SessionComponent::$themeWeb [CORE/ cake/libs/controller/components/session.php, line 195] Context | Code $flashMessage = "Asset updated" $layout = "flash_success" $params = array() $key= "flash" $ctrl = null $view = View object $view->params= $this->params; $view->action= $this->action; $view->data= $this->data; $view->themeWeb = $this->themeWeb; $view->plugin= $this->plugin; SessionComponent::setFlash() - CORE/cake/libs/controller/components/ session.php, line 195 AssetsController::admin_edit() - APP/controllers/ assets_controller.php, line 125 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 348 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 330 [main] - ROOT//www/index.php, line 84 Warning (2): Cannot modify header information - headers already sent by (output started at /web/lib/1.2.x.x_04.03.2007/cake/basics.php:869) [CORE/cake/libs/controller/controller.php, line 498] 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: Bake fatal error
Get the nightly build at http://cakephp.org/downloads/index/nightly/ 1.2.x.x The bug has been fixed there. On Feb 11, 4:33 am, "Jeffrey" <[EMAIL PROTECTED]> wrote: > What would cause this error when trying to use bake to create a new > model? > > Fatal error: Class 'Model' not found in /Users/jeffreystevison/Sites/ > cake/cake/scripts/bake.php on line 435 --~--~-~--~~~---~--~~ 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, SWFupload
I use SWFUpload. But you have to hack the core though. In app/config/bootstrap.php add this: if (isset($_GET[CAKE_SESSION_COOKIE])) { session_name(CAKE_SESSION_COOKIE); session_id($_GET[CAKE_SESSION_COOKIE]); } Now in cake/libs/session.php find this line: if ($this->_userAgent == $this->readSessionVar("Config.userAgent") && $this->time <= $this->readSessionVar("Config.time")) { And change it to : if ($this->time <= $this->readSessionVar("Config.time")) { Finally, your backend upload script should look like: "upload.php?" . session_name() . "=" . session_id(); this is to transfer the session ID. The code in bootstrap makes sure to use the same session if CAKEPHP is set in the url. As you've guessed the problem caused by cake's session protection. It includes a user-agent check and flash sends this user-agent: Shockwave Flash Happy uploading :-) On Feb 1, 11:18 pm, "hausburger" <[EMAIL PROTECTED]> wrote: > Hello. > > we use this very nice workaround (http://swfupload.mammon.se/) for a > multi-file-upload via Flash. > that works fine. > > but the user should be logged in. that means there has to be a valid > session. > the session in cake are stored in cookies. and now the problem: > the flash/swf does not store that session cookie. > > can i force CAKEPHP to use the session_id which i send via URL/GET? > something like that: > > www.myproject.com/controller/action/?CAKEPHP=5464efsop2kdpk0ß3i5rfkstioß3t > > Best Regards. > Oli --~--~-~--~~~---~--~~ 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: bake.php script writes models, but not controller or views
Hi miggs, I recently had this problem. Turns out I had made a copy of a model (backed up app/models/media_folder.php as app/models/media_folder - Copy.php) I deleted this file and everything worked fine again. Guess app/models is only for models, eh? ;-) On Jan 17, 11:09 pm, "miggs" <[EMAIL PROTECTED]> wrote: > I've used thebake.php script in the past with great results, but > recently when I try to create acontroller, it goes through the script > like normal, but never writes the files. I've tried both building the > conroller interactively as well as not. I was wondering if anyone had > any experience with this happening? It's probably something simple I'm > missing, but I'm stumped. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Layout specific helpers
I have certain helpers needed in some layouts - not views - Currently I'm including them in app_controller.php but that seems like a waste of ressources when layouts not using these helpers are rendered. An example could be a menu helper. A menu belongs to the layout - Not the view being rendered. So my question is: Is there a better way to get access to a helper per layout? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---