Hi all,

I would like to load my modular in-page "ajax" content loaded via
httpRequest without the layout. But I don't use Prototype.js.

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.

So I have two questions:

1. Does anyone know if there there any other (standard) ways of
detecting an httpRequest load of content?

2. Otherwise, in Cake, what's the best way to serve pages as "bare".
I've tried setting the folowing in my controller

 - $this->params["bare"]=1 (doesn't affect anything, is this read
only?)

 - $this->RequestHandler->setAjax($this); (doesn't work without
Prototype.js, see above)

 - request the url preceded by /bare (works, but not in conjunction
with /admin -seems limited)

- $this->layout="blank"; (an empty layout "blank.thtml" that only
contains <?php echo $content_for_layout; ?> - this works fine)

The last option is fine for me, because it works and I understand it,
and it is effectively what setAjax() would do if it detected my
httpRequest correctly, but I was wondering if this is best practice?

And all this writing has got me thinking... some thoughts....

How much of CakePHP's code and design is locked into Prototype.js? The
use of a generic 'standard' term, ajax, for the helper interfacing with
this specific library is a little confusing, and as I'm discovering,
the Prototype lock-in goes beyond the Ajax helper into the
RequestHandler component. Where else? Surely it would be better to flag
these as 3rd party dependencies, rather than call them by a generic
term? (I would name the AjaxHelper something like PrototypeHelper...)

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

Maybe time for me to write a DojoHelper. yikes. Anyone else using these
libs? 

as I say, just some thoughts.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to