Re: (Cake)PHP programmer needed urgently!
PS Forgot to mention: we are based in London, and the person we are looking for needs to be able to come to our office and work for the vast majority of the duration of the contract. simon wrote: Hi all, Hope you don't mind me posting a job ad here! I'm working in a small web team at work and we quite urgently need a PHP programmer. Here's what we're looking for: We are looking for a enthusiastic and experienced Web Developer for 3 months to help develop a large internal business system (in CakePHP). This will mostly consist of back end development so strong PHP and MySQL are a must, with CakePHP or RoR experience being advantageous. Good knowledge of semantic HTML, CSS and Javascript is also needed and if you know what things like Microformats, OpenID and OAuth are we'd love to hear from you! Send CVs and messages as soon as possible to [EMAIL PROTECTED] Cheers, Simon --~--~-~--~~~---~--~~ 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: cake 1.18 - has it changed the behavior of Sessions?
I've experienced the same bug, and changing from high to medium security seems to have solved it. I'm doing a lot of AJAX stuff in the background, is that what is causing it? Or this a general bug with security set to high? Simon On Nov 21, 2:29 pm, keymaster [EMAIL PROTECTED] wrote: I have an app which has been working steadily for almost a year, through several cake releases, up to and including cake 1.17. When I upgrated to cake 1.18, with no changes to the app, all of a suddensessionvariables aredisappearingduring some (not all) of my ajax requests. The call to $this-Session-check('myVar') is returning false. I am using CAKE_SECURITY = high. I checked through the release notes of 1.18 and found severalsession related fixes. One in particular caught my eye - it had to do with a bugfix to regeneratesessionid's on every request. (update which fixes #3313) I wondered if perhaps that might have something to do with my problems. So, I lowered CAKE_SECURITY from high to medium. That fixed the problem. To double check, I raised it back to high, and problem returned. I reverted back to cake 1.17 and there was no problem both for CAKE_SECURITY = high and low. Anyone else experience problems withsessionvars in 1.18? Are we supposed to do things differently now thatsessionid's are being regenerated for CAKE_SECURITY = high? --~--~-~--~~~---~--~~ 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: find all by relationship
But isn't that going to return all the users form all the countries? Is it possible to implement conditions on the country level, to only get the users in one country? On Oct 21, 11:27 am, deefens [EMAIL PROTECTED] wrote: what about this? $uses = ('Country'); ... = $this-Country-State-City-User-findAll(); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
find all by relationship
Hi, I've been looking for a while but I can't seem to find the solution. Basically, I have Countries, which has many States, every State has many Cities, and every City has many Users. I'm trying to get all the Users in a specified State, and I don't want to put a state_id in the user table, because it's relative to the city hes. I'm looking for something like this $conditions = array(User = array(City = array( State = array( State.id = '7'; $this-User-findAll($conditions); is it possible? Simon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session empty in Ajax call
You're absolutely right - I'm getting two different session IDs. And security is set to medium... Is there anything I can do about this? If I send the correct session ID as a GET variable, is there any way that the right session can be recovered or found? S On Aug 8, 6:28 pm, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: On Aug 8, 2007, at 11:25 AM, John David Anderson (_psychic_) wrote: On Aug 8, 2007, at 11:19 AM, simon wrote: Not sure... where is the session id located? In your cookies - you can also get it by calling session_id(). I should mention that if CAKE_SECURITY is set to 'high' the ID will always change between requests. Set it to 'medium' while you're working on this issue. If the ID changes when you're on 'medium' its because the session got nuked somehow. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session empty in Ajax call
The workaround I've found for this goes: Make the Flash uploader post to /attachments/upload/(session id) Then in attachments controller, recreate the session: function upload($sessionId) { session_destroy(); session_id($sessionId); session_start(); ... I then have to manually do any authentication checks and such. Seems to work alright though. On Aug 9, 10:51 am, simon [EMAIL PROTECTED] wrote: You're absolutely right - I'm getting two different session IDs. And security is set to medium... Is there anything I can do about this? If I send the correct session ID as a GET variable, is there any way that the right session can be recovered or found? S On Aug 8, 6:28 pm, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: On Aug 8, 2007, at 11:25 AM, John David Anderson (_psychic_) wrote: On Aug 8, 2007, at 11:19 AM, simon wrote: Not sure... where is the session id located? In your cookies - you can also get it by calling session_id(). I should mention that if CAKE_SECURITY is set to 'high' the ID will always change between requests. Set it to 'medium' while you're working on this issue. If the ID changes when you're on 'medium' its because the session got nuked somehow. -- 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 -~--~~~~--~~--~--~---
Session empty in Ajax call
Hi, I'm making an Ajax call from the index page of my application to a simple controller called attachments, to a function named add(). I have a session variable called User which I can print on the index page, but which is empty in the attachments controller. If I do a pr($_SESSION) in attachments/add() all I get is the attributes 'useragent', 'time' and 'random', where I should be getting a whole host of other stuff I've stored in the session. Any idea why? It is a JavaScript + Flash widget called SWFUpload making the Ajax call, so my only thought is that it does something funny to the request that prevents Cake from initialising the session properly, but that sounds pretty far fetched. The session is definitely initialised, as a session_start() will generate an error in the log. I've looked in the $_SERVER variable and the logs but didn't find anything funny. Not sure where else to look. Any help very much appreciated! Simon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session empty in Ajax call
Not sure... where is the session id located? S On Aug 8, 5:56 pm, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: On Aug 8, 2007, at 10:26 AM, simon wrote: Hi, I'm making an Ajax call from the index page of my application to a simple controller called attachments, to a function named add(). I have a session variable called User which I can print on the index page, but which is empty in the attachments controller. If I do a pr($_SESSION) in attachments/add() all I get is the attributes 'useragent', 'time' and 'random', where I should be getting a whole host of other stuff I've stored in the session. Any idea why? It is a JavaScript + Flash widget called SWFUpload making the Ajax call, so my only thought is that it does something funny to the request that prevents Cake from initialising the session properly, but that sounds pretty far fetched. The session is definitely initialised, as a session_start() will generate an error in the log. I've looked in the $_SERVER variable and the logs but didn't find anything funny. Not sure where else to look. Most likely your session is getting nixed because another user-agent is trying to access the data (i.e. the Flash object). Are your session IDs changing between requests? -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM findAll problem
What does the view() function look like? On Jul 3, 10:18 am, Easter Egg [EMAIL PROTECTED] wrote: Hi all, I used a HABTM over Product and Tag. // TAG.PHP ?php class Tag extends AppModel { var $name = Tag; var $hasAndBelongsToMany = array('Product' = array('className'= 'Product', 'joinTable'= 'products_tags', 'foreignKey' = 'tag_id', 'associationForeignKey'= 'product_id', 'conditions' = '', 'order'= '', 'limit'= '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ) );} ? // PRODUCT.PHP ?php class Product extends AppModel { var $name = Product; var $hasAndBelongsToMany = array('Tag' = array('className'= 'Tag', 'joinTable'= 'products_tags', 'foreignKey' = 'product_id', 'associationForeignKey'= 'tag_id', 'conditions' = '', 'order'= '', 'limit'= '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ) ); var $validate = array ( name= VALID_NOT_EMPTY, year= VALID_YEAR, price = VALID_NUMBER, quantity= VALID_NUMBER, description=VALID_NOT_EMPTY);} ? I defined a function view($id) that return all products of a single tag. but it only and only recieve the first 5 products over that query. like this: Array ( [0] = Array ( [Tag] = Array ( [id] = 3 [name] = مهییج ) [Product] = Array ( [0] = Array ( [id] = 3 [name] = توازن [altname] = Equilibrium [description] = توازن فیلمی است علمی- تخیلی، در باب نظم جهان و دنیایی از آینده که در آن بشریت بالاجبار به نظامهای سخت اجتماعی پناه برده است. [year] = 2001 [price] = 750 [quantity] = 1 [small_image] = winter.jpg [big_image] = sunset.jpg ) [1] = Array ( [id] = 4 [name] = ماتریکس [altname] = Matrix [description] = فیلم قشنگیه! حال کنین! [year] = 2001 [price] = 800 [quantity] = 1 [small_image] = blood_and_chocolate.jpg [big_image] = madonna_confessions_tour.jpg ) [2] = Array ( [id] = 5 [name] = ناچو لیبره [altname] = Nacho Libre [description] = فیلمی مهیج، با بازی بازیگران کمدی [year] = 1999 [price] = 780 [quantity] = 1 [small_image] = blood_and_chocolate.jpg [big_image] = arthur_and_the_invisibles.jpg ) [3] = Array ( [id] = 8 [name] = کوزهی سفالی [altname] = The Pottery [description] = جیمز در آغاز با کوزه گری شروع میکند،اما در آینده به قهرمانی بدل میشود که کشورش را نجات میدهد. [year] = 2007 [price] = 750 [quantity] = 1 [small_image] = if_only.jpg [big_image] = little_children.jpg ) [4] = Array (
Re: (Good) way of pulling data into view?
In my experience, specific problems that warrant breaking rules are a lot rarer than many think. Are you wanting your users to be able to edit the view files? if not, your controller calls the view files - it knows which view file it's going to use it should know which data it wants to receive; if so, why? and in any event I'd suggest designing towards the same answer ;). You're absolutely right... I think sometimes I come across as arrogant when I'm just trying to get a discussion going :) If you are still not convinced, what's the code in your controller method /templates/get_items_this_month/ ? specific discussions are more likely to give you specific answers. The code in that function (get_items_this_month) just does a findAll based on the function parameters. The problem was that I needed to find a way of sending an array as a parameter. Like you said, I could actually do that with requestAction but that would not be a great solution. The solution I've gone for now is to split the template up. So I've got one THTML file (template_name.thtml) which contains some iterations with html inside of them. I've also got a raw include file (template_name.php) which gets included before rendering the template file. My include file basically builds a massive array with all the data I need and then does: $this-set('templateData', $templateData); dardosordi: is this maybe what you had in mind? I would have rather made the data file a component instead of an include, but that gave me lots of problems with things like $this no longer referring to the controller. Also I would have to hardcode the array of components to include, which means that I would have to edit the controller in order to add a template (I want to avoid this). Enough of my ramblings. I think I've got something working fairly well now, albeit not as elegant as it could be. S --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
(Good) way of pulling data into view?
Hello, I have a scenario where I'm not sure how to apply Cake conventions. I'm building a reporting app where the most complex part is the report templates (views). My main question is: if I really, *really* want to make a function call to a controller from a view (even though it is against the convention), is that possible? RequestAction is proving inadequate as I need to give more complex arguments than a string. The main problem is that each template requires a different set of data which is unknown to the controller, so it has to be pulled from the view. If you have the time, continue reading, cause I could do with some advice/opinions on what the best solution for the following is: - The relevant modules for this part are the reports controller, the template controller and the various template files. The way the flow currently works is: the user requests to create a report to the reports controller. A report type is specified, i.e. /reports/create/ monthly_update The reports controller will then render the template which is a THTML file, e.g. monthly_update.thtml. Inside the template file there are various requestActions which from the templates controller requests the Items that are relevant. Items are tied to an Artist and have a type and a status. So a simple template could look like: h1Monthly update.../h1 ?php $items = $this-requestAction(/templates/get_items_this_month/ $artistId/.ITEMTYPE_NEWS.'/'.ITEMSTATUS_CONFIRMED); ? h2Confirmed news:/h2 ?php foreach($items as $item): ? p ?php echo $item['Item']['text'] ? /p ?php endforeach ? As a first draft this worked fine, but requestAction quickly becomes inadequate, as each template wants to display it's specific selection of types and statuses of items. Calling requestAction is limited as you can't send complex stuff like arrays as arguments. So is there any way I can make actual function calls to the template controller instead? Or should I be going about this in some other way? Maybe having a separate file per template specifying what data to request before rendering the thtml file? Would like to avoid this as I like the idea of having a standalone template file. Thanks, and apologies for long post... Simon --~--~-~--~~~---~--~~ 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: (Good) way of pulling data into view?
Why isn't all of that retrieval logic in the controller? I.e. you generate all the data you want in your controller, and you simply loop on your retrieved data in the vew. Ah, see I'm totally with you on this... I have a quite specific problem though: each type of template needs a specific set of data. So for instance the monthly update might want all items of types A, B and C with status confirmed and rating 3, whereas the weekly update might want something completely different. The controller does not know what the template needs, and I kind of need to keep it that way. I want to be able to add a new kind of report without having to add specific code for that report type in the controller. (Obviously I could for instance add a function in the reports controller for each report type, but want to keep the controller clean.) You will find that it is phenomenally slow if you requestAction all your data, and btw the second parameter for requestAction is an array - anything in it is received by the requestedAction.(but please, don't use requestAction to turn MVC into spaghetti). I didn't realise that requestAction had performance implications, thanks for pointing that out. It does indeed go against MVC a little bit. My problem is that the template (which is the view) needs to pull the data, which inherently is un-MVC. Or can anyone think of a better way of structuring the code? As I said I've considered having an include file that fetches the data, but would like to have a single file if possible. Thanks S --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Saving hasAndBelongsToMany with selectTag
Hi, Oddly enough Cake doesn't seem to understand that it should make an entry in the join table for HABTM related models when the foreign key isn't supplied from a multi select field... Let me try and explain that :) Say you are creating a new Item which belongs to one or many Persons, you will need a select tag with the name Person/Person. However it seems this needs to be a select tag with multiple selection enabled. This is so that the form generates the following: Array ( [Item] = Array ( [field] = Value ) [Person] = Array ( [Person] = Array ( [0] = 1 ) ) ) In other words you can't use a normal select tag, as this will generate: [Person] = Array ( [Person] = 1 ) As the value of person isn't an array here, Cake won't pick it up and won't make an entry in the join table. I haven't found a solution for this yet, I'm assuming that I'm either missing something or that I'm going to have to do some ugly hack in the controller's add/edit functions to turn the value into an array. Simon --~--~-~--~~~---~--~~ 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: Saving hasAndBelongsToMany with selectTag
The way I've worked around it for the moment is to add the following to the add function in the controller: if( !is_array($this-data['Person']['Person']) ) { $this-data['Person']['Person'] = aa(0, $this-data['Person'] ['Person']); } It's not pretty, I know. On May 23, 3:18 pm, simon [EMAIL PROTECTED] wrote: Hi, Oddly enough Cake doesn't seem to understand that it should make an entry in the join table for HABTM related models when the foreign key isn't supplied from a multi select field... Let me try and explain that :) Say you are creating a new Item which belongs to one or many Persons, you will need a select tag with the name Person/Person. However it seems this needs to be a select tag with multiple selection enabled. This is so that the form generates the following: Array ( [Item] = Array ( [field] = Value ) [Person] = Array ( [Person] = Array ( [0] = 1 ) ) ) In other words you can't use a normal select tag, as this will generate: [Person] = Array ( [Person] = 1 ) As the value of person isn't an array here, Cake won't pick it up and won't make an entry in the join table. I haven't found a solution for this yet, I'm assuming that I'm either missing something or that I'm going to have to do some ugly hack in the controller's add/edit functions to turn the value into an array. Simon --~--~-~--~~~---~--~~ 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: Saving hasAndBelongsToMany with selectTag
The way I've worked around it for the moment is to add the following to the add function in the controller: if( !is_array($this-data['Person']['Person']) ) { $this-data['Person']['Person'] = aa(0, $this-data['Person'] ['Person']); } It's not pretty, I know. On May 23, 3:18 pm, simon [EMAIL PROTECTED] wrote: Hi, Oddly enough Cake doesn't seem to understand that it should make an entry in the join table for HABTM related models when the foreign key isn't supplied from a multi select field... Let me try and explain that :) Say you are creating a new Item which belongs to one or many Persons, you will need a select tag with the name Person/Person. However it seems this needs to be a select tag with multiple selection enabled. This is so that the form generates the following: Array ( [Item] = Array ( [field] = Value ) [Person] = Array ( [Person] = Array ( [0] = 1 ) ) ) In other words you can't use a normal select tag, as this will generate: [Person] = Array ( [Person] = 1 ) As the value of person isn't an array here, Cake won't pick it up and won't make an entry in the join table. I haven't found a solution for this yet, I'm assuming that I'm either missing something or that I'm going to have to do some ugly hack in the controller's add/edit functions to turn the value into an array. Simon --~--~-~--~~~---~--~~ 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: Saving hasAndBelongsToMany with selectTag
Well, considering other people seem to be able to use HABTM-related models, I'd say that perhaps something is wrong in your configuration. :) The weird thing is that everything works perfectly normally as long as I use a multi-select field, i.e. a select tag that has the multiple attribute. The whole chain of saving and reading works and entries are made in the join table. All the examples I've found in the manual and online also all use multi-selects. I should point out that this is only if you use the HTML helper to generate the field - otherwise all you should need to do is add []: select name=data[Person][Person][].../select --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Sessions question
Is it possible to retrieve session data within a model? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---