Perhaps you're having problem serving up JS files from a controller action?
If so, make sure you set layout to null/ false in the controller, so that you don't get your site's general HTML, which would stop the JS from parsing. This will allow you to say <script src="/some_controller/ some_js_action" ></script> Also, if you're desperate to have an .js extension, you couold consider using cake's extension parsing features to provide this. And finally, imho, generating javascript from PHP doesn't lead to maintainable code. I prefer to keep variables in the main HTML page, and let the included JS files find the dunamic content from there.... just my opinion! On Aug 24, 5:29 pm, "spyros k." <[EMAIL PROTECTED]> wrote: > Hi, I'm having some trouble understanding how one can create .js files > on the fly using cakephp. > > I've read the resources mentioned in this thread but I still can't > understand how to do it, and I'd like to ask if someone could help me. > > I have two models associated with a hasMany and belongsTo relationship > (let's say modelA hasMany modelB and modelB belongsTo modelA) and what > I want to do is: > 1) get a field from those modelB entries, that belong to a specific > modelA record, when a user makes calls an action from modelA's > controller > 2) write the results to a .js file to be used by the action's view > > As far as (1) goes, I believe I know how to do that, the big problem > i'm having is (2). > Does anyone have any suggestions or ideas on how I could accomplish > that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
