Re: Query Question
City belongsTo State Assuming Cake 1.2: $cities = $this->City->find('list', array('fields'=>array('City.id', City.name', 'State.name'), 'recursive'=>1) ); Then you can have a form select with cities as the data source, you should get exactly what you want. On May 12, 9:00 am, Kyle Decot <[EMAIL PROTECTED]> wrote: > I want to make a side nave bar with states and cities of that state as > sub items. How would I write a query to do this? I want something > like: > > Florida > _Orlando > _Daytona > Ohio > _Columbus > _New Albany > > etc... > > Thanks as always for the help. --~--~-~--~~~---~--~~ 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: This is more of a general application design question than a CakePHP question...
Making the remote service API requests for every one of your page requests is a bad idea - you have to use some kind of caching (save locally). Otherwise your page load times could be completely unstable (what if there is a 5 second delay between your server and one of the services?), plus you could be making way too many requests (if you are getting 100 requests/sec, your server is making 500 service requests/ sec?). So just have a process that checks the remote services every 30-60 seconds or so, it'll be frequently enough and it'll make the whole local data thing so much easier. On May 12, 12:03 pm, Action <[EMAIL PROTECTED]> wrote: > Yeah, comments would be an afterthought if I had the data locally, so > that's what I originally thought about doing. BUT the problem with > that is that how do I determine when I save that data? Do I just run a > save query 15 times each time a page is loaded (or the cache is > updated) with isUnique set in the model's validation parameters? > > On May 11, 9:52 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote: > > > My answers below... > > > On Sun, May 11, 2008 at 9:44 PM, Action <[EMAIL PROTECTED]> wrote: > > > I'm trying to make a "tumblelog" using CakePHP. What this application > > > will do is pull in a list of recent activity on services like flickr, > > > twitter, delicious, youtube, etc. and display any posts made on them > > > in chronological order. > > > If you're not already, I'd pull all of these items and save them to a > > local table, normalising them into a consistent format (date, title, > > body). > > > > The problem I've encountered is how to deal with a comment system. > > > Each item would have a unique ID and a comment would simply be > > attached to that ID. > > > > comment to the post). The problem here is how do I get a comments > > > count next to each post without running a separate query for each post > > > title? > > > You'll need to do one query using COUNT and GROUP BY to sum up comment > > totals for each item. > > > -Jonathan Snook --~--~-~--~~~---~--~~ 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: forced download
On Mon, May 12, 2008 at 1:14 AM, crazyDavid <[EMAIL PROTECTED]> wrote: > > Thank you Traique and jonknee for the reply. > > But as i'm using session, it doesn't allow me to send header info > later. Use output buffering (read about the ob_ series of functions) OR Figure out how to use mediaview Tarique -- = 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: Custom tags no longer working in 1.2 Beta...has something changed?
function __construct(){ parent::__construct(); $this->loadConfig(); } try putting that in the helper, i got results doing that with debug($this->tags) in a method of the helper 2008/5/12 Action <[EMAIL PROTECTED]>: > > This is what I have: > > app/app_helper.php : > > class AppHelper extends Helper { >function __construct(){ > parent::__construct(); >$this->loadConfig(); >} > } > ?> > > app/config/tags.php : > > $tags = array( >'block' => '%s', >'blockstart' => '', >'blockend' => '' > ) > ?> > > > > On May 11, 7:37 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > > try in your helper > > > > function __construct(){ > > parent::__construct(); > > $this->loadConfig(); > > } > > > > that displays what I have in the $tags array of config/tags.php > > > > and to load $this->loadConfig('mytags'); you'd have a file named > > core/mytags.php > > > > and the array in $tags = Array( > > > > ) > > > > hth - S > > > > 2008/5/11 Action <[EMAIL PROTECTED]>: > > > > > > > > > That is exactly what I am doing and what I've always done. The problem > > > is that it no longer works. > > > > > On May 11, 6:33 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > > > > In 1.2 to load the custom tags you can create your own AppHelper > class > > > in > > > > app/app_helper.php. > > > > > > > > > class AppHelper extends Helper { > > > > > > function __construct(){ > > > > $this->loadConfig(); > > > > parent::__construct(); > > > > }} > > > > > > ?> > > > > > >https://trac.cakephp.org/ticket/2081 > > > > > > - S > > > > > > 2008/5/11 Marcin Domanski <[EMAIL PROTECTED]>: > > > > > > > It changed - look at $this->tags in helper(s) > > > > > > > On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED] > > > > > wrote: > > > > > > > > I built an app using 1.2 pre-beta that uses a tags.php in > > > app/config > > > > > > called from app/app_helper.php that sets custom html tags for > > > certain > > > > > > helper-generated markup. > > > > > > > > In 1.2 Beta, it no longer works. It simply isn't applying my > custom > > > > > > tags. Has this changed from pre-beta to beta...or is it simply > > > broken > > > > > > now? > > > > > > > -- > > > > > Marcin Domanski > > > > >http://kabturek.info > > > --~--~-~--~~~---~--~~ 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: This is more of a general application design question than a CakePHP question...
Yeah, comments would be an afterthought if I had the data locally, so that's what I originally thought about doing. BUT the problem with that is that how do I determine when I save that data? Do I just run a save query 15 times each time a page is loaded (or the cache is updated) with isUnique set in the model's validation parameters? On May 11, 9:52 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote: > My answers below... > > On Sun, May 11, 2008 at 9:44 PM, Action <[EMAIL PROTECTED]> wrote: > > I'm trying to make a "tumblelog" using CakePHP. What this application > > will do is pull in a list of recent activity on services like flickr, > > twitter, delicious, youtube, etc. and display any posts made on them > > in chronological order. > > If you're not already, I'd pull all of these items and save them to a > local table, normalising them into a consistent format (date, title, > body). > > > The problem I've encountered is how to deal with a comment system. > > Each item would have a unique ID and a comment would simply be > attached to that ID. > > > comment to the post). The problem here is how do I get a comments > > count next to each post without running a separate query for each post > > title? > > You'll need to do one query using COUNT and GROUP BY to sum up comment > totals for each item. > > -Jonathan Snook --~--~-~--~~~---~--~~ 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: This is more of a general application design question than a CakePHP question...
My answers below... On Sun, May 11, 2008 at 9:44 PM, Action <[EMAIL PROTECTED]> wrote: > I'm trying to make a "tumblelog" using CakePHP. What this application > will do is pull in a list of recent activity on services like flickr, > twitter, delicious, youtube, etc. and display any posts made on them > in chronological order. If you're not already, I'd pull all of these items and save them to a local table, normalising them into a consistent format (date, title, body). > The problem I've encountered is how to deal with a comment system. Each item would have a unique ID and a comment would simply be attached to that ID. > comment to the post). The problem here is how do I get a comments > count next to each post without running a separate query for each post > title? You'll need to do one query using COUNT and GROUP BY to sum up comment totals for each item. -Jonathan Snook --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
This is more of a general application design question than a CakePHP question...
I'm trying to make a "tumblelog" using CakePHP. What this application will do is pull in a list of recent activity on services like flickr, twitter, delicious, youtube, etc. and display any posts made on them in chronological order. The front page, for example, will display the most 10-15 recent items globally (could be from any of those webservices). None of these posts are stored in my database, they are queried from the webservice on the fly. The problem I've encountered is how to deal with a comment system. I want people to be able to comment any item (these comments will be stored in my database -- they are independent of the webservice). Currently, whenever someone adds a comment, it is saved along with the id or title of the item they commented on (some webservices dont provide an ID, so the post title is all I have that connects their comment to the post). The problem here is how do I get a comments count next to each post without running a separate query for each post title? For the front page, that would be 15 individual queries just grab the comments count for each one. Is there a better/more efficient way to do this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Insallation
I have been atempting to install Cakephp (newest stable) on a appserv (appache) home server. I have to (it seems very common issues) issues: 1. when I point apache to the root in which I place cake I get the php error-log in my browser. i have edited the php.ini file to all ,and the only difference is whether I get _STRICT errors or Deprecated errors (seen at the bottom of this post). My other issue is that if I try to point the webroot to the appserv default root (www) it comes up fine but when I atempt to access phpadmin 2.10 link, it pops up with a username and login prompt for a username and login I do not have? I would like someone to A. explain what they think the problem is And, B. explain the solution. I have done (to the be4st of my ability) everything that I have found on the posts, literally installed and reinstalled on the server software and cake 40 times. edited the .conf files and .ini files as per every post I have found. The problem is many times on the posts the folks are not very discriptive with their solutions. I am new to php and is why I want to install cakephp (to play with it alittle), however, I am far from new to computing and html. I am general a quick study and if I have access to the the correct info and able to execute with little trouble. the issue is not one of app versions (unless cake does not run with the appserv bundle) the error log could be a placement issue, but that does not address the login prompt. Thanks for your assistance. ERROR REPORT: Strict Standards: Redefining already defined constructor for class Object in I:\AppServ\www\cake\cake\libs\object.php on line 69 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\object.php on line 94 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\security.php on line 48 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\inflector.php on line 65 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\configure.php on line 89 Strict Standards: Non-static method Configure::getInstance() should not be called statically in I:\AppServ\www\cake\cake\bootstrap.php on line 43 Strict Standards: Non-static method Configure::write() should not be called statically in I:\AppServ\www\cake\cake\bootstrap.php on line 82 Strict Standards: Non-static method Configure::getInstance() should not be called statically in I:\AppServ\www\cake\cake\libs \configure.php on line 108 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\dispatcher.php on line 157 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\dispatcher.php on line 221 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\controller\controller.php on line 308 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\controller\controller.php on line 347 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\controller\controller.php on line 535 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\controller\controller.php on line 805 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\controller\component.php on line 128 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\view\view.php on line 686 Deprecated: Assigning the return value of new by reference is deprecated in I:\AppServ\www\cake\cake\libs\class_registry.php on line 55 Strict Standards: Non-static method Inflector::camelize() should not be called statically, assuming $this from incompatible context in I: \AppServ\www\cake\cake\dispatcher.php on line 89 Strict Standards: Non-static method Configure::getInstance() should not be called statically in I:\AppServ\www\cake\cake\basics.php on line 276 Strict Standards: Non-static method Inflector::underscore() should not be called statically in I:\AppServ\www\cake\cake\basics.php on line 290 Strict Standards: Non-static method Inflector::underscore() should not be called statically, assuming $this from incompatible context in I: \AppServ\www\cake\cake\libs\controller\controller.php on line 243 Strict Standards: Non-static method Inflector::classify() should not be called statically, assuming $this from incompatible context in I: \AppServ\www\cake\cake\libs\controller\controller.php on line 246 Strict Standards: Non-static method Inflector::camelize() should not be called statically, assuming $this from incompatible context in I: \AppServ\www\cake\cake\libs\inflector.php on line 397 Strict Standards: Non-static method Infl
Re: Custom tags no longer working in 1.2 Beta...has something changed?
This is what I have: app/app_helper.php : loadConfig(); } } ?> app/config/tags.php : '%s', 'blockstart' => '', 'blockend' => '' ) ?> On May 11, 7:37 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > try in your helper > > function __construct(){ > parent::__construct(); > $this->loadConfig(); > } > > that displays what I have in the $tags array of config/tags.php > > and to load $this->loadConfig('mytags'); you'd have a file named > core/mytags.php > > and the array in $tags = Array( > > ) > > hth - S > > 2008/5/11 Action <[EMAIL PROTECTED]>: > > > > > That is exactly what I am doing and what I've always done. The problem > > is that it no longer works. > > > On May 11, 6:33 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > > > In 1.2 to load the custom tags you can create your own AppHelper class > > in > > > app/app_helper.php. > > > > > > class AppHelper extends Helper { > > > > function __construct(){ > > > $this->loadConfig(); > > > parent::__construct(); > > > }} > > > > ?> > > > >https://trac.cakephp.org/ticket/2081 > > > > - S > > > > 2008/5/11 Marcin Domanski <[EMAIL PROTECTED]>: > > > > > It changed - look at $this->tags in helper(s) > > > > > On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED]> > > wrote: > > > > > > I built an app using 1.2 pre-beta that uses a tags.php in > > app/config > > > > > called from app/app_helper.php that sets custom html tags for > > certain > > > > > helper-generated markup. > > > > > > In 1.2 Beta, it no longer works. It simply isn't applying my custom > > > > > tags. Has this changed from pre-beta to beta...or is it simply > > broken > > > > > now? > > > > > -- > > > > Marcin Domanski > > > >http://kabturek.info --~--~-~--~~~---~--~~ 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: Three-level hasMany in view with form helper
Having the exact same issue here - looks like Cake simply doesn't support hasMany past one level with the dot notation. On Apr 18, 8:41 am, Max Romantschuk <[EMAIL PROTECTED]> wrote: > I'm working on a form for a three-levelhasManyrelationship. > Conceptually: BookhasManyChapterhasManyParagraph. (Model names for > illustrative purposes.) > > I'm using the form helper to render my form. The main parent model > (Book) stuff works fine, and I can do the Chapters by supplying > "Chapter.0.field", "Chapter.1.field" etc. to the form helper. The > fields are populated nicely, and the inputs are named data[Chapter][0] > [field], data[Chapter][1][field] etc. > > However, when I try giving the form helper the next level with > "Chapter.0.Paragraph.0.field" that won't work and Cake falls back to > the parent Book model, naming the input data[Book] and breaking the > form. I'm sure I could get the data to populate with "Paragraph. > 0.field", but then I'd have no clue which paragraph goes in which > Chapter after the form is submitted. > > Has anyone gotten Cake to populate a three-levelhasManyrelationship > like this? Doing the third level manually is pretty trivial in this > case, it's only two fields of data, so maybe I should just do that? --~--~-~--~~~---~--~~ 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 tags no longer working in 1.2 Beta...has something changed?
try in your helper function __construct(){ parent::__construct(); $this->loadConfig(); } that displays what I have in the $tags array of config/tags.php and to load $this->loadConfig('mytags'); you'd have a file named core/mytags.php and the array in $tags = Array( ) hth - S 2008/5/11 Action <[EMAIL PROTECTED]>: > > That is exactly what I am doing and what I've always done. The problem > is that it no longer works. > > On May 11, 6:33 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > > In 1.2 to load the custom tags you can create your own AppHelper class > in > > app/app_helper.php. > > > > > class AppHelper extends Helper { > > > > function __construct(){ > > $this->loadConfig(); > > parent::__construct(); > > }} > > > > ?> > > > > https://trac.cakephp.org/ticket/2081 > > > > - S > > > > 2008/5/11 Marcin Domanski <[EMAIL PROTECTED]>: > > > > > > > > > It changed - look at $this->tags in helper(s) > > > > > On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED]> > wrote: > > > > > > I built an app using 1.2 pre-beta that uses a tags.php in > app/config > > > > called from app/app_helper.php that sets custom html tags for > certain > > > > helper-generated markup. > > > > > > In 1.2 Beta, it no longer works. It simply isn't applying my custom > > > > tags. Has this changed from pre-beta to beta...or is it simply > broken > > > > now? > > > > > -- > > > Marcin Domanski > > >http://kabturek.info > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Query Question
I want to make a side nave bar with states and cities of that state as sub items. How would I write a query to do this? I want something like: Florida _Orlando _Daytona Ohio _Columbus _New Albany etc... Thanks as always for the help. --~--~-~--~~~---~--~~ 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 tags no longer working in 1.2 Beta...has something changed?
That is exactly what I am doing and what I've always done. The problem is that it no longer works. On May 11, 6:33 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > In 1.2 to load the custom tags you can create your own AppHelper class in > app/app_helper.php. > > class AppHelper extends Helper { > > function __construct(){ > $this->loadConfig(); > parent::__construct(); > }} > > ?> > > https://trac.cakephp.org/ticket/2081 > > - S > > 2008/5/11 Marcin Domanski <[EMAIL PROTECTED]>: > > > > > It changed - look at $this->tags in helper(s) > > > On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED]> wrote: > > > > I built an app using 1.2 pre-beta that uses a tags.php in app/config > > > called from app/app_helper.php that sets custom html tags for certain > > > helper-generated markup. > > > > In 1.2 Beta, it no longer works. It simply isn't applying my custom > > > tags. Has this changed from pre-beta to beta...or is it simply broken > > > now? > > > -- > > Marcin Domanski > >http://kabturek.info --~--~-~--~~~---~--~~ 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 tags no longer working in 1.2 Beta...has something changed?
In 1.2 to load the custom tags you can create your own AppHelper class in app/app_helper.php. loadConfig(); parent::__construct(); } } ?> https://trac.cakephp.org/ticket/2081 - S 2008/5/11 Marcin Domanski <[EMAIL PROTECTED]>: > > It changed - look at $this->tags in helper(s) > > On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED]> wrote: > > > > I built an app using 1.2 pre-beta that uses a tags.php in app/config > > called from app/app_helper.php that sets custom html tags for certain > > helper-generated markup. > > > > In 1.2 Beta, it no longer works. It simply isn't applying my custom > > tags. Has this changed from pre-beta to beta...or is it simply broken > > now? > > > > > > > > > -- > Marcin Domanski > http://kabturek.info > > > > --~--~-~--~~~---~--~~ 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 tags no longer working in 1.2 Beta...has something changed?
It changed - look at $this->tags in helper(s) On Sun, May 11, 2008 at 10:10 PM, Action <[EMAIL PROTECTED]> wrote: > > I built an app using 1.2 pre-beta that uses a tags.php in app/config > called from app/app_helper.php that sets custom html tags for certain > helper-generated markup. > > In 1.2 Beta, it no longer works. It simply isn't applying my custom > tags. Has this changed from pre-beta to beta...or is it simply broken > now? > > > -- Marcin Domanski http://kabturek.info --~--~-~--~~~---~--~~ 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: Setting up Cake as an Intranet framework?
There is going to be a hardcore test environment before anything goes live, so hopefully when updating libraries nothing would go wrong. Plus one cake dir per application would still require layouts and common components to be copied into each one, creating it's own maintenance nightmare, no? On 11 May, 08:57, woldhekkie <[EMAIL PROTECTED]> wrote: > I would take a cake dir per application and not share anything > amoungst them. > If you would update cake, and something is wrong, all your apps go > wrong. > > On 11 mei, 00:32, Dave <[EMAIL PROTECTED]> wrote: > > > Hi All, > > > I've been thinking about using Cake as a framwork for the company > > intranet, but am coming unstuck as how to share the libraries and > > structure things. > > > The Intranet is made up of two parts, a portal like homepage, and a > > potentially infinite number of applications running in it, each in > > their own directory URL, for example:http://intranet.company.com/ for the > > portalhttp://intranet.company.com/sales/http://intranet.company.com/humanre... > > > All these "packages" would need to share the Cake Libs, but also CSS, > > JS, Components, Vendors, Layouts and Elements. Each "package" would > > have it's own Models/Controllers/Views, so the following would be > > viable: > > >http://intranet.company.com/sales/lead/view/12345/ using a "lead" > > controller, "view" action with the parameter 12345. > > > I have already tried setting this up with SymLinks but ended up in a > > bit of a mess, by having the "packages" stored in their standard cake > > layout, then running a PHP script that would symlink to the correct > > places, with a common package trying to put files into all the > > packages. I'm hoping there is a simpler way of doing this! (I'm happy > > to use 1.2beta if needs require) > > > I tried the following with the webroot actually being the webroot > > folder: > > > app > > | -- apps > > | | ---| -| > > | sales finance homepage > > | > > | --- webroot > > | | > > | homepage > > | || > > | sales finance > > | > > cakelibs > > | > > vendors > > > but trying to place common layouts and css and such in all these > > "packages" was becoming cumbersome. > > > Any ideas as to how I could solve this? > > > Many Thanks, > > 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 -~--~~~~--~~--~--~---
Custom tags no longer working in 1.2 Beta...has something changed?
I built an app using 1.2 pre-beta that uses a tags.php in app/config called from app/app_helper.php that sets custom html tags for certain helper-generated markup. In 1.2 Beta, it no longer works. It simply isn't applying my custom tags. Has this changed from pre-beta to beta...or is it simply broken now? --~--~-~--~~~---~--~~ 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: Setting up Cake as an Intranet framework?
You could store the specific models and controllers in a subfolder like so: app __controllers sales finance __models sales finance Cake will find controllers automaticly, but I thought this doesn't on views like this On 11 mei, 00:32, Dave <[EMAIL PROTECTED]> wrote: > Hi All, > > I've been thinking about using Cake as a framwork for the company > intranet, but am coming unstuck as how to share the libraries and > structure things. > > The Intranet is made up of two parts, a portal like homepage, and a > potentially infinite number of applications running in it, each in > their own directory URL, for example:http://intranet.company.com/ for the > portalhttp://intranet.company.com/sales/http://intranet.company.com/humanresources/http://intranet.company.com/finance/ > > All these "packages" would need to share the Cake Libs, but also CSS, > JS, Components, Vendors, Layouts and Elements. Each "package" would > have it's own Models/Controllers/Views, so the following would be > viable: > > http://intranet.company.com/sales/lead/view/12345/ using a "lead" > controller, "view" action with the parameter 12345. > > I have already tried setting this up with SymLinks but ended up in a > bit of a mess, by having the "packages" stored in their standard cake > layout, then running a PHP script that would symlink to the correct > places, with a common package trying to put files into all the > packages. I'm hoping there is a simpler way of doing this! (I'm happy > to use 1.2beta if needs require) > > I tried the following with the webroot actually being the webroot > folder: > > app > | -- apps > | | ---| -| > | sales finance homepage > | > | --- webroot > | | > | homepage > | || > | sales finance > | > cakelibs > | > vendors > > but trying to place common layouts and css and such in all these > "packages" was becoming cumbersome. > > Any ideas as to how I could solve this? > > Many Thanks, > 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: forced download
Thank you Traique and jonknee for the reply. But as i'm using session, it doesn't allow me to send header info later. On May 7, 5:32 pm, jonknee <[EMAIL PROTECTED]> wrote: > > hi! i'm developing an application where the user uploads and downloads > > file. But during downloads, the files like jpegs, txt, those openable > > in the browser open in the browser itself. but i need them to come out > > as pop-ups or dialouge box with "save as" or a download manager/ > > accelerator software to assist in download. how can this be done? > > thanks for the help! > > You need to send a content-disposition header. Example in PHP: > > > > The header() docs have more information:http://us.php.net/header --~--~-~--~~~---~--~~ 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 command line
Hello Adam, i want to do that thing in background, so the actual command is like: exec ('php c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action > /dev/null &'); I want this so that the script keeps on executing and is not stopped by controller action. I dont think that wget or curl would solve the purpose? Thanks. On Sun, May 11, 2008 at 5:20 PM, Adam Royle <[EMAIL PROTECTED]> wrote: > > If you just want to trigger a cake action from the commandline, use > wget or curl to request your full URL. Much easier, don't need to hack > anything. > > On May 11, 4:55 am, "Novice Programmer" <[EMAIL PROTECTED]> > wrote: > > Hi Chris, > > > > yeah the problem was in my code and i got that fixed. but now i am facing > > another problem. I have changed my webroot/index.php to handle command > line > > jobs as follows: > > > > if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { > > } > > *else if(php_sapi_name() === "cli") > > { > > // this is a command line call - dispatch it with the argument > > define('CRON_DISPATCHER',true); > > $Dispatcher=new Dispatcher(); > > $Dispatcher->dispatch($argv[1]); > > } > > * else { > > $Dispatcher = new Dispatcher(); > > $Dispatcher->dispatch($url); > > } > > now when i execute php from command line as : php > > c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action, it works > > well but when i pass this to exec function like: > > exec ('php c:/www/webroot/Cake/app/webroot/index.php > /mycontroller/action'); > > > > it gives me an error saying : > > > > Cannot redeclare class cakesession in > > c:\www\webroot\Cake\cake\libs\session.php on line 789 > > > > Any idea on what this can be? > > > > Thanks. > > > > > > > > On Sat, May 10, 2008 at 6:49 PM, Chris Hartjes <[EMAIL PROTECTED]> > wrote: > > > > > On Fri, May 9, 2008 at 4:54 PM, Novice Programmer > > > <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > > > I used to run php CLI thro exec function passing it the required php > > > file. I > > > > know want to port this code to Cake PHP semantics but the problem i > am > > > > facing is that Cake has got seprate ways to execute on linux and on > > > windows. > > > > on *nix it must be ./cake(as m on a shared host) console applicaiton > and > > > on > > > > windows it should be cake.bat. I am developing on windows system and > > > > deploying on linux system. How do i work around this problem? > > > > > What is it that you're trying to do that you think you need to use the > > > Cake console for? > > > > > It has also been my experience that as long as you put the Cake > > > console script in your path, and the PHP executable in your path, it > > > does not matter if you're on Linux or Windows. > > > > > -- > > > Chris Hartjes > > > Internet Loudmouth > > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard > > > > -- > > Thanks & Regards, > > Novice (http://ishuonweb.wordpress.com/). > > > -- Thanks & Regards, Novice (http://ishuonweb.wordpress.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: Auth Problems
On Sun, May 11, 2008 at 11:38 AM, Greg <[EMAIL PROTECTED]> wrote: > > Hi, thanks for taking the time to reply. I tried to add your example > to my Account controller but that did not work. I had an existing Auth- >>allow array that was: > > $this->Auth->allow('login', 'index') > > I was trying different possibilities. In the end I removed it > completely and now it's working ok! I saw another post that mentioned > having 'login' in the allowed array could cause problems. Perhaps that > was the issue. Yeah, you don't need to put 'login' in $this->Auth->allow(...) as Auth handles that automatically. -- 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 "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: 1.2 auth from cookbok only able to work if Security.salt set to empty ...
Just to clarify for anyone else coming across this, the salt should be prepended to the password, not appended. On Sun, May 11, 2008 at 12:08 PM, Andras Kende <[EMAIL PROTECTED]> wrote: > > > Thank you, this worked beautifully: > > .. SET `password` = SHA1( 'SALTSTRINGpasswordstring' ) .. > > > > > > Andras Kende > > http://www.kende.com > > > > > On May 11, 11:11 am, aranworld <[EMAIL PROTECTED]> wrote: > > Maybe you didn't use the salt when setting the password value in the > > database? > > > > You have to do something like this: > > > > INSERT INTO `users` SET `password` = > > sha1( 'passwordstringSALTSTRING') > > > > On May 11, 12:10 am, Andras Kende <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello, > > > > > I was able to add 1.2 auth from the cookbook > (http://book.cakephp.org/view/172/authentication) > > > to my testapp but somehow only works for me if core.php : > > > Configure::write('Security.salt', ''); is set to empty... > > > > > What I'm missing here? > > > > > users table (sha1 pass) > > > username | password > > > testuser | 94cd166631d14dab533858b9b47e9584a2ff3f65 > > > > > app_controller.php : > > > > > class AppController extends Controller { > > > var $components = array('Auth');} > > > > > ?> > > > > > Thank you, > > > > > Andras Kende > > > > >http://www.kende.com/- Hide quoted text - > > > > - Show quoted text - > > > > > > --~--~-~--~~~---~--~~ 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: 1.2 auth from cookbok only able to work if Security.salt set to empty ...
Thank you, this worked beautifully: .. SET `password` = SHA1( 'SALTSTRINGpasswordstring' ) .. Andras Kende http://www.kende.com On May 11, 11:11 am, aranworld <[EMAIL PROTECTED]> wrote: > Maybe you didn't use the salt when setting the password value in the > database? > > You have to do something like this: > > INSERT INTO `users` SET `password` = > sha1( 'passwordstringSALTSTRING') > > On May 11, 12:10 am, Andras Kende <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I was able to add 1.2 auth from the cookbook > > (http://book.cakephp.org/view/172/authentication) > > to my testapp but somehow only works for me if core.php : > > Configure::write('Security.salt', ''); is set to empty... > > > What I'm missing here? > > > users table (sha1 pass) > > username | password > > testuser | 94cd166631d14dab533858b9b47e9584a2ff3f65 > > > app_controller.php : > > > class AppController extends Controller { > > var $components = array('Auth');} > > > ?> > > > Thank you, > > > Andras Kende > > >http://www.kende.com/- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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 phpshield or other obfuscator tool to encode config/database.php
I used ioncube encoder online version with success, just paid few $0.10 per files.. http://www.ioncube.com/online_encoder.php Andras Kende http://www.kende.com -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kupe3 Sent: Sunday, May 11, 2008 9:25 AM To: CakePHP Subject: using phpshield or other obfuscator tool to encode config/database.php I need to deploy the application on clients hossting account, but i dont want them to see DB config file (config/database.php) for security reason. I wonder is someone has tried to encode cake php application before and can help me with this. Thanks in advance --~--~-~--~~~---~--~~ 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: Setting up Cake as an Intranet framework?
On Sun, May 11, 2008 at 3:57 AM, woldhekkie <[EMAIL PROTECTED]> wrote: > > I would take a cake dir per application and not share anything > amoungst them. > If you would update cake, and something is wrong, all your apps go > wrong. I think the opposite would be a maintenance nightmare. If an update were to cause breakage across all apps, it would simply be that much more quick to be discovered. Backing out of an update should be straightforward. I'd think, too, that the more stuff that a bug affects, the easier it would be to resolve (at least, the more obvious it'd be as to *what* the problem is). --~--~-~--~~~---~--~~ 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 Rocks my socks!
On Sun, May 11, 2008 at 7:56 AM, (withheld)@gmail.com <[EMAIL PROTECTED]> wrote: > > I know this mailing list must receive a modest amount of praise for > such a wonderful framework. I don't know a lot about PHP but CakePHP > makes it easy, just set up the database and bake away. > > I recently ran into a problem in one of the cake apps I'm building. It > is not due to CakePHP. > > One of my database tables is called "eagles" and eagles belongs to a > tournament, now there will be around 20 entries for eagles per > tournament, at first I thought "no problem, use hasMany" but due to > complexity ended up just making the table as follows: > > id > created > modified > name1 > hole1 > ... > name20 > hole20 > > I know this is wrong but it works! I can use a simple hasOne > relationship hehe. That may work for now but is not a very robust schema. You should read up on database normalization. You'll be happy you did so. > the main thing i had a problem with was pulling up the last 20 records > of $tournament_id and then in the view printing it out. I was trying > to use this find statment find('all',array('limit' => '20', 'order' => > 'id DESC') but php was just giving me a nice white screen. wierd thing > is I can just use find('first', array('order' => 'id DESC') no problem You should check your error log, it might hold a clue. It's possible that your associations are causing Cake to select too much (or too many times) and is running out of memory. --~--~-~--~~~---~--~~ 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: hasAndBelongsToMany and belongsTo on same model
That works great. Much obliged. On Sun, May 11, 2008 at 4:41 AM, David Christopher Zentgraf <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a similar setup, where a user has many Accounts, but also has a > default account. > My model looks like this: > > class User extends AppModel { > > var $name = 'User'; > > var $belongsTo = array( > 'DefaultAccount' => array( > 'className' => 'Account', > 'foreignKey'=> 'default_account_id' > ) > ); > > var $hasMany = array( > 'Account' => array( > 'className' => 'Account', > 'foreignKey'=> 'user_id', > 'dependent' => true > ) > ); > } > > > I have the same again in Groups, with each group having an Admin user > but also many users: > > class Group extends AppModel { > > var $name = 'Group'; > > var $belongsTo = array( > 'Admin' => array( > 'className' => 'User', > 'foreignKey'=> 'admin_id' > ) > ); > > var $hasAndBelongsToMany = array( > 'User' => array( > 'className' => 'User', > 'joinTable' => 'groups_users', > 'foreignKey'=> 'group_id', > 'associationForeignKey' => 'user_id', > 'unique'=> true > ) > ); > } > > Works perfectly fine for me. > > Hope that helps somewhat... > Chrs, > Dav > > > > On 11 May 2008, at 06:59, b logica wrote: > > > > > I have a model, Artist, that HABTM Discipline (eg. Visual Arts, > > Theatre, etc.) The client has decided that they want each artist to > > have a "primary" discipline. I've changed the model, then, to have one > > Discipline in belongsTo and added a discipline_id column to the DB. So > > far, so sort of good. However, updates on the model are not going so > > well because the HABTM array will always include the primary. I have > > some ideas for dealing with this but thought I'd see if anyone has run > > into this before. > > > > Here's what I have: > > > > Artist > > > > var $belongsTo = array('Discipline'); > > var $hasAndBelongsToMany = array( > > 'Discipline' => array( > > 'with' => 'ArtistsDiscipline', > > 'className' => 'Discipline', > > 'joinTable' => 'artists_disciplines', > > 'foreignKey' => 'artist_id', > > 'associationForeignKey' => 'discipline_id', > > 'unique' => true > > ) > > ); > > > > Initially, the Artist looks something like this: > > > > Array > > ( > >[Artist] => Array > > ( > > [id] => 1 > > [created] => 2008-05-10 17:02:56.155567 > > [modified] => 2008-05-10 17:02:56.155567 > > [discipline_id] => 2 > > // other stuff ... > > ) > >[Discipline] => Array > > ( > > [id] => 2 > > [name_en] => Visual Arts > > [name_fr] => Arts Visuels > > [name_es] => Artes Visuales > > [0] => Array > > ( > > [id] => 3 > > [name_en] => Film / Television > > [name_fr] => Cinéma / Télévision > > [name_es] => Cine / Televisión > > ) > > [1] => Array > > ( > > [id] => 9 > > [name_en] => Theatre > > [name_fr] => Théâtre > > [name_es] => Teatro > > ) > > ) > > ) > > > > Already, the Discipine array looks like it needs some fixing. I figure > > I could do something in afterFind() here. > > > > The edit.ctp has: > > > > $form->label('Artist.discipline_id', __('* Primary Artistic > > Discipline', true), array('class' => 'Required')) > > > > $form->error('Artist.discipline_id', __('Please select a primary > > discipline', true)) ?> > > $form->select('Artist.discipline_id', $disciplines, null, array(), > > true) > > > > $form->label('Discipline.Discipline', __('Other Disciplines', true)) > > $habtm->checkboxMultiple('Discipline.Discipline', $disciplines, null, > > array('class' => 'Required', 'multiple' => 'checkbox')) > > > > > > No surprises, the "Visual Arts" checkbox will be checked. After an > > update, the Discipline array looks like: > > > > [Discipline] => Array > > ( > >
Re: Auth Problems
Hi, thanks for taking the time to reply. I tried to add your example to my Account controller but that did not work. I had an existing Auth- >allow array that was: $this->Auth->allow('login', 'index') I was trying different possibilities. In the end I removed it completely and now it's working ok! I saw another post that mentioned having 'login' in the allowed array could cause problems. Perhaps that was the issue. Cheers --~--~-~--~~~---~--~~ 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: Auth Problems
In my 'Users' controller I do this: beforeFilter() { $this->Auth->allow(array('logout') ); parent::beforeFilter(); } function login() {} function logout() { $this->Auth->logout(); $this->flash("You are now logged out of the site.", '/' ); } I don't know if this is "correct", but it works. -Aran On May 10, 2:07 pm, Greg <[EMAIL PROTECTED]> wrote: > Hi, I'm having several, probably related, problems with the Auth > class. First of all, I'm a Cake noob but I've been searching for > answers and have finally resorted to posting. > > My app requires authentication before access to any controller/action. > On my shared server I can't use 'users' or 'admin' URI segments > because they are used for hosting account management. Therefore in > app_controller I have created an 'Account' model for Auth. My > app_controller looks like this: > > [code] > class AppController extends Controller { > > var $components = array('Auth'); > > function beforeFilter() { > $this->Auth->userModel = 'Account'; > $this->Auth->loginAction = array('controller' => 'accounts', > 'action' => 'login'); > $this->Auth->logoutRedirect = array('controller' => > 'accounts', > 'action' => 'login'); > } > > } > > ?> > [/code] > > I have the login and logout functions from the manual in my accounts > controller. On trying to access any page I get redirected to /accounts/ > login, which is what I expect to happen. However, if I try to logout, > say at /accounts/logout, then instead of being redirected to /accounts/ > login I'm being redirected to /users/logout, which of course causes a > 404. I suspect I may not fully understand how Auth is supposed to work > but what have I done wrong here? > > Cheers --~--~-~--~~~---~--~~ 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: 1.2 auth from cookbok only able to work if Security.salt set to empty ...
Maybe you didn't use the salt when setting the password value in the database? You have to do something like this: INSERT INTO `users` SET `password` = sha1( 'passwordstringSALTSTRING') On May 11, 12:10 am, Andras Kende <[EMAIL PROTECTED]> wrote: > Hello, > > I was able to add 1.2 auth from the cookbook > (http://book.cakephp.org/view/172/authentication) > to my testapp but somehow only works for me if core.php : > Configure::write('Security.salt', ''); is set to empty... > > What I'm missing here? > > users table (sha1 pass) > username | password > testuser | 94cd166631d14dab533858b9b47e9584a2ff3f65 > > app_controller.php : > class AppController extends Controller { > var $components = array('Auth');} > > ?> > > Thank you, > > Andras Kende > > http://www.kende.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 -~--~~~~--~~--~--~---
CakePHP Rocks my socks!
I know this mailing list must receive a modest amount of praise for such a wonderful framework. I don't know a lot about PHP but CakePHP makes it easy, just set up the database and bake away. I recently ran into a problem in one of the cake apps I'm building. It is not due to CakePHP. One of my database tables is called "eagles" and eagles belongs to a tournament, now there will be around 20 entries for eagles per tournament, at first I thought "no problem, use hasMany" but due to complexity ended up just making the table as follows: id created modified name1 hole1 ... name20 hole20 I know this is wrong but it works! I can use a simple hasOne relationship hehe. the main thing i had a problem with was pulling up the last 20 records of $tournament_id and then in the view printing it out. I was trying to use this find statment find('all',array('limit' => '20', 'order' => 'id DESC') but php was just giving me a nice white screen. wierd thing is I can just use find('first', array('order' => 'id DESC') no problem --~--~-~--~~~---~--~~ 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: Setting up Cake as an Intranet framework?
I would take a cake dir per application and not share anything amoungst them. If you would update cake, and something is wrong, all your apps go wrong. On 11 mei, 00:32, Dave <[EMAIL PROTECTED]> wrote: > Hi All, > > I've been thinking about using Cake as a framwork for the company > intranet, but am coming unstuck as how to share the libraries and > structure things. > > The Intranet is made up of two parts, a portal like homepage, and a > potentially infinite number of applications running in it, each in > their own directory URL, for example:http://intranet.company.com/ for the > portalhttp://intranet.company.com/sales/http://intranet.company.com/humanresources/http://intranet.company.com/finance/ > > All these "packages" would need to share the Cake Libs, but also CSS, > JS, Components, Vendors, Layouts and Elements. Each "package" would > have it's own Models/Controllers/Views, so the following would be > viable: > > http://intranet.company.com/sales/lead/view/12345/ using a "lead" > controller, "view" action with the parameter 12345. > > I have already tried setting this up with SymLinks but ended up in a > bit of a mess, by having the "packages" stored in their standard cake > layout, then running a PHP script that would symlink to the correct > places, with a common package trying to put files into all the > packages. I'm hoping there is a simpler way of doing this! (I'm happy > to use 1.2beta if needs require) > > I tried the following with the webroot actually being the webroot > folder: > > app > | -- apps > | | ---| -| > | sales finance homepage > | > | --- webroot > | | > | homepage > | || > | sales finance > | > cakelibs > | > vendors > > but trying to place common layouts and css and such in all these > "packages" was becoming cumbersome. > > Any ideas as to how I could solve this? > > Many Thanks, > 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: Setting up Cake as an Intranet framework?
That looks great! Thanks! :) On 11 May, 09:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > It looks like you could get the job done using plugins. > They were designed to do pretty much what you want. They are their own > little apps inside the app but they share all the layouts, css images > and things from the main application. You can use global things like > authentication from the main app. > > /Martin > > On May 11, 12:32 am, Dave <[EMAIL PROTECTED]> wrote: > > > Hi All, > > > I've been thinking about using Cake as a framwork for the company > > intranet, but am coming unstuck as how to share the libraries and > > structure things. > > > The Intranet is made up of two parts, a portal like homepage, and a > > potentially infinite number of applications running in it, each in > > their own directory URL, for example:http://intranet.company.com/ for the > > portalhttp://intranet.company.com/sales/http://intranet.company.com/humanre... > > > All these "packages" would need to share the Cake Libs, but also CSS, > > JS, Components, Vendors, Layouts and Elements. Each "package" would > > have it's own Models/Controllers/Views, so the following would be > > viable: > > >http://intranet.company.com/sales/lead/view/12345/ using a "lead" > > controller, "view" action with the parameter 12345. > > > I have already tried setting this up with SymLinks but ended up in a > > bit of a mess, by having the "packages" stored in their standard cake > > layout, then running a PHP script that would symlink to the correct > > places, with a common package trying to put files into all the > > packages. I'm hoping there is a simpler way of doing this! (I'm happy > > to use 1.2beta if needs require) > > > I tried the following with the webroot actually being the webroot > > folder: > > > app > > | -- apps > > | | ---| -| > > | sales finance homepage > > | > > | --- webroot > > | | > > | homepage > > | || > > | sales finance > > | > > cakelibs > > | > > vendors > > > but trying to place common layouts and css and such in all these > > "packages" was becoming cumbersome. > > > Any ideas as to how I could solve this? > > > Many Thanks, > > 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 -~--~~~~--~~--~--~---
habtm count() query
Users want to plan routes to ride together on a a motor bike. tables: users (id, name,phone,email) routes (id,date,time,startplace,info,user_id) (user_id is user who planned the route) routes_users (id,route_id,user_id) (extra table for which user goes on which route with habtm) Having HABTM working, i see the following route view: Routes: Date Time Startplace infoOwner Totalusers 10-10-200909:00Amsterdam Nice route round Amsterdam woldhekkie How to get the count() of Totalusers per route. Do i have to do it from the controller (conditions) or from the model (finderquery,conditions) or best to do it in PHP array ? Thanks in advance --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
1.2 auth from cookbok only able to work if Security.salt set to empty ...
Hello, I was able to add 1.2 auth from the cookbook ( http://book.cakephp.org/view/172/authentication ) to my testapp but somehow only works for me if core.php : Configure::write('Security.salt', ''); is set to empty... What I'm missing here? users table (sha1 pass) username | password testuser | 94cd166631d14dab533858b9b47e9584a2ff3f65 app_controller.php : Thank you, Andras Kende http://www.kende.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: Paginate custom SQL queries
Here's an explanation of how I did custom pagination. In app/config/bootstrap.php I include a global functions file which is located in app/webroot/includes/ if (file_exists("includes/global_functions.php")) require_once("includes/global_functions.php"); In this file are my pagination functions: http://bin.cakephp.org/view/522546645 I use these functions for all my pagination needs, e.g. paginating a table of texts in my texts/index actions. In texts_controller I have a var to determine the number of records per page: var $perpage = 50; and a function to determine the number of texts: function nrecords() { $res = $this->Text->query("select count(*) as n from texts"); return $res[0][0]['n']; } The index action looks like this. Only four lines of code are needed for the pagination, and they result in a LIMIT clause ($limit) which I attach to my sql query. Also important is that the action receives the requested page number $page. As you can see in the beginning of the code I'm sorting queries on the result of mysql functions, which is why I needed custom queries and pagination to begin with. function index($page = 1, $sort = 'title', $dir = '') { // determine sort order $sortdir = ($dir == 'down') ? "desc" : "asc"; if ($sort == 'year') { $order = "order by ifnull(texts.year,albums.year) {$sortdir}, concat(artists.sort, artists.name) {$sortdir}, texts.title {$sortdir}"; } elseif ($sort == 'artist') { $order = "order by concat(artists.sort, artists.name) {$sortdir}, texts.title {$sortdir}"; } else { $sort = 'title'; // default $order = "order by texts.title {$sortdir}, concat(artists.sort, artists.name) {$sortdir}"; } // paginate $nrecords = $this->nrecords(); // get total number of records $perpage = $this->perpage; // get number of records per page $npages = pag_npages($nrecords, $perpage); // determine number of pages $limit = pag_sqllimit($page, $perpage, $npages); // create the "LIMIT" clause for SQL // query $this->set('texts', $this->Text->query(" select texts.id, texts.title, texts.slug, texts.audio, texts.video, length(texts.text_transl) as transl, length(texts.text_phonetic) as phonetic, artists.id, artists.name, artists.sort, artists.name__AW, artists.slug, ifnull(texts.year,albums.year) as year from texts left join albums on texts.album_id = albums.id left join artists on texts.artist_id = artists.id {$order} {$limit} ")); // pass on the sort and pagination info to the view $this->set('page', $page); $this->set('npages', $npages); $this->set('nrecords', $nrecords); $this->set('sort', $sort); $this->set('dir', $dir); // layout $this->set('no_right_col', true); } Now in my view I add pagination links with: $pag_numbers = pag_numbers($page, $npages, "/tekste/", ($dir) ? "/ {$sort}/{$dir}" : "/{$sort}", 3, true); this returns a full row of page browsing links, e.g. "Previous | 1 | 2 | 3 | 4 | 5 | Next". The source of the pag_numbers() function explains the parameters. I could also use pag_prev() and pag_next() to just have Previous and Next links, but the final true parameter of pag_numbers means the Previous and Next links get added around the page numbers. That's it. You can see this particular paginated table in action at http://www.antwerps.be/teksten . --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
using phpshield or other obfuscator tool to encode config/database.php
I need to deploy the application on clients hossting account, but i dont want them to see DB config file (config/database.php) for security reason. I wonder is someone has tried to encode cake php application before and can help me with this. Thanks in advance --~--~-~--~~~---~--~~ 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 command line
If you just want to trigger a cake action from the commandline, use wget or curl to request your full URL. Much easier, don't need to hack anything. On May 11, 4:55 am, "Novice Programmer" <[EMAIL PROTECTED]> wrote: > Hi Chris, > > yeah the problem was in my code and i got that fixed. but now i am facing > another problem. I have changed my webroot/index.php to handle command line > jobs as follows: > > if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { > } > *else if(php_sapi_name() === "cli") > { > // this is a command line call - dispatch it with the argument > define('CRON_DISPATCHER',true); > $Dispatcher=new Dispatcher(); > $Dispatcher->dispatch($argv[1]); > } > * else { > $Dispatcher = new Dispatcher(); > $Dispatcher->dispatch($url); > } > now when i execute php from command line as : php > c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action, it works > well but when i pass this to exec function like: > exec ('php c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action'); > > it gives me an error saying : > > Cannot redeclare class cakesession in > c:\www\webroot\Cake\cake\libs\session.php on line 789 > > Any idea on what this can be? > > Thanks. > > > > On Sat, May 10, 2008 at 6:49 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > > On Fri, May 9, 2008 at 4:54 PM, Novice Programmer > > <[EMAIL PROTECTED]> wrote: > > > Hello, > > > > I used to run php CLI thro exec function passing it the required php > > file. I > > > know want to port this code to Cake PHP semantics but the problem i am > > > facing is that Cake has got seprate ways to execute on linux and on > > windows. > > > on *nix it must be ./cake(as m on a shared host) console applicaiton and > > on > > > windows it should be cake.bat. I am developing on windows system and > > > deploying on linux system. How do i work around this problem? > > > What is it that you're trying to do that you think you need to use the > > Cake console for? > > > It has also been my experience that as long as you put the Cake > > console script in your path, and the PHP executable in your path, it > > does not matter if you're on Linux or Windows. > > > -- > > Chris Hartjes > > Internet Loudmouth > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard > > -- > Thanks & Regards, > Novice (http://ishuonweb.wordpress.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: Setting up Cake as an Intranet framework?
It looks like you could get the job done using plugins. They were designed to do pretty much what you want. They are their own little apps inside the app but they share all the layouts, css images and things from the main application. You can use global things like authentication from the main app. /Martin On May 11, 12:32 am, Dave <[EMAIL PROTECTED]> wrote: > Hi All, > > I've been thinking about using Cake as a framwork for the company > intranet, but am coming unstuck as how to share the libraries and > structure things. > > The Intranet is made up of two parts, a portal like homepage, and a > potentially infinite number of applications running in it, each in > their own directory URL, for example:http://intranet.company.com/ for the > portalhttp://intranet.company.com/sales/http://intranet.company.com/humanresources/http://intranet.company.com/finance/ > > All these "packages" would need to share the Cake Libs, but also CSS, > JS, Components, Vendors, Layouts and Elements. Each "package" would > have it's own Models/Controllers/Views, so the following would be > viable: > > http://intranet.company.com/sales/lead/view/12345/ using a "lead" > controller, "view" action with the parameter 12345. > > I have already tried setting this up with SymLinks but ended up in a > bit of a mess, by having the "packages" stored in their standard cake > layout, then running a PHP script that would symlink to the correct > places, with a common package trying to put files into all the > packages. I'm hoping there is a simpler way of doing this! (I'm happy > to use 1.2beta if needs require) > > I tried the following with the webroot actually being the webroot > folder: > > app > | -- apps > | | ---| -| > | sales finance homepage > | > | --- webroot > | | > | homepage > | || > | sales finance > | > cakelibs > | > vendors > > but trying to place common layouts and css and such in all these > "packages" was becoming cumbersome. > > Any ideas as to how I could solve this? > > Many Thanks, > 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: hasAndBelongsToMany and belongsTo on same model
Hi, I have a similar setup, where a user has many Accounts, but also has a default account. My model looks like this: class User extends AppModel { var $name = 'User'; var $belongsTo = array( 'DefaultAccount' => array( 'className' => 'Account', 'foreignKey'=> 'default_account_id' ) ); var $hasMany = array( 'Account' => array( 'className' => 'Account', 'foreignKey'=> 'user_id', 'dependent' => true ) ); } I have the same again in Groups, with each group having an Admin user but also many users: class Group extends AppModel { var $name = 'Group'; var $belongsTo = array( 'Admin' => array( 'className' => 'User', 'foreignKey'=> 'admin_id' ) ); var $hasAndBelongsToMany = array( 'User' => array( 'className' => 'User', 'joinTable' => 'groups_users', 'foreignKey'=> 'group_id', 'associationForeignKey' => 'user_id', 'unique'=> true ) ); } Works perfectly fine for me. Hope that helps somewhat... Chrs, Dav On 11 May 2008, at 06:59, b logica wrote: > > I have a model, Artist, that HABTM Discipline (eg. Visual Arts, > Theatre, etc.) The client has decided that they want each artist to > have a "primary" discipline. I've changed the model, then, to have one > Discipline in belongsTo and added a discipline_id column to the DB. So > far, so sort of good. However, updates on the model are not going so > well because the HABTM array will always include the primary. I have > some ideas for dealing with this but thought I'd see if anyone has run > into this before. > > Here's what I have: > > Artist > > var $belongsTo = array('Discipline'); > var $hasAndBelongsToMany = array( > 'Discipline' => array( > 'with' => 'ArtistsDiscipline', > 'className' => 'Discipline', > 'joinTable' => 'artists_disciplines', > 'foreignKey' => 'artist_id', > 'associationForeignKey' => 'discipline_id', > 'unique' => true > ) > ); > > Initially, the Artist looks something like this: > > Array > ( >[Artist] => Array > ( > [id] => 1 > [created] => 2008-05-10 17:02:56.155567 > [modified] => 2008-05-10 17:02:56.155567 > [discipline_id] => 2 > // other stuff ... > ) >[Discipline] => Array > ( > [id] => 2 > [name_en] => Visual Arts > [name_fr] => Arts Visuels > [name_es] => Artes Visuales > [0] => Array > ( > [id] => 3 > [name_en] => Film / Television > [name_fr] => Cinéma / Télévision > [name_es] => Cine / Televisión > ) > [1] => Array > ( > [id] => 9 > [name_en] => Theatre > [name_fr] => Théâtre > [name_es] => Teatro > ) > ) > ) > > Already, the Discipine array looks like it needs some fixing. I figure > I could do something in afterFind() here. > > The edit.ctp has: > > $form->label('Artist.discipline_id', __('* Primary Artistic > Discipline', true), array('class' => 'Required')) > > $form->error('Artist.discipline_id', __('Please select a primary > discipline', true)) ?> > $form->select('Artist.discipline_id', $disciplines, null, array(), > true) > > $form->label('Discipline.Discipline', __('Other Disciplines', true)) > $habtm->checkboxMultiple('Discipline.Discipline', $disciplines, null, > array('class' => 'Required', 'multiple' => 'checkbox')) > > > No surprises, the "Visual Arts" checkbox will be checked. After an > update, the Discipline array looks like: > > [Discipline] => Array > ( > [id] => 2 > [name_en] => Visual Arts > [name_fr] => Arts Visuels > [name_es] => Artes Visuales > [0] => Array > ( > [id] => 2 > [name_en] => Visual Arts > [name_fr] => Arts Visuels > [name_es] => Artes Visuales > ) > [1] => Array > ( > [id] => 3 > [name_en] => Film / Television > [name_fr] => Cinéma / Télévision >
Re: observeField - Ajax
Looks like you forgot to include the Javascript-Helper in your controller: var $helpers = array('Javascript',...) On 10 Mai, 20:33, Tashu <[EMAIL PROTECTED]> wrote: > I'm trying to do ajax for the selects - two droplists, categories and > subcategories. > When I click one of categories, then subcategories should make a > response - via observeField > > I didn't see any errors in the firebug, > > The POST data is - > > data%5BCategory%5D%5Bid%5D=1 > > As you can see - it's returning id > > the response mentioned the error - > > Call to a member function link() on a non-object in /home/peter/ > workspace/SheetCenter > /app/views/layouts/default.ctp on line 8 > > I'm not sure what it does mean. The line 8 consists of - > > echo $javascript->link('prototype'); > > I'm following the tutorial > -http://web.archive.org/web/20070501122029/http://www.devmoz.com/blog/... > > I have been working on this for 2 days, and I didn't see anything > wrong with my code. Perhaps, I'm missing something. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---