spark_plug icon indicating copy to clipboard operation
spark_plug copied to clipboard

front_end_layout setting does not utilize RequestHandler

Open ReplicaObscura opened this issue 14 years ago • 1 comments

When front_end_layout is set, it overrides RequestHandler's setting of the layout to 'ajax' if it is loaded via an Ajax request.

I could not figure out why all of my /users/ pages had the default layout, even when loaded via an ajax overlay. I turned out it was because I set the front_end_layout setting to 'default'.

How can I utilize the 'default' layout for normal requests, and the 'ajax' layout for ajax requests, without modifying Spark Plug's internal code? That is how the rest of my site works, but I can't figure out how to use the same thing for Spark Plug.

Thanks.

ReplicaObscura avatar Aug 06 '11 02:08 ReplicaObscura

I found a simple way around the issue, in app_controller's beforeFilter:

if ($this->RequestHandler->isAjax) { Configure::write('front_end_layout', 'ajax'); }

(sorry if there are mistakes, just wrote it from memory)

I closed the issue by mistake when I commented--I still think it's something SparkPlug should handle itself, however if this is the intended behavior then the issue can be closed.

Thanks!

ReplicaObscura avatar Aug 06 '11 10:08 ReplicaObscura