Search code examples
phplayoutviewfragmentlithium

Lithium PHP: Open view without layout


I am using the PHP framework Lithium (aka li3). I want to be able to open just a view (ie without a layout) in a jquery dialog box. Ideally, I would like this to be done with a small modification to the URL, for example:

Normal path to action: http://localhost/controller/action/ 

View only path to action: http://localhost/controller/action/view_only/

This obviously still has to work with normal URL parameters and GET requests. Additionally, I would love not to have to change any existing controllers.

Does anybody know how I could achieve this?

Thanks, Max.


Solution

  • // In the controller:
    
    if ($someCondition) {
        $this->_render['layout'] = false;
    }
    // ...where $someCondition is based on whatever URL modification you do