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.
> >
> > > 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
>
>
>  >
>
>


-- 
- - - - - - - -
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to