Closed brandbrilliance closed 12 years ago
The page object is automatically initialized, if the page=id parameter is sent to the ajax.php. If that is not the case, wouldn't adding that solve the problem?
Ok, I never noticed the pageDetails in ajax.php before. That only cuts out the resolution of the page Object. However it's the templateGroup which is required to render overridden templates.
Without this $objPage->templateGroup setting, you can't override the templates correctly and my contact form uses the standard templates, and I heavily modified them.
Also, you should really then code in the pageId into the ajax request URL automatically, then it's not needed in the AjaxRequest method (which is what I did).
If the global $objPage is available, should the templateGroup be considered automatically?
Nope. the templateGroup variable isn't setup in getPageDetails, that is only added into the $objPage in PageRegular.php. Since ajax never runs PageRegular, it won't be setup and therefore the incorrect templates are used. ONLY when I add this $objPage->templateGroup variable, does it read the correct templates.
PS. I wouldn't have added it if it wasn't necessary ;-)
This should be fixed with the latest version of https://github.com/aschempp/contao-ajax
I have custom form_widget and form_checkbox, etc. templates. AjaxForm doesn't support this, so I had to hack it to add the ability back in, so that my custom templates are used. Since the ajax always knows the page it's on by the content element, you can use that to regenerate the missing information, so the the parent FORM class can work correctly.
Added to
Also I simply copied in the $this->getPageLayout() method from PageRegular, as it's not statically declared.