Re: Building a forum plug-in
I've seen many projects with a lot of talk at the beginning but nothing concrete was done about it. Perhaps the guys who really need should start something first? And if there are people who want more features, then more will start contributing? Of course documentation must be good ;) On Nov 1, 4:21 am, Zoltan <[EMAIL PROTECTED]> wrote: > I was thinking of putting something simple together and posting it. > Unfortunately, I just don't have time to work on it at the moment, > since I first posted, I found myself getting quite busy on non-Cake > projects. > > Zoltanwww.yyztech.ca > > On Oct 31, 12:14 pm, saltymule <[EMAIL PROTECTED]> wrote: > > > I think it might be cool. > > I've been looking for something like that, and if we need to make it > > for ourselves than we might as well share it. > > How much time would we spend per week on it? > > Also a Dan --~--~-~--~~~---~--~~ 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: Space before layout content - Resolved
Hi Wayne Wayne Fay wrote: >>> similar utility? Essentially, any space in any non-view file (outside >>> of tags) should be identified and eliminated. >> I use Ant for my build process out of Eclipse and have just looked up >> regular expressions in Ant. You could easily use the "ReplaceRegExp" > > Ideally we could cook up a way to check for spaces (and perhaps even > remove them automatically) using Cake itself. It would be like the > bake utility; we could have a "validate" utility. That would be nice! It really depends on what your development process is and what tools you use. For me the logical place to check (and fix) is at build time. If someone doesn't use a build process like Ant, then a script like the build utility could be useful. If you wanted to do it that way, then it would be very simple to construct the appropriate piece of PHP code and trigger it the same way that you do with bake. Regards, Langdon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM findAll with incorrect data
I figured out the problem. I had another belongsTo hiding in my poker controller that was adding the extra data. Thanks for your help again. On Nov 2, 7:05 pm, fallenrayne <[EMAIL PROTECTED]> wrote: > Hi AD7six, > > Thank you for the tip on using pr instead of echo. I had a pretty > good idea of what it was doing (I have to deal with a lot of arrays > and hashmaps at work), but I am still not entirely sure of how to fix > it. I changed my tournament function to look like this: > > function tournament($id) > { > $this->checkSession(); > $this->pageTitle = 'Tournament'; > $this->Poker->id = $id; > $this->set('poker',$this->Poker->read()); > } > > Because I saw it in the blog example but I still received the same > results: > > 1 > Brandon > Skeen > [EMAIL PROTECTED] > password > fallenrayne > 2007-10-18 > 2007-10-18 > 1 > Array ( [id] => 1 [fname] => Brandon [lname] => Skeen [email] => > [EMAIL PROTECTED] [password] => password [username] => fallenrayne > [created] => 2007-10-18 [modified] => 2007-10-18 [type] => 1 ) > Array ( [id] => 2 [fname] => Carrie [lname] => Skeen [email] => > [EMAIL PROTECTED] [password] => password [username] => cskeen [created] > => 2007-10-18 [modified] => 2007-10-18 [type] => 1 ) > > So the first array is being displayed, one element at a time, and then > it goes on and gets the two sets of data that I am expecting. > > BTW, sorry for the long delay on posting. I can't access any of this > stuff while at work so I had to wait to get home and try some of this > out. I really appreciate the help though. > > On Nov 2, 6:07 am, AD7six <[EMAIL PROTECTED]> wrote: > > > On Nov 2, 3:11 am, fallenrayne <[EMAIL PROTECTED]> wrote: > > > > Hello all, > > > > This is my first post here and it is a weird problem that I have been > > > trying to fix for a few days now with no luck. I have a HABTM that is > > > connecting a poker tournament table with a users table so that I can > > > track which users were at the poker tournament. When I run the HABTM > > > I end up getting the first user's data, each field, in a separate > > > element in the array, then I get the users in the array the proper > > > way. Here is my code: > > > > var $hasAndBelongsToMany = array('User' => > > > array('className'=> 'User', > > > 'joinTable'=> 'users_poker', > > > 'foreignKey' => '', > > > 'associationForeignKey'=> '', > > > 'conditions' => '', > > > 'order'=> '', > > > 'limit'=> '', > > > 'unique' => true, > > > 'finderQuery' => '', > > > 'deleteQuery' => '') > > > ); > > > > It is a very basic HABTM so I left most things default. In the > > > tournament method for my poker controller I have: > > > > function tournament($id) > > > { > > > $this->checkSession(); > > > $this->pageTitle = 'Tournament'; > > > $this->set('poker',$this->Poker->findById($id)); > > > } > > > > Then in the tournament view I have: > > > > Tournament > > > > > > > > foreach($poker['User'] as $user): > > > echo $user['username']; > > > echo ""; > > > endforeach; > > > ?> > > > > When it prints out I end up getting something that looks like: > > > > 1 > > > B > > > S > > > d > > > f > > > 2 > > > 1 > > > 1 > > > 7 > > > fallenrayne > > > carrie > > > > Of course only the last 2 rows are actually correct, the rest of the > > > rows are the first character of each field in the row for my username. > > > Try using pr instead of echo and you'll see that the data isn't in the > > form you are expecting. Hint: Find*All*By > > > hth, > > > AD --~--~-~--~~~---~--~~ 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: the superclass
On Nov 2, 9:30 am, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > hi everybody, > i'm new to phpcake organization model and i'm having some problems > integrating some classes. maybe you can give me a hand. > > i need a "visitor" class that will be responsible with tracking a site > 'visitor' (not a user), keep a track and use his settings (like language > and skin preferences) via cookies and similar stuff. the thing with this > is: i don't know if this should be a controller or a component. i would > say it's a controller because it hase it's own models (like log tables, > preferences table, etc), but then, it has no view and must be called > (initialized) on every page before everything else, and be accesible > from any other controller. > > what should i do? i saw a page_controller somewhere and i think i can > use that but i'm not sure how? > > what do you sugest. i'm sure this is a preaty common practice. what do > you use? > > thanks, > Cristian As Jonathan Snook says in his article, you should play with some implementation in the master app_controller (checkings, logs, preferences, etc). In this way, you have the certain that this piece of code is going to be in every controller you call. Martin Bavio --~--~-~--~~~---~--~~ 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: Space before layout content - Resolved
> > similar utility? Essentially, any space in any non-view file (outside > > of tags) should be identified and eliminated. > > I use Ant for my build process out of Eclipse and have just looked up > regular expressions in Ant. You could easily use the "ReplaceRegExp" Ideally we could cook up a way to check for spaces (and perhaps even remove them automatically) using Cake itself. It would be like the bake utility; we could have a "validate" utility. That would be nice! Wayne --~--~-~--~~~---~--~~ 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: xml parsing
Hi Moesian I have recently used simplexml to parse and modifiy some svg image files and (once I got used to it) found it easy to work with. It is fairly limited (as the name implies), but if it has the tools to do the job you need, then I would use it. Regards, Langdon moesian wrote: > Hi, > > I want to parse a few xml feeds and stick their contents into a > database. Whats the best way of doing this using cakephp? > > Can I use simplexml? If I can should I? > > Thanks alot --~--~-~--~~~---~--~~ 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: Space before layout content - Resolved
Hi Wayne > Thanks for following up, Langdon. This is a not-uncommon issue with > PHP, unfortunately. I have always wondered why people make such a big issue over extraneous spaces (I always just check for them when I make the models and controllers). However in this case I accidentally introduced the space when I had Eclipse lock up. So now I know why people despise it so ... I wish there was a simple way to check non-view > PHP files for spaces -- anyone have a working regexp for grep or a > similar utility? Essentially, any space in any non-view file (outside > of tags) should be identified and eliminated. I use Ant for my build process out of Eclipse and have just looked up regular expressions in Ant. You could easily use the "ReplaceRegExp" Ant Task to do exactly what you are suggesting on files in the Controller and Model directories (and any others like config perhaps). I can't tell you the required regular expression off the top of my head, but half an hour and some Googling would sort it. This would give you a fool proof solution to the problem. Regards, Langdon --~--~-~--~~~---~--~~ 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: OthAuth with Cake 1.2.0.5875 pre-beta problems?
I have also been experiencing some issues - I have posted mine this evening to the group as well. Have you seen http://www.ancientwisdom.cc/news/archives/111 which outlines some changes? Might be of some help to you... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
othAuth with Cake 1.2.x.x Nightly Build (5938)
For some reason or another, since upgrading to the latest pre-beta 1.2.x.x I have been experiencing issues with the othAuth component. I have also upgraded to the latest nightly build but it has not made any difference. I followed the instructions in http://www.ancientwisdom.cc/news/archives/111 which sorts out the admin routing issues. The problem I am having is that if I login as an administrator and then perform an admin function (like editing an article) it logs me out when I submit the form. All other restricted functions work fine as long as they are not admin functions. Any ideas? --~--~-~--~~~---~--~~ 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: the superclass
This may or may not help you: http://snook.ca/archives/cakephp/elemental_conditional_content_with_cakephp/ 2007/11/2, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > I get where we're going, but let's try on a real example. Please have > a look at a type of site i usually work at in average (some are least > complicated but few are many times more complicated): http://mapolitique.be/ > > ok, the header menu and footer are easy. > the commercials are doable with elements. > but then i have: the big controller on the left-center, the poll, > newsletter, tags, links, list of active members etc. These are totally > different controllers. On this page they're all the same on all pages, > but on other sites the right side will have to include only some of > them + new others. I don't know how to put them together on the same > page without requestAction. > i would have to be mad to write in the main controller the actions for > all of them. think at the redundancy. > > On Nov 3, 12:43 am, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > > What I would do is use a component only in your main page controller - > > the one that draws the other bits together. > > > > As far as the header and footer stuff goes, that would be best done > > with Elements. > > > > For example: > > > > /app/controllers/components/logger.php > > class LoggerComponent extend Object { > > function startUp(&$controller) { > > // do my logging etc > > $controller->set('headVars',$someStuff_for_header); > > } > > > > } > > > > /app/views/elements/header.ctp > > blah blah blah blah > > > > /app/views/main/index.ctp > > blah... $this->renderElement('header',$headVars); > > blah blah blah blah > > $this->renderElement('footer',$headVars); > > blah > > > > class MainController extends AppController { > > var $components = array('Logger'); > > function index() { > > // get a bunch of stuff. > > } > > > > } > > > > Of course another way would be to get the unrelated stuff into one > > controller (shock horror!). Of course you could use var $use to > > include the additional models, which lets you pull together other > > content. That's not a great thing for performance, but then there's > > always caching. > > > > Simon > > > > On Nov 2, 10:15 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > it's true i don't respect the conventions all the time, because in > > > some cases this can bring significant speed gains (necessary on > > > heavily accessed sites). > > > however, if you're kind enough to share, i would like to know 'the > > > cake way' for this: i have to show on one page different kind of > > > information ( totally unrelated ) - so i think i can't use only one > > > controller (or maybe i'm mistaking), and on top of that, i want > > > something that is called only once at the top of the page to perform > > > several actions (log/set variables etc). > > > > > thanks for your patience, > > > Cristian > > > > > On Nov 2, 11:56 pm, "[EMAIL PROTECTED]" > > > > > <[EMAIL PROTECTED]> wrote: > > > > Sounds like you're not doing it the cake way. > > > > > > If you really really want to do that, your best bet is to use > > > > loadModel. To be honest, what you're doing doesn't really fit the > > > > cake, or MVC model particularly well, so if I were you I would look at > > > > elements as an alternative to all the requestActions. > > > > > > If you stick to Cake's conventions based approach, your best bet is > > > > still to do the work in app_controller, or a component. > > > > > > Simon > > > > > > On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > > > > > If I write that in the startup function of the component it will be > > > > > called for the every controller in a page (which is not good because I > > > > > use 'requestAction' a lot so startup will be called more than once). > > > > > What I was actually thinking is to create my own class and call the > > > > > initialization somewhere in bootstrap, but i don't know how to use a > > > > > model by itself in a custom class. > > > > > > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > > > > > > <[EMAIL PROTECTED]> wrote: > > > > > > What you probably want to do is write a component and handle your > > > > > > logging in the startup function. > > > > > > > > You probably also want to be using the component to inform the > > > > > > controller as to layout / views to use for the skinning. Depending > > > > > > on > > > > > > your controllers, there are all sorts of ways you could do this, > > > > > > ranging from $controller->layout = 'skin' in component startup to a > > > > > > beforeRender filter. > > > > > > > > To get access to the db tables in your component, you'll have to use > > > > > > loadModel to grab instances for the logging and prefs etc. > > > > > > > > Pages controller is something totally different. It is a simple > > > > > > controller to just display views from the /app/views/pages directory > > > > > > without th
building url from parameter array
hi I am trying manipulate the url to provide different link options in the view. Although I can get all the parameters using Router::parser(Router::url("")), I am not sure how can I pass back the parameter array and get a valid url. Below is an example of what I am trying to do Assume that I have a url controller/action/key1:v1/key2:v2/key3:v3 In the view, I want to build two different urls First url - controller/action/key1:v1/key3:v3 Second URL - controller/action/key2:v2/key3:v4 (yes, I want to modify value of key3) Using Router::parser(Router::url("")), I can an array of all parameters, controller, and action. But I couldn't find any method that can take the same kind of array and can give me back a valid url Any help will be appreciated Regards, Ritesh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM findAll with incorrect data
Hi AD7six, Thank you for the tip on using pr instead of echo. I had a pretty good idea of what it was doing (I have to deal with a lot of arrays and hashmaps at work), but I am still not entirely sure of how to fix it. I changed my tournament function to look like this: function tournament($id) { $this->checkSession(); $this->pageTitle = 'Tournament'; $this->Poker->id = $id; $this->set('poker',$this->Poker->read()); } Because I saw it in the blog example but I still received the same results: 1 Brandon Skeen [EMAIL PROTECTED] password fallenrayne 2007-10-18 2007-10-18 1 Array ( [id] => 1 [fname] => Brandon [lname] => Skeen [email] => [EMAIL PROTECTED] [password] => password [username] => fallenrayne [created] => 2007-10-18 [modified] => 2007-10-18 [type] => 1 ) Array ( [id] => 2 [fname] => Carrie [lname] => Skeen [email] => [EMAIL PROTECTED] [password] => password [username] => cskeen [created] => 2007-10-18 [modified] => 2007-10-18 [type] => 1 ) So the first array is being displayed, one element at a time, and then it goes on and gets the two sets of data that I am expecting. BTW, sorry for the long delay on posting. I can't access any of this stuff while at work so I had to wait to get home and try some of this out. I really appreciate the help though. On Nov 2, 6:07 am, AD7six <[EMAIL PROTECTED]> wrote: > On Nov 2, 3:11 am, fallenrayne <[EMAIL PROTECTED]> wrote: > > > > > Hello all, > > > This is my first post here and it is a weird problem that I have been > > trying to fix for a few days now with no luck. I have a HABTM that is > > connecting a poker tournament table with a users table so that I can > > track which users were at the poker tournament. When I run the HABTM > > I end up getting the first user's data, each field, in a separate > > element in the array, then I get the users in the array the proper > > way. Here is my code: > > > var $hasAndBelongsToMany = array('User' => > > array('className'=> 'User', > > 'joinTable'=> 'users_poker', > > 'foreignKey' => '', > > 'associationForeignKey'=> '', > > 'conditions' => '', > > 'order'=> '', > > 'limit'=> '', > > 'unique' => true, > > 'finderQuery' => '', > > 'deleteQuery' => '') > > ); > > > It is a very basic HABTM so I left most things default. In the > > tournament method for my poker controller I have: > > > function tournament($id) > > { > > $this->checkSession(); > > $this->pageTitle = 'Tournament'; > > $this->set('poker',$this->Poker->findById($id)); > > } > > > Then in the tournament view I have: > > > Tournament > > > > > foreach($poker['User'] as $user): > > echo $user['username']; > > echo ""; > > endforeach; > > ?> > > > When it prints out I end up getting something that looks like: > > > 1 > > B > > S > > d > > f > > 2 > > 1 > > 1 > > 7 > > fallenrayne > > carrie > > > Of course only the last 2 rows are actually correct, the rest of the > > rows are the first character of each field in the row for my username. > > Try using pr instead of echo and you'll see that the data isn't in the > form you are expecting. Hint: Find*All*By > > hth, > > AD --~--~-~--~~~---~--~~ 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: the superclass
I get where we're going, but let's try on a real example. Please have a look at a type of site i usually work at in average (some are least complicated but few are many times more complicated): http://mapolitique.be/ ok, the header menu and footer are easy. the commercials are doable with elements. but then i have: the big controller on the left-center, the poll, newsletter, tags, links, list of active members etc. These are totally different controllers. On this page they're all the same on all pages, but on other sites the right side will have to include only some of them + new others. I don't know how to put them together on the same page without requestAction. i would have to be mad to write in the main controller the actions for all of them. think at the redundancy. On Nov 3, 12:43 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > What I would do is use a component only in your main page controller - > the one that draws the other bits together. > > As far as the header and footer stuff goes, that would be best done > with Elements. > > For example: > > /app/controllers/components/logger.php > class LoggerComponent extend Object { > function startUp(&$controller) { > // do my logging etc > $controller->set('headVars',$someStuff_for_header); > } > > } > > /app/views/elements/header.ctp > blah blah blah blah > > /app/views/main/index.ctp > blah... $this->renderElement('header',$headVars); > blah blah blah blah > $this->renderElement('footer',$headVars); > blah > > class MainController extends AppController { > var $components = array('Logger'); > function index() { > // get a bunch of stuff. > } > > } > > Of course another way would be to get the unrelated stuff into one > controller (shock horror!). Of course you could use var $use to > include the additional models, which lets you pull together other > content. That's not a great thing for performance, but then there's > always caching. > > Simon > > On Nov 2, 10:15 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > it's true i don't respect the conventions all the time, because in > > some cases this can bring significant speed gains (necessary on > > heavily accessed sites). > > however, if you're kind enough to share, i would like to know 'the > > cake way' for this: i have to show on one page different kind of > > information ( totally unrelated ) - so i think i can't use only one > > controller (or maybe i'm mistaking), and on top of that, i want > > something that is called only once at the top of the page to perform > > several actions (log/set variables etc). > > > thanks for your patience, > > Cristian > > > On Nov 2, 11:56 pm, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > Sounds like you're not doing it the cake way. > > > > If you really really want to do that, your best bet is to use > > > loadModel. To be honest, what you're doing doesn't really fit the > > > cake, or MVC model particularly well, so if I were you I would look at > > > elements as an alternative to all the requestActions. > > > > If you stick to Cake's conventions based approach, your best bet is > > > still to do the work in app_controller, or a component. > > > > Simon > > > > On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > If I write that in the startup function of the component it will be > > > > called for the every controller in a page (which is not good because I > > > > use 'requestAction' a lot so startup will be called more than once). > > > > What I was actually thinking is to create my own class and call the > > > > initialization somewhere in bootstrap, but i don't know how to use a > > > > model by itself in a custom class. > > > > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > > > > <[EMAIL PROTECTED]> wrote: > > > > > What you probably want to do is write a component and handle your > > > > > logging in the startup function. > > > > > > You probably also want to be using the component to inform the > > > > > controller as to layout / views to use for the skinning. Depending on > > > > > your controllers, there are all sorts of ways you could do this, > > > > > ranging from $controller->layout = 'skin' in component startup to a > > > > > beforeRender filter. > > > > > > To get access to the db tables in your component, you'll have to use > > > > > loadModel to grab instances for the logging and prefs etc. > > > > > > Pages controller is something totally different. It is a simple > > > > > controller to just display views from the /app/views/pages directory > > > > > without the hastle of creating actions. Essentially it is for static > > > > > content. However, it could be informed by your component to change the > > > > > layout (skin) around static content and to log user progress if you > > > > > add your component to AppController in /app/app_controller.php. > > > > > > Hope that helps. > > > > > > Simon > > > > > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> w
OthAuth with Cake 1.2.0.5875 pre-beta problems?
Hi all - has anybody else noticed problems with othAuth breaking down with the latest release of cakephp? With the previous alpha release, things were working hunky dory. When I tried to upgrade to the latest beta version released on the 22nd the system started behaving very funny. Some actions would fail to find a 'User' class. One other behavior that I noticed that when trying to hit the other actions, the page would redirect to different pages and then finally redirect back to the home page. Just wondering Thanks, Rich --~--~-~--~~~---~--~~ 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: the superclass
What I would do is use a component only in your main page controller - the one that draws the other bits together. As far as the header and footer stuff goes, that would be best done with Elements. For example: /app/controllers/components/logger.php class LoggerComponent extend Object { function startUp(&$controller) { // do my logging etc $controller->set('headVars',$someStuff_for_header); } } /app/views/elements/header.ctp blah blah blah blah /app/views/main/index.ctp blah... $this->renderElement('header',$headVars); blah blah blah blah $this->renderElement('footer',$headVars); blah class MainController extends AppController { var $components = array('Logger'); function index() { // get a bunch of stuff. } } Of course another way would be to get the unrelated stuff into one controller (shock horror!). Of course you could use var $use to include the additional models, which lets you pull together other content. That's not a great thing for performance, but then there's always caching. Simon On Nov 2, 10:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > it's true i don't respect the conventions all the time, because in > some cases this can bring significant speed gains (necessary on > heavily accessed sites). > however, if you're kind enough to share, i would like to know 'the > cake way' for this: i have to show on one page different kind of > information ( totally unrelated ) - so i think i can't use only one > controller (or maybe i'm mistaking), and on top of that, i want > something that is called only once at the top of the page to perform > several actions (log/set variables etc). > > thanks for your patience, > Cristian > > On Nov 2, 11:56 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Sounds like you're not doing it the cake way. > > > If you really really want to do that, your best bet is to use > > loadModel. To be honest, what you're doing doesn't really fit the > > cake, or MVC model particularly well, so if I were you I would look at > > elements as an alternative to all the requestActions. > > > If you stick to Cake's conventions based approach, your best bet is > > still to do the work in app_controller, or a component. > > > Simon > > > On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > If I write that in the startup function of the component it will be > > > called for the every controller in a page (which is not good because I > > > use 'requestAction' a lot so startup will be called more than once). > > > What I was actually thinking is to create my own class and call the > > > initialization somewhere in bootstrap, but i don't know how to use a > > > model by itself in a custom class. > > > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > What you probably want to do is write a component and handle your > > > > logging in the startup function. > > > > > You probably also want to be using the component to inform the > > > > controller as to layout / views to use for the skinning. Depending on > > > > your controllers, there are all sorts of ways you could do this, > > > > ranging from $controller->layout = 'skin' in component startup to a > > > > beforeRender filter. > > > > > To get access to the db tables in your component, you'll have to use > > > > loadModel to grab instances for the logging and prefs etc. > > > > > Pages controller is something totally different. It is a simple > > > > controller to just display views from the /app/views/pages directory > > > > without the hastle of creating actions. Essentially it is for static > > > > content. However, it could be informed by your component to change the > > > > layout (skin) around static content and to log user progress if you > > > > add your component to AppController in /app/app_controller.php. > > > > > Hope that helps. > > > > > Simon > > > > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > > > > > > hi everybody, > > > > > i'm new to phpcake organization model and i'm having some problems > > > > > integrating some classes. maybe you can give me a hand. > > > > > > i need a "visitor" class that will be responsible with tracking a site > > > > > 'visitor' (not a user), keep a track and use his settings (like > > > > > language > > > > > and skin preferences) via cookies and similar stuff. the thing with > > > > > this > > > > > is: i don't know if this should be a controller or a component. i > > > > > would > > > > > say it's a controller because it hase it's own models (like log > > > > > tables, > > > > > preferences table, etc), but then, it has no view and must be called > > > > > (initialized) on every page before everything else, and be accesible > > > > > from any other controller. > > > > > > what should i do? i saw a page_controller somewhere and i think i can > > > > > use that but i'm not sure how? > > > > > > what do you sugest. i'm sure this is a preaty common practice. wh
Re: the superclass
it's true i don't respect the conventions all the time, because in some cases this can bring significant speed gains (necessary on heavily accessed sites). however, if you're kind enough to share, i would like to know 'the cake way' for this: i have to show on one page different kind of information ( totally unrelated ) - so i think i can't use only one controller (or maybe i'm mistaking), and on top of that, i want something that is called only once at the top of the page to perform several actions (log/set variables etc). thanks for your patience, Cristian On Nov 2, 11:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Sounds like you're not doing it the cake way. > > If you really really want to do that, your best bet is to use > loadModel. To be honest, what you're doing doesn't really fit the > cake, or MVC model particularly well, so if I were you I would look at > elements as an alternative to all the requestActions. > > If you stick to Cake's conventions based approach, your best bet is > still to do the work in app_controller, or a component. > > Simon > > On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > If I write that in the startup function of the component it will be > > called for the every controller in a page (which is not good because I > > use 'requestAction' a lot so startup will be called more than once). > > What I was actually thinking is to create my own class and call the > > initialization somewhere in bootstrap, but i don't know how to use a > > model by itself in a custom class. > > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > What you probably want to do is write a component and handle your > > > logging in the startup function. > > > > You probably also want to be using the component to inform the > > > controller as to layout / views to use for the skinning. Depending on > > > your controllers, there are all sorts of ways you could do this, > > > ranging from $controller->layout = 'skin' in component startup to a > > > beforeRender filter. > > > > To get access to the db tables in your component, you'll have to use > > > loadModel to grab instances for the logging and prefs etc. > > > > Pages controller is something totally different. It is a simple > > > controller to just display views from the /app/views/pages directory > > > without the hastle of creating actions. Essentially it is for static > > > content. However, it could be informed by your component to change the > > > layout (skin) around static content and to log user progress if you > > > add your component to AppController in /app/app_controller.php. > > > > Hope that helps. > > > > Simon > > > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > > > > > hi everybody, > > > > i'm new to phpcake organization model and i'm having some problems > > > > integrating some classes. maybe you can give me a hand. > > > > > i need a "visitor" class that will be responsible with tracking a site > > > > 'visitor' (not a user), keep a track and use his settings (like language > > > > and skin preferences) via cookies and similar stuff. the thing with this > > > > is: i don't know if this should be a controller or a component. i would > > > > say it's a controller because it hase it's own models (like log tables, > > > > preferences table, etc), but then, it has no view and must be called > > > > (initialized) on every page before everything else, and be accesible > > > > from any other controller. > > > > > what should i do? i saw a page_controller somewhere and i think i can > > > > use that but i'm not sure how? > > > > > what do you sugest. i'm sure this is a preaty common practice. what do > > > > you use? > > > > > thanks, > > > > Cristian --~--~-~--~~~---~--~~ 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: YAMMY!: feed your migrations faster
Nice work Daniel. Good luck with the new blog. --~--~-~--~~~---~--~~ 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: the superclass
Sounds like you're not doing it the cake way. If you really really want to do that, your best bet is to use loadModel. To be honest, what you're doing doesn't really fit the cake, or MVC model particularly well, so if I were you I would look at elements as an alternative to all the requestActions. If you stick to Cake's conventions based approach, your best bet is still to do the work in app_controller, or a component. Simon On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If I write that in the startup function of the component it will be > called for the every controller in a page (which is not good because I > use 'requestAction' a lot so startup will be called more than once). > What I was actually thinking is to create my own class and call the > initialization somewhere in bootstrap, but i don't know how to use a > model by itself in a custom class. > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > What you probably want to do is write a component and handle your > > logging in the startup function. > > > You probably also want to be using the component to inform the > > controller as to layout / views to use for the skinning. Depending on > > your controllers, there are all sorts of ways you could do this, > > ranging from $controller->layout = 'skin' in component startup to a > > beforeRender filter. > > > To get access to the db tables in your component, you'll have to use > > loadModel to grab instances for the logging and prefs etc. > > > Pages controller is something totally different. It is a simple > > controller to just display views from the /app/views/pages directory > > without the hastle of creating actions. Essentially it is for static > > content. However, it could be informed by your component to change the > > layout (skin) around static content and to log user progress if you > > add your component to AppController in /app/app_controller.php. > > > Hope that helps. > > > Simon > > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > > > > hi everybody, > > > i'm new to phpcake organization model and i'm having some problems > > > integrating some classes. maybe you can give me a hand. > > > > i need a "visitor" class that will be responsible with tracking a site > > > 'visitor' (not a user), keep a track and use his settings (like language > > > and skin preferences) via cookies and similar stuff. the thing with this > > > is: i don't know if this should be a controller or a component. i would > > > say it's a controller because it hase it's own models (like log tables, > > > preferences table, etc), but then, it has no view and must be called > > > (initialized) on every page before everything else, and be accesible > > > from any other controller. > > > > what should i do? i saw a page_controller somewhere and i think i can > > > use that but i'm not sure how? > > > > what do you sugest. i'm sure this is a preaty common practice. what do > > > you use? > > > > thanks, > > > Cristian --~--~-~--~~~---~--~~ 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: the superclass
If I write that in the startup function of the component it will be called for the every controller in a page (which is not good because I use 'requestAction' a lot so startup will be called more than once). What I was actually thinking is to create my own class and call the initialization somewhere in bootstrap, but i don't know how to use a model by itself in a custom class. On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > What you probably want to do is write a component and handle your > logging in the startup function. > > You probably also want to be using the component to inform the > controller as to layout / views to use for the skinning. Depending on > your controllers, there are all sorts of ways you could do this, > ranging from $controller->layout = 'skin' in component startup to a > beforeRender filter. > > To get access to the db tables in your component, you'll have to use > loadModel to grab instances for the logging and prefs etc. > > Pages controller is something totally different. It is a simple > controller to just display views from the /app/views/pages directory > without the hastle of creating actions. Essentially it is for static > content. However, it could be informed by your component to change the > layout (skin) around static content and to log user progress if you > add your component to AppController in /app/app_controller.php. > > Hope that helps. > > Simon > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > > > hi everybody, > > i'm new to phpcake organization model and i'm having some problems > > integrating some classes. maybe you can give me a hand. > > > i need a "visitor" class that will be responsible with tracking a site > > 'visitor' (not a user), keep a track and use his settings (like language > > and skin preferences) via cookies and similar stuff. the thing with this > > is: i don't know if this should be a controller or a component. i would > > say it's a controller because it hase it's own models (like log tables, > > preferences table, etc), but then, it has no view and must be called > > (initialized) on every page before everything else, and be accesible > > from any other controller. > > > what should i do? i saw a page_controller somewhere and i think i can > > use that but i'm not sure how? > > > what do you sugest. i'm sure this is a preaty common practice. what do > > you use? > > > thanks, > > Cristian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
xml parsing
Hi, I want to parse a few xml feeds and stick their contents into a database. Whats the best way of doing this using cakephp? Can I use simplexml? If I can should I? Thanks alot --~--~-~--~~~---~--~~ 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 need help with understanding the webroot directory
Also take a look at app/config/routes.php 2007/11/2, jinhr <[EMAIL PROTECTED]>: > > webroot is viewed from client-side (that is web browser). > So if a file is "webroot/img/logo.jpg". It is publicly accessible as > "http://www.mydomain.com/img/logo.jpg"; > > On 11月2日, 上午11时08分, brehg <[EMAIL PROTECTED]> wrote: > > I'm new to cakePHP and have a basic web application up and running. > > Can someone please explain the webroot directory and the webroot/ > > index.php file. I would like to have my own index page load using the > > standard MVC like every other view I have created. The index.php page > > is somehow reading in my default view/wrapper correctly but I'm not > > sure how it is being built. > > > > > --~--~-~--~~~---~--~~ 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: New guy needs some help
On Nov 2, 2007, at 12:00 PM, Chris Thompson wrote: > > Where I work, we are testing out CakePHP to replace our existing > codebase. > > I have two questions. > > 1. Do all primary keys for tables have to be 'id'? By convention, yes. By configuration, no. See $primaryKey in the Model. > For $recursive to work, you need to associate your models via hasMany, hasOne, belongsTo, or hasAndBelongsToMany. Check the models chapter of the manual. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
New guy needs some help
Where I work, we are testing out CakePHP to replace our existing codebase. I have two questions. 1. Do all primary keys for tables have to be 'id'? 2. I have 3 tables, blogs, posts, users. blogs id user_id title subtitle posts id blog_id user_id added updated text users id username password I want to be able to call http://www.mydomain.com/blog/view/cthompson and have it load a list of my posts. If I used http://www.mydomain.com/blog/view/1 it would automagicly know that I wanted to find the blog id = 1. The only way I could figure out to have to load based on username was to put a function in my app_model.php model file: function getUserId($username) { $ret = $this->query(' SELECT id FROM users WHERE username = "' . $username . '"'); return $ret[0]['users']['id']; } and call it in the blog_controller.php with $this->set('blog', $this->Blog->find(array('id' => $this->Blog- >getUserId($username)),null,null,2)); The recursive 2 seems to do nothing. I want it to pull in all the posts for this blog. So I tried calling this after it: $this->set( 'posts', $this->Posts->findAll(array('id' => $this->viewVars['blog'] ['Blog']['id'])), 'created DESC', null, null, null ); But when I do a foreach loop in my view.thtml file on the $posts var, nothing happens. We are still in the review stages of multiple frameworks, but think that CakePHP is the one for us. I would like to know if I am headed in the correct direction to get the information that I need to build a blog/view file with a list of all the posts that have been made to the blog. Thanks, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How do you do Client/Server interaction? (CakePHP/JSON/jQuery)
Just to let you all know, I've put up a tutorial explaining it a bit more here: http://digitalspaghetti.me.uk/2007/11/02/developing-a-persistent-javascript-variable-with-cakephp-12-jquery/ Please feel free to comment as it probably could be improved upon. On 02/11/2007, Tane Piper <[EMAIL PROTECTED]> wrote: > Well, what would you know! Having written out what I wanted to get, > and by simply applying a little brainpower, I came up with the > solution. What I did was write a CakePHP component and helper. First > off, here is the component: > > class JsonComponent extends Component { > var $json_for_layout = array(); > function addToJSON($add = array()){ > $this->json_for_layout = array_merge($this->json_for_layout, > $add); > } > function getJSON() { > return $this->json_for_layout; > } > } > ?> > > What this component does is allows me to pass in arrays to a global > array in the controller, json_for_layout. Every time I call this from > a controller, it add's to the array. The next step is in my > beforeRender() function in my AppController, I do this: > > $this->set('json_for_layout', $this->Json->getJSON()); > > This sets my view variable. I then need to actually generate the JSON > and output it to a var: > > class JsonHelper extends JavascriptHelper { > function renderJSON($data, $varname = 'Pastemonkey'){ > $json = json_encode($data); > $output = $this->codeBlock('var ' . $varname . ' = ' . $json > . ';'); > return $output; > } > } > ?> > > Now, what I do is inside my header, I echo this out to the view: > > renderJSON($json_for_layout));?> > > And thats it! Check your DOM tab in firebug to see the global object > now available. > > For example, if I pass in my sitename, I can simply call it with: > > Pastemonkey.sitename > > Hope this helps out a few people, and I intend to write a more > thorough blog about it tomorrow. > > On 01/11/2007, Tane Piper <[EMAIL PROTECTED]> wrote: > > Apologies for the cross posting here, but I myself am at a bit of a > > crossroads in my applications development, and I'd like to take the > > time to put out this email in the hopes that it generates some good > > discussion, and can maybe teach me a few things. > > > > A little background first to my issues. I am developing my > > application at the moment (pastemonkey.org) and it's being built on > > CakePHP and jQuery. At the moment, I'm using a lot of CakePHP's built > > in stuff to generate my HTML, and I'm using jQuery to do some simple > > Ajax stuff and some DOM manipulation. > > > > Where I am at a crossroads is how to do my client/server interaction > > with JSON. For example, I have the facility in place for inline > > comments. When you see a paste, you can double click on each line to > > create and view the comments. When you create one, there is code that > > generates the comment and enters the line number and paste ID. > > > > To display this, what I do is create an array of the line numbers, and > > generate JSON using PHP's inbuilt functions. So an array like this > > ('1', '2', '10', '15') becomes ["1", "2", "10", "15"]. What I then do > > is pass this to the view, and do this: > > > > codeBlock('var lines = eval(' . $comment_lines . > > ')'));?> > > > > So what this does is it outputs > > > > var lines = eval( ["1", "2", "10", "15"]); > > > > I then have this function in my core javascript file: > > > > $('.geshi-output-view ol li').each(function(i){ > > i++; > > $(this).attr('id', i); > > if ($.inArray(i, lines) != -1) { > > $(this).attr('style','').addClass('hasComment'); > > } > > }); > > > > What I am doing here is expecting there to already be a variable set > > called lines, and I check each line's ID (based on offset + 1) to see > > if it's in the JSON array, and if it does apply the class. > > > > It presents two issues - first it's ugly. It means I always have to > > have the javascript helper line above in any view I want to use it in, > > and I also expect the variable to be there (in the case of the view it > > always should be). I'm wondering if anyone know a much nicer, more > > global way to handle this? > > > > For example, Is there any way in PHP to generate a global object? For > > example a Pastemonkey object that I can attach to. e.g: > > > > Pastemonkey.Settings.sitename > > Pastemonkey.Comments[0] > > Pastemonkey.User.Colour.Header > > etc > > > > I'm basically looking for the cleanest way to handle persistent data > > from my server side that I can use client side with jQuery. > > > > Thanks > > > > -- > > Tane Piper > > Blog - http://digitalspaghetti.me.uk > > AJAX Pastebin - http://pastemonkey.org > > > > This email is: [ ] blogable [ x ] ask first [ ] private > > > > > -- > Tane Piper > Blog - http://digitalspaghetti.me.uk > AJAX Pastebin - http://pastemonkey.org > > This email is: [ ] blogab
Re: 1.2, AuthComponent: Call to a member function isAuthorized() on a non-object
On 10/30/07, a.php.programmer <[EMAIL PROTECTED]> wrote: > $this->auth->authorize = 'controller'; I already had that, the error still appears. Martin -- Martin Schapendonk, [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Can i have url like domain/username
Hey Yujin, I do something similar. 'faqs', 'action' => ':action')); // This line is a catch all Router::connect('/*', array('controller' => 'pages', 'action' => 'display')); ?> Check out this article. http://bakery.cakephp.org/articles/view/custom-urls-from-the-site-root Hope this helps. james --~--~-~--~~~---~--~~ 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 need help with understanding the webroot directory
webroot is viewed from client-side (that is web browser). So if a file is "webroot/img/logo.jpg". It is publicly accessible as "http://www.mydomain.com/img/logo.jpg"; On 11月2日, 上午11时08分, brehg <[EMAIL PROTECTED]> wrote: > I'm new to cakePHP and have a basic web application up and running. > Can someone please explain the webroot directory and the webroot/ > index.php file. I would like to have my own index page load using the > standard MVC like every other view I have created. The index.php page > is somehow reading in my default view/wrapper correctly but I'm not > sure how it is being built. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
I need help with understanding the webroot directory
I'm new to cakePHP and have a basic web application up and running. Can someone please explain the webroot directory and the webroot/ index.php file. I would like to have my own index page load using the standard MVC like every other view I have created. The index.php page is somehow reading in my default view/wrapper correctly but I'm not sure how it is being built. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple $content_for_layout
You could also cache your elements, it depends how frequently they are changing, but that's an alternative solution as well. (with cake 1.2) On Nov 2, 12:37 pm, AD7six <[EMAIL PROTECTED]> wrote: > On Oct 31, 11:53 am, "Cristi A." <[EMAIL PROTECTED]> wrote: > > > > > Hi everyone, > > > This is my first post and I am new to cakephp. > > > I decided to start from the basic so I am trying to move a simple HTML > > web-site (mostly static pages) to cakephp and add an Administration > > for a photo gallery with multiple categories. > > > The problem I encountered appeared early because the way the HTML was > > designed, > > so I need 2 $content_for_layout in my default layout, like this: > > > > > > > > > > > THE MAIN MENU > > > > > > > > > * > > > I've searched this group and found 3 threads started about this and 1 > > solution which involved modifying the core of cake(not recommended > > from obvious reasons). > > > All I need to know if this can be done without modifying the core, and > > if yes ..how?? > > > Also I was thinking that if this can not be done is it possible to > > load an element inside a view and not a layout? > > This way I could define THE MENU, FOOTER, HEADER as elements and > > include them inside my views (not so sweet but would solve my > > problem.) > > Why don't you define variables for these bits of dynamic content in > your app controller and use these variables to output variable content > in these elements? > > Elements don't have to be static. You might be interested in the links > on this page:http://groups.google.com/group/cake-php/web/frequent-discussions > > hth, > > AD --~--~-~--~~~---~--~~ 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: Update gone wrong.
I'm not sure if I'm having this problem or not (I'll explain why in a second..) - I've updated to the latest Cake 1.2 pre-beta, (not tried any of the nightlies yet though - at the moment the nightlies page only seems to link to empty files) I seem to be able to get the cache to write files to my tmp directory, but I'm having a couple of problems 1) The cached copies of my pages don't seem to be getting used. In my controller, I have 'Cache' in my helpers array, and also var $cacheAction = array( 'controller/action' => 5 ); in the same controller which seems to create the cached copies ok - but these files don't get read when reloading the page - is there anything else I should be doing to ensure that cached copies of pages are used, rather than regenerating the pages every time? - I've checked this by putting a timestamp in my page code, and this timestamp updates every time I hit refresh (I'm assuming, if the cache was working, this wouldn't be happening) 2) The cache doesn't seem to work with named parameters, especially with pagination - e.g. if I use controller/action/page:2 then it reports a file error writing to the cache (I'm assuming because of the semicolon). Is this usual? Should caching work with pagination or is it not used for a reason? Any help would be hugely appreciated. I'm only just celebrating my 3rd month with the lovely Cake, and still learning :) Cheers On Nov 1, 6:48 pm, Mech7 <[EMAIL PROTECTED]> wrote: > DId anybody allready found a solution for thi :( ? --~--~-~--~~~---~--~~ 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: Model with custom id fields
On Nov 2, 1:43 pm, maxpo <[EMAIL PROTECTED]> wrote: > My table has primary key made up of two primary keys. > Now when i call save it gives me the error of duplicate record, since > there is no column in table named id and the two id keys are : > > student_id, assessment_id. > > What i want from cake is to perform save operation based on these two > keys instead of the id field in table. (Since cake searches for the id > key if it is present then updates other wise simply inserts they > value) Add a single primary key field and your problem magically and mysteriously disappears. AD --~--~-~--~~~---~--~~ 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: Model with custom id fields
My table has primary key made up of two primary keys. Now when i call save it gives me the error of duplicate record, since there is no column in table named id and the two id keys are : student_id, assessment_id. What i want from cake is to perform save operation based on these two keys instead of the id field in table. (Since cake searches for the id key if it is present then updates other wise simply inserts they value) On Nov 2, 4:31 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > Please explain what you want to achieve more clearly. > > But perhaps the beforeSave() model callback is what you are after? > Then you can modify the data that is about to be saved in any way you > like. > > On Nov 2, 7:45 pm, maxpo <[EMAIL PROTECTED]> wrote: > > > How can assign custom id fields to model, so that whenever i call save > > it should reffer to those id fields before inserting. > > I know var $id is there in models but how to use it? --~--~-~--~~~---~--~~ 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: the superclass
What you probably want to do is write a component and handle your logging in the startup function. You probably also want to be using the component to inform the controller as to layout / views to use for the skinning. Depending on your controllers, there are all sorts of ways you could do this, ranging from $controller->layout = 'skin' in component startup to a beforeRender filter. To get access to the db tables in your component, you'll have to use loadModel to grab instances for the logging and prefs etc. Pages controller is something totally different. It is a simple controller to just display views from the /app/views/pages directory without the hastle of creating actions. Essentially it is for static content. However, it could be informed by your component to change the layout (skin) around static content and to log user progress if you add your component to AppController in /app/app_controller.php. Hope that helps. Simon On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > hi everybody, > i'm new to phpcake organization model and i'm having some problems > integrating some classes. maybe you can give me a hand. > > i need a "visitor" class that will be responsible with tracking a site > 'visitor' (not a user), keep a track and use his settings (like language > and skin preferences) via cookies and similar stuff. the thing with this > is: i don't know if this should be a controller or a component. i would > say it's a controller because it hase it's own models (like log tables, > preferences table, etc), but then, it has no view and must be called > (initialized) on every page before everything else, and be accesible > from any other controller. > > what should i do? i saw a page_controller somewhere and i think i can > use that but i'm not sure how? > > what do you sugest. i'm sure this is a preaty common practice. what do > you use? > > thanks, > Cristian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
the superclass
hi everybody, i'm new to phpcake organization model and i'm having some problems integrating some classes. maybe you can give me a hand. i need a "visitor" class that will be responsible with tracking a site 'visitor' (not a user), keep a track and use his settings (like language and skin preferences) via cookies and similar stuff. the thing with this is: i don't know if this should be a controller or a component. i would say it's a controller because it hase it's own models (like log tables, preferences table, etc), but then, it has no view and must be called (initialized) on every page before everything else, and be accesible from any other controller. what should i do? i saw a page_controller somewhere and i think i can use that but i'm not sure how? what do you sugest. i'm sure this is a preaty common practice. what do you use? thanks, Cristian --~--~-~--~~~---~--~~ 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: Router::url not returning absolute url
hi Grant, I tried '/', but the problem is then it will only return the base url and not the absolute url to the view. I found two possible hacks to solve this 1. $absolute_url = Router::url('/', true) . Router::url('', true) -- however the problem with this one is that introduces two slashes before the controller ..for instance, the result looks like something this http://localhost/mysite//controller/action/params 2. $absolute_url = FULL_BASE_URL . Router::url('', true) - this works fine..but I am not sure whether using constants directly at the application level is a good idea. Regards, Ritesh On Nov 1, 7:14 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > Try using '/' as the url parameter, not ''. > > On my test app: > Router::url('', true) => "/cake1.2/posts" > Router::url('/', true) => "http://localhost/cake1.2/"; > > I admit this is surprising - I understand the "posts" being included > (as that was the action I was testing), but it still should have given > an absolute url. > > On Nov 2, 5:27 am, bingo <[EMAIL PROTECTED]> wrote: > > > > > hi, > > > I am trying to get absolute url location of a page. I tried using > > Router::url("", true) but that always returns me a relative url. On > > debugging, it seems although Router returns absolute url, somewhere > > its getting converted to relative url. I am calling Router class > > within my helper code. Hopefully, someone can help me with this. > > > Regards, > > Ritesh- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: Model with custom id fields
On Nov 2, 10:45 am, maxpo <[EMAIL PROTECTED]> wrote: > How can assign custom id fields to model, so that whenever i call save > it should reffer to those id fields before inserting. > I know var $id is there in models but how to use it? how about var $id = "name of primary key field" ? hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple $content_for_layout
On Oct 31, 11:53 am, "Cristi A." <[EMAIL PROTECTED]> wrote: > Hi everyone, > > This is my first post and I am new to cakephp. > > I decided to start from the basic so I am trying to move a simple HTML > web-site (mostly static pages) to cakephp and add an Administration > for a photo gallery with multiple categories. > > The problem I encountered appeared early because the way the HTML was > designed, > so I need 2 $content_for_layout in my default layout, like this: > > > > > > THE MAIN MENU > > > > > * > > I've searched this group and found 3 threads started about this and 1 > solution which involved modifying the core of cake(not recommended > from obvious reasons). > > All I need to know if this can be done without modifying the core, and > if yes ..how?? > > Also I was thinking that if this can not be done is it possible to > load an element inside a view and not a layout? > This way I could define THE MENU, FOOTER, HEADER as elements and > include them inside my views (not so sweet but would solve my > problem.) Why don't you define variables for these bits of dynamic content in your app controller and use these variables to output variable content in these elements? Elements don't have to be static. You might be interested in the links on this page: http://groups.google.com/group/cake-php/web/frequent-discussions hth, AD --~--~-~--~~~---~--~~ 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: Model with custom id fields
Please explain what you want to achieve more clearly. But perhaps the beforeSave() model callback is what you are after? Then you can modify the data that is about to be saved in any way you like. On Nov 2, 7:45 pm, maxpo <[EMAIL PROTECTED]> wrote: > How can assign custom id fields to model, so that whenever i call save > it should reffer to those id fields before inserting. > I know var $id is there in models but how to use it? --~--~-~--~~~---~--~~ 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: app not fully "baking"
On Nov 1, 6:17 pm, Miyagi <[EMAIL PROTECTED]> wrote: > Not the first time I've written a CakePHP application, but it's been > awhile and this is the first time I've gone ahead and used the > bake.php script. (IIS6 + Apache) > > http://localhost/cake/- works finehttp://localhost/cake/app/index.php- works > fine > > I baked my models and basic controllers (add/edit/delete) - but when i > goto: /cake/projects > I get the following error... > === > > Notice: Undefined index: controller in C:\Program Files\Apache > Software Foundation\Apache2.2\htdocs\cake\cake\dispatcher.php on line > 152 > > Missing controller > > You are seeing this error because controller Controller could not be > found. Have a look at line 152 of the dispatcher. Do you have a route defined which doesn't say which controller to use? Have you taken the routes files from a 1.2 project and put it in a 1.1 install? Anytime there is an error for a controller with no name, it'll be related to some kind of setup (route) problem, using bake shouldn't be a factor. If you put a vanilla install in place and go to the url /asdf do you get an error message saying the AsdfController could not be found (correct response) or that an unnamed controller could not be found? Depending on your answer to the last question you should be able to form a plan. hth, AD --~--~-~--~~~---~--~~ 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: checkSession doesn't work well
On Nov 1, 11:43 am, Rhee <[EMAIL PROTECTED]> wrote: > Hi, > > I use checkSession() in AppController to check if the user logged in > or not and I also put $beforeFilter in AppController. > Basically it does work. But as soon as I need this function for almost > any views in UserController, it doesn't redirect me to login page. > > The code in AppController: > > var $beforeFilter = array('checkSession'); > > function checkSession() > { > if (!$this->Session->check('User')) > { > if ($this->params['controller'] != 'users' && > $this->params['action'] != 'login') > > { > $this->redirect('/users/login/'); > exit(); > } > } > } > > Any suggestion? Debug? call parent in the before filter you have in your users controller? hth, AD ps $this->name and $this->action are less typing --~--~-~--~~~---~--~~ 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: Components array used opposed to extends?
On Nov 1, 2:46 pm, Richard <[EMAIL PROTECTED]> wrote: > Hi, > > I have several component classes that need to extend a parent class. > Which is the correct approach: > > class Availability extends Object > { > var $components = array('Parent'); > > OR: > > class Availability extends Parent > { > > Thanks in advance. It's up to you, depending on whether you want to use the functionality of the component named "Parent" or inherit it with some modifications. ensure that the Parent component is loaded if you do the latter. hth, AD --~--~-~--~~~---~--~~ 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: Routes issue
On Nov 1, 6:43 pm, befidled <[EMAIL PROTECTED]> wrote: > I currently have a controller for Articles which accesses the articles > table in my db for all primary and secondary pages on my site. I'd > like to create a route so that when I call a page, "articles/" is not > part of the URL. For example in my about section I've tried to create > the route "Router::connect('/about/*', array('controller' => > 'articles', 'action' => 'display'));" but it isn't working...do I need > to do something else as well? Define "isn't working" AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM findAll with incorrect data
On Nov 2, 3:11 am, fallenrayne <[EMAIL PROTECTED]> wrote: > Hello all, > > This is my first post here and it is a weird problem that I have been > trying to fix for a few days now with no luck. I have a HABTM that is > connecting a poker tournament table with a users table so that I can > track which users were at the poker tournament. When I run the HABTM > I end up getting the first user's data, each field, in a separate > element in the array, then I get the users in the array the proper > way. Here is my code: > > var $hasAndBelongsToMany = array('User' => > array('className'=> 'User', > 'joinTable'=> 'users_poker', > 'foreignKey' => '', > 'associationForeignKey'=> '', > 'conditions' => '', > 'order'=> '', > 'limit'=> '', > 'unique' => true, > 'finderQuery' => '', > 'deleteQuery' => '') > ); > > It is a very basic HABTM so I left most things default. In the > tournament method for my poker controller I have: > > function tournament($id) > { > $this->checkSession(); > $this->pageTitle = 'Tournament'; > $this->set('poker',$this->Poker->findById($id)); > } > > Then in the tournament view I have: > > Tournament > > foreach($poker['User'] as $user): > echo $user['username']; > echo ""; > endforeach; > ?> > > When it prints out I end up getting something that looks like: > > 1 > B > S > d > f > 2 > 1 > 1 > 7 > fallenrayne > carrie > > Of course only the last 2 rows are actually correct, the rest of the > rows are the first character of each field in the row for my username. Try using pr instead of echo and you'll see that the data isn't in the form you are expecting. Hint: Find*All*By hth, AD --~--~-~--~~~---~--~~ 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: Is possible to return variables from a element?
On Oct 31, 9:44 pm, Defranco <[EMAIL PROTECTED]> wrote: > Hi, > > Besides the standard html returned from a element while using > renderElement - is possible to return variables from a view like when > you pass an argument as reference to a function? > > I'm rendering a element and it is returning an html (string) but I > would like to get a collection of variables from it instead of just a > string that it normally returns -- is it possible? -- is there some > workaround that I can use to return a collection of variables (array > for example) from a single render element? Why would you butcher an element for that instead of using a helper? AD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model with custom id fields
How can assign custom id fields to model, so that whenever i call save it should reffer to those id fields before inserting. I know var $id is there in models but how to use it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---