One way to do it is in your AppController::beforeFilter() set a view
var like $this->set('isAjax', $this->RequestHandler->isAjax()); Then
in your layout file (or view file) add if(!$isAjax) { echo .... }

GB

On Sep 4, 4:48 am, eagerterrier <[email protected]> wrote:
> Hi
>
> I have a problem that I just can't get my head around, and wonder if
> anyone can help.
>
> In my app, I have a series of normal pages that have google analytics
> in footer. I then have hundreds of ajax calls that are either rendered
> views, or simply echoed PHP statements in controllers.
>
> What I want is an easy (lazy?) way of adding google analytics to all
> of these myriad scripts in one go.
>
> I thought putting something in the app_controller like this would
> work,
>
> [code]
> if($this->layout=='ajax'||$this->RequestHandler->isAjax()){
>   Configure::write('debug',0);
>   $this->render('/elements/google_analytics');}
>
> [/code]
>
> However, this is obviously bad and doesn't work.
>
> I could just either echo the include file path contents using regular
> PHP, but it doesn't feel very Cakey.
>
> Is there an elegant way to do this?
>
> Many thanks
>
> TC
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to