{"action":"opened","issue":{"url":"https://api.github.com/repos/osalabs/osafw-php/issues/27","repository_url":"https://api.github.com/repos/osalabs/osafw-php","labels_url":"https://api.github.com/repos/osalabs/osafw-php/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/osalabs/osafw-php/issues/27/comments","events_url":"https://api.github.com/repos/osalabs/osafw-php/issues/27/events","html_url":"https://github.com/osalabs/osafw-php/issues/27","id":294365614,"number":27,"title":"Best practice: PJAX and $ps['_layout']","user":{"login":"vladsavchuk","id":35847544,"avatar_url":"https://avatars2.githubusercontent.com/u/35847544?v=4","gravatar_id":"","url":"https://api.github.com/users/vladsavchuk","html_url":"https://github.com/vladsavchuk","followers_url":"https://api.github.com/users/vladsavchuk/followers","following_url":"https://api.github.com/users/vladsavchuk/following{/other_user}","gists_url":"https://api.github.com/users/vladsavchuk/gists{/gist_id}","starred_url":"https://api.github.com/users/vladsavchuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladsavchuk/subscriptions","organizations_url":"https://api.github.com/users/vladsavchuk/orgs","repos_url":"https://api.github.com/users/vladsavchuk/repos","events_url":"https://api.github.com/users/vladsavchuk/events{/privacy}","received_events_url":"https://api.github.com/users/vladsavchuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-05T11:49:00Z","updated_at":"2018-02-05T11:49:00Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"1. Should I use the `$ps['_layout']` to override the default layout?\r\n2. Is `$ps['_layout']` undocumented feature or hack? \r\n3. Perhaps it'd be better to use some FW prefix for such kind of overrides, like `$ps['_fw_layout']`.\r\n\r\n### Use Case\r\n\r\nI have an AJAX-request to get a list of `<option>`s for the `<select>`ed value. \r\nI don't want to use default `layout_pjax.html` because of extra `<script>` block and the content of `<~main> is escaped by default.\r\n\r\nSo, I've created `/site/layout_pjax_nojs_noescape.html` with the following content:\r\n```\r\n<~main noescape>\r\n```\r\nAnd then in the Controller:\r\n\r\n````php\r\npublic function getSelectOptionsAction() {\r\n    $ps = array(\r\n        '_layout' => '/site/layout_pjax_nojs_noescape.html',\r\n        'main' => $this->model->getSelectOptions(reqs('parent_id'))\r\n    );\r\n\r\n    return $ps;\r\n}\r\n````\r\nOr should I just simply do:\r\n\r\n````php\r\nfunction getSelectOptionsAction() {\r\n    echo $this->model->getSelectOptions(reqs('parent_id'));\r\n}\r\n````\r\n"}}
{"actor":{"display_login":"vladsavchuk"}}