Re: ways to detect httpRequest or just render 'bare'?
So let's build it. All i've done so far is create a custom headhelper component that does the dojo.js include and the dojo.requires. Everything else i'm just coding straight into the views. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
> That's interesting about Dojo. What other transport methods does it > support? You have to keep in mind though, that Cake is oriented > towards browser-based applications, which automatically constrains your > thinking in many respects, one of which is the use of XHR as the > transport mechanism of choice. There are two issues here I think - target environments, and supported transport methods. Dojo is massive, and covers a lot of bases, which makes it complex learn to use. Regarding supported transport methods, from one of the articles on the Dojo site... (http://dojotoolkit.org/intro_to_dojo_io.html): "dojo.io.bind() is a generic asynchronous request API that wraps multiple transport layers (queues of iframes, XMLHTTP, mod_pubsub, LivePage, etc.). Dojo attempts to pick the best available transport for the request at hand..." So Dojo can load js scripts on the fly, allow for file uploads (via iframe) and do cross domain transports (xmlhttp security by design won't allow xdomain or file uploads) As for target environments, from what I understand, the aim with Dojo is to allow run in different target environents in addition to the browser. SVG, Rhino get specific mentions in the docs, but looking at the source there are hostenv files for others - spidermonkey, dashboard (os x), jscript.. Javascript is everywhere on the desktop really, literally with OS X widgets, and in the Flash Authoring Environment even has a Javascript API for automating tasks and customising the IDE. But as with Cake, I think the browser is where it's all really happening with Dojo and the methods offered by Dojo to deal with the browser based apps and tasks are awesome. The more I think about it the more I think we could do with a DojoHelper... -ad On 06/07/06, nate <[EMAIL PROTECTED]> wrote: > > > A good javascript lib would give access to the > > httpRequest.setRequestHeader() function as part of the standard > > methods. Dojo and YUI certainly do. I'm not sure how this affects this > > discussion, but the developers of Dojo seem to be very keen not to > > lock their I/O into any particular transport - browser based > > httpRequest is just one that Dojo supports. Yui is much more browser > > oriented. > > That's interesting about Dojo. What other transport methods does it > support? You have to keep in mind though, that Cake is oriented > towards browser-based applications, which automatically constrains your > thinking in many respects, one of which is the use of XHR as the > transport mechanism of choice. > > > And conventions are hard to guess. In Cake I'm discovering new ones > > every day that aren't mentioned in the documentation. Maybe the page > > in the manual dealing with conventions > > (http://manual.cakephp.org/chapter/22) will grow to be more detailed > > through our contibutions. > > Yes, sometimes they are not immediately obvious. If you find something > that you think should be documented, but you can't find it in the > manual, by all means, open a ticket (trac.cakephp.org). We already > have an impressive list of doc tickets going ;-) > > > > > -- - - - - - - - - a d m a t a z +27 21 465 1500 +27 84 368 8962 www.admataz.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
> A good javascript lib would give access to the > httpRequest.setRequestHeader() function as part of the standard > methods. Dojo and YUI certainly do. I'm not sure how this affects this > discussion, but the developers of Dojo seem to be very keen not to > lock their I/O into any particular transport - browser based > httpRequest is just one that Dojo supports. Yui is much more browser > oriented. That's interesting about Dojo. What other transport methods does it support? You have to keep in mind though, that Cake is oriented towards browser-based applications, which automatically constrains your thinking in many respects, one of which is the use of XHR as the transport mechanism of choice. > And conventions are hard to guess. In Cake I'm discovering new ones > every day that aren't mentioned in the documentation. Maybe the page > in the manual dealing with conventions > (http://manual.cakephp.org/chapter/22) will grow to be more detailed > through our contibutions. Yes, sometimes they are not immediately obvious. If you find something that you think should be documented, but you can't find it in the manual, by all means, open a ticket (trac.cakephp.org). We already have an impressive list of doc tickets going ;-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
> Looks like someone already started a Yahoo UI helper: > https://cakeforge.org/plugins/scmsvn/viewcvs.php/app/views/helpers/yahoo_ui.php?rev=2&root=yahoouihelper&view=log > Thanks, will take a look... looks like a good start. -ad On 06/07/06, nate <[EMAIL PROTECTED]> wrote: > > Looks like someone already started a Yahoo UI helper: > https://cakeforge.org/plugins/scmsvn/viewcvs.php/app/views/helpers/yahoo_ui.php?rev=2&root=yahoouihelper&view=log > > > > > -- - - - - - - - - a d m a t a z +27 21 465 1500 +27 84 368 8962 www.admataz.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
On 05/07/06, Samuel DeVore <[EMAIL PROTECTED]> wrote: > I would imagine that if one is using other js methods like dojo that there > might be a custom header from them as well that could be added to the > requestHandler stuff, as a variable or define, that could be added to the > code via a enhancement request in the trac/ I've done some investigation, and my findings are... As far as I can see, from a quick look at the Dojo and YUI code, neither of them set custom headers in their httpRequest functions the way Prototype sets HTTP_X_REQUESTED_WITH (I may have missed it and be wrong). So in the absence of any standard, developers not using Prototype could set this header in their httpRequests, which would enable requestHandler->setAjax() detection within CakePHP. A good javascript lib would give access to the httpRequest.setRequestHeader() function as part of the standard methods. Dojo and YUI certainly do. I'm not sure how this affects this discussion, but the developers of Dojo seem to be very keen not to lock their I/O into any particular transport - browser based httpRequest is just one that Dojo supports. Yui is much more browser oriented. I am beginning to appreciate the value of convention over configuration - it really is a change in mindset. BUT I think it can be damaging if the convention is not transparant and well documented, and ways aren't provided of breaking the convention if required for particular circumstances. Convention is meant to save us time and effort, but as developers without a full picture we could end up burning all those saved hours trying to debug apps that are not designed to do what we want them to do. And conventions are hard to guess. In Cake I'm discovering new ones every day that aren't mentioned in the documentation. Maybe the page in the manual dealing with conventions (http://manual.cakephp.org/chapter/22) will grow to be more detailed through our contibutions. onward... -ad On 05/07/06, Samuel DeVore <[EMAIL PROTECTED]> wrote: > I would imagine that if one is using other js methods like dojo that there > might be a custom header from them as well that could be added to the > requestHandler stuff, as a variable or define, that could be added to the > code via a enhancement request in the trac/ > > > On 7/5/06, adam davis <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > Regarding the immediate problem discussed in this thread (rendering > bare)... I'm finding that using the following works > > $this->autoLayout = false; > or > $this->layout="ajax"; > > For anyone else following this beware of the render time print out > that appears by default at the bottom of your pages if your DEBUG>0. > This will really mess you up if you're trying to return something > other than html or xml (like JSON) > > The link below has some pointers to ommiting the render time: > "omit render time?" > http://groups.google.com/group/cake-php/browse_thread/thread/dee6de138115dc36/28a23c1188d6a7c7 > > As for the thoughts this has provoked, thanks Nate for the response > and background explanation. It's good to know what informed the design > - helps with working with it. Maybe it's a documentation issue that > creates the confusion - and these things will become more clear as > more information about CakePHP and how to use it emerges (through > people using it and contibuting to the documentation, lists etc.) > > For my 2c, while I understand the need for making a choice, and the > rationale of convention over configuration, dressing up something > quite specific (Prototype.js) as generic (AjaxHelper or setAjax) is a > little misleading to developers who are entering the cake bakery from > other frameworks or languages. What isn't Ajax these days? Maybe > there's a problem with that specific buzzword. That's why I would > favour a more specific approach to naming conventions. > > Moving forward, I have no fear of diving into the code and altering > things manually in my JS or PHP on a project by project basis based on > requirements - I think a core framework can only provide a certain > amount of generic usefulness for every possible option before it > becomes too complex and difficult. That's why we like cake! > > Maybe at the end of these projects I'll have enough generic code to > consolidate into a stable DojoHelper or YuiHelper of sorts. I hope so > - I think CakePHP has great potential and I agree that more choice of > things like js libs, the better for us all. Nice well rounded cake. > > all the best, > -ad > > > > On 05/07/06, nate < [EMAIL PROTECTED]> wrote: > > > > Hi there, > > > > > I know the proper cake way to set content is to use the RequestHandler > > > Component $this->RequestHandler->setAjax(), but Ive > discovered that > > > that this function tests the value of the HTTP_X_REQUESTED_WITH header, > > > which is a proprietry value set by the Prototype.js. > > > > If you're using an alternative library, I would suggest setting the > > request header manually.
Re: ways to detect httpRequest or just render 'bare'?
Looks like someone already started a Yahoo UI helper: https://cakeforge.org/plugins/scmsvn/viewcvs.php/app/views/helpers/yahoo_ui.php?rev=2&root=yahoouihelper&view=log --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
Hey Adam, thanks for the feedback. I look forward to seeing your contributions. Lately we have been working on some basic support for alternative methods of doing things in JavaScript. For example, JavascriptHelper::event now supports both Prototype-style events (the default) and Justin Palmer's event:Selectors using an alternative syntax. We're also looking into the possibility of adding basic support for jQuery. While the core libraries will always be focused around Prototype and script.aculo.us, as the framework grows, more people will develop support for alternative libraries. I believe there are several on CakeForge already (the Xajax package comes to mind). FYI: one other way to "disable" the timer comment block (what I normally do) is put a // at the end of the action template that outputs the JSON. This seems to be the quickest and easiest, and so far it's never given me any trouble. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ways to detect httpRequest or just render 'bare'?
I would imagine that if one is using other js methods like dojo that there might be a custom header from them as well that could be added to the requestHandler stuff, as a variable or define, that could be added to the code via a enhancement request in the trac/ On 7/5/06, adam davis <[EMAIL PROTECTED]> wrote: Hi all,Regarding the immediate problem discussed in this thread (renderingbare)... I'm finding that using the following works$this->autoLayout = false;or$this->layout="ajax"; For anyone else following this beware of the render time print outthat appears by default at the bottom of your pages if your DEBUG>0.This will really mess you up if you're trying to return something other than html or xml (like JSON)The link below has some pointers to ommiting the render time:"omit render time?" http://groups.google.com/group/cake-php/browse_thread/thread/dee6de138115dc36/28a23c1188d6a7c7As for the thoughts this has provoked, thanks Nate for the responseand background explanation. It's good to know what informed the design - helps with working with it. Maybe it's a documentation issue thatcreates the confusion - and these things will become more clear asmore information about CakePHP and how to use it emerges (throughpeople using it and contibuting to the documentation, lists etc.) For my 2c, while I understand the need for making a choice, and therationale of convention over configuration, dressing up somethingquite specific (Prototype.js) as generic (AjaxHelper or setAjax) is a little misleading to developers who are entering the cake bakery fromother frameworks or languages. What isn't Ajax these days? Maybethere's a problem with that specific buzzword. That's why I wouldfavour a more specific approach to naming conventions. Moving forward, I have no fear of diving into the code and alteringthings manually in my JS or PHP on a project by project basis based onrequirements - I think a core framework can only provide a certain amount of generic usefulness for every possible option before itbecomes too complex and difficult. That's why we like cake!Maybe at the end of these projects I'll have enough generic code toconsolidate into a stable DojoHelper or YuiHelper of sorts. I hope so - I think CakePHP has great potential and I agree that more choice ofthings like js libs, the better for us all. Nice well rounded cake.all the best,-adOn 05/07/06, nate < [EMAIL PROTECTED]> wrote:>> Hi there,>> > I know the proper cake way to set content is to use the RequestHandler> > Component $this->RequestHandler->setAjax(), but Ive discovered that > > that this function tests the value of the HTTP_X_REQUESTED_WITH header,> > which is a proprietry value set by the Prototype.js.>> If you're using an alternative library, I would suggest setting the > request header manually.>> > 1. Does anyone know if there there any other (standard) ways of> > detecting an httpRequest load of content?>> Other than headers and custom URLs, there is no other way, unless you > can figure out a way to cleverly embed a flag in some other part of the> request anatomy.>> > 2. Otherwise, in Cake, what's the best way to serve pages as "bare".> > I've tried setting the folowing in my controller >> Try $this->layout = 'ajax'; or $this->autoLayout = false; (in the> Controller).>> > - request the url preceded by /bare (works, but not in conjunction> > with /admin -seems limited) >> I think that's been fixed recently. Have you tried it both ways? (i.e.> /admin/bare and /bare/admin).>> > How much of CakePHP's code and design is locked into Prototype.js?> > A lot.>> Cake is based on the idea of convention over configuration. One of> those conventions is the use of the Prototype library.>> When we first started developing this part of the framework, we > considered several libraries (including Dojo) and ended up going with> Prototype for a number of reasons. Our hesitations about the file size> were more or less negated by the fact that the readability of the file > itself means (a) you can remove components for specific situations or> applications, and (b) it's uncompressed, which means you can compress> it.>> > For a number of reasons I'm using a different _javascript_ library than > > Prototype.js for my httpRequest activity (using the Yahoo! UI lib in> > one project and Dojo Toolkit in another, and sometimes it's not> > necessary to include an entire library of code, so I have some hand > > rolled variations).>> Fortunately, most JS libs make customization easy. I imagine it'd also> be pretty easy to write the necessary header code into Dojo or Yahoo UI> yourself. >> > Maybe time for me to write a DojoHelper. yikes. Anyone else using these> > libs?>> I've heard about a few people, but I don't really know how many.> You're certainly more than welcome to write your own library and post > it on CakeForge, so that the rest of Cake's Dojo-and/or-Yahoo-UI-using> community can help you continue to develop it. In fact, I would> sincerely appreciate any eff
Re: ways to detect httpRequest or just render 'bare'?
Hi all, Regarding the immediate problem discussed in this thread (rendering bare)... I'm finding that using the following works $this->autoLayout = false; or $this->layout="ajax"; For anyone else following this beware of the render time print out that appears by default at the bottom of your pages if your DEBUG>0. This will really mess you up if you're trying to return something other than html or xml (like JSON) The link below has some pointers to ommiting the render time: "omit render time?" http://groups.google.com/group/cake-php/browse_thread/thread/dee6de138115dc36/28a23c1188d6a7c7 As for the thoughts this has provoked, thanks Nate for the response and background explanation. It's good to know what informed the design - helps with working with it. Maybe it's a documentation issue that creates the confusion - and these things will become more clear as more information about CakePHP and how to use it emerges (through people using it and contibuting to the documentation, lists etc.) For my 2c, while I understand the need for making a choice, and the rationale of convention over configuration, dressing up something quite specific (Prototype.js) as generic (AjaxHelper or setAjax) is a little misleading to developers who are entering the cake bakery from other frameworks or languages. What isn't Ajax these days? Maybe there's a problem with that specific buzzword. That's why I would favour a more specific approach to naming conventions. Moving forward, I have no fear of diving into the code and altering things manually in my JS or PHP on a project by project basis based on requirements - I think a core framework can only provide a certain amount of generic usefulness for every possible option before it becomes too complex and difficult. That's why we like cake! Maybe at the end of these projects I'll have enough generic code to consolidate into a stable DojoHelper or YuiHelper of sorts. I hope so - I think CakePHP has great potential and I agree that more choice of things like js libs, the better for us all. Nice well rounded cake. all the best, -ad On 05/07/06, nate <[EMAIL PROTECTED]> wrote: > > Hi there, > > > I know the proper cake way to set content is to use the RequestHandler > > Component $this->RequestHandler->setAjax(), but Ive discovered that > > that this function tests the value of the HTTP_X_REQUESTED_WITH header, > > which is a proprietry value set by the Prototype.js. > > If you're using an alternative library, I would suggest setting the > request header manually. > > > 1. Does anyone know if there there any other (standard) ways of > > detecting an httpRequest load of content? > > Other than headers and custom URLs, there is no other way, unless you > can figure out a way to cleverly embed a flag in some other part of the > request anatomy. > > > 2. Otherwise, in Cake, what's the best way to serve pages as "bare". > > I've tried setting the folowing in my controller > > Try $this->layout = 'ajax'; or $this->autoLayout = false; (in the > Controller). > > > - request the url preceded by /bare (works, but not in conjunction > > with /admin -seems limited) > > I think that's been fixed recently. Have you tried it both ways? (i.e. > /admin/bare and /bare/admin). > > > How much of CakePHP's code and design is locked into Prototype.js? > > A lot. > > Cake is based on the idea of convention over configuration. One of > those conventions is the use of the Prototype library. > > When we first started developing this part of the framework, we > considered several libraries (including Dojo) and ended up going with > Prototype for a number of reasons. Our hesitations about the file size > were more or less negated by the fact that the readability of the file > itself means (a) you can remove components for specific situations or > applications, and (b) it's uncompressed, which means you can compress > it. > > > For a number of reasons I'm using a different Javascript library than > > Prototype.js for my httpRequest activity (using the Yahoo! UI lib in > > one project and Dojo Toolkit in another, and sometimes it's not > > necessary to include an entire library of code, so I have some hand > > rolled variations). > > Fortunately, most JS libs make customization easy. I imagine it'd also > be pretty easy to write the necessary header code into Dojo or Yahoo UI > yourself. > > > Maybe time for me to write a DojoHelper. yikes. Anyone else using these > > libs? > > I've heard about a few people, but I don't really know how many. > You're certainly more than welcome to write your own library and post > it on CakeForge, so that the rest of Cake's Dojo-and/or-Yahoo-UI-using > community can help you continue to develop it. In fact, I would > sincerely appreciate any efforts to help expand Cake's support for > other JavaScript libraries through 3rd party components and helpers. > > > > > -- - - - - - - - - a d m a t a z +27 21 465 1500 +27 84 368 8962 www.admataz.com --~--~-~-
Re: ways to detect httpRequest or just render 'bare'?
Hi there, > I know the proper cake way to set content is to use the RequestHandler > Component $this->RequestHandler->setAjax(), but Ive discovered that > that this function tests the value of the HTTP_X_REQUESTED_WITH header, > which is a proprietry value set by the Prototype.js. If you're using an alternative library, I would suggest setting the request header manually. > 1. Does anyone know if there there any other (standard) ways of > detecting an httpRequest load of content? Other than headers and custom URLs, there is no other way, unless you can figure out a way to cleverly embed a flag in some other part of the request anatomy. > 2. Otherwise, in Cake, what's the best way to serve pages as "bare". > I've tried setting the folowing in my controller Try $this->layout = 'ajax'; or $this->autoLayout = false; (in the Controller). > - request the url preceded by /bare (works, but not in conjunction > with /admin -seems limited) I think that's been fixed recently. Have you tried it both ways? (i.e. /admin/bare and /bare/admin). > How much of CakePHP's code and design is locked into Prototype.js? A lot. Cake is based on the idea of convention over configuration. One of those conventions is the use of the Prototype library. When we first started developing this part of the framework, we considered several libraries (including Dojo) and ended up going with Prototype for a number of reasons. Our hesitations about the file size were more or less negated by the fact that the readability of the file itself means (a) you can remove components for specific situations or applications, and (b) it's uncompressed, which means you can compress it. > For a number of reasons I'm using a different Javascript library than > Prototype.js for my httpRequest activity (using the Yahoo! UI lib in > one project and Dojo Toolkit in another, and sometimes it's not > necessary to include an entire library of code, so I have some hand > rolled variations). Fortunately, most JS libs make customization easy. I imagine it'd also be pretty easy to write the necessary header code into Dojo or Yahoo UI yourself. > Maybe time for me to write a DojoHelper. yikes. Anyone else using these > libs? I've heard about a few people, but I don't really know how many. You're certainly more than welcome to write your own library and post it on CakeForge, so that the rest of Cake's Dojo-and/or-Yahoo-UI-using community can help you continue to develop it. In fact, I would sincerely appreciate any efforts to help expand Cake's support for other JavaScript libraries through 3rd party components and helpers. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---