-
-
Notifications
You must be signed in to change notification settings - Fork 176
Document how to disable diazo for ajax requests and completly. #1961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.0
Are you sure you want to change the base?
Changes from all commits
42fbf47
45516d9
a67ec8a
5d44cae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -176,3 +176,44 @@ For instance, you may need to put together the main menu, the language change, a | |||||||||||||||||
Sometimes it is easier to override the corresponding template in Plone, build the new HTML structure there, and replace one thing in the {file}`rules.xml` file than trying to write complex Diazo rules or writing XSLT. | ||||||||||||||||||
|
||||||||||||||||||
The size of the {file}`rules.xml` file and the number of rules it contains can negatively impact the performance of your site. | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
### Disable Diazo for AJAX requests | ||||||||||||||||||
|
||||||||||||||||||
When sending an AJAX request to normal browser views in Plone, Plone will respond with an HTML page which normally is also transformed via the Diazo theming engine. | ||||||||||||||||||
In some cases this is an unnecessary overhead, if you only want to inject a small snippet of HTML into the page. | ||||||||||||||||||
|
||||||||||||||||||
To prevent this transformation, disable AJAX requests for Diazo themes by using the `ajax_load` HTTP request parameter. | ||||||||||||||||||
`ajax_load` is used in Plone to indicate AJAX requests. | ||||||||||||||||||
When added to the query string, `ajax_load=1` disables a full page rendering, whereas `ajax_load=0` enables it. | ||||||||||||||||||
|
||||||||||||||||||
````{versionadded} plonetheme.barceloneta 3.3.0 | ||||||||||||||||||
In Plone's standard theme plonetheme.barceloneta 3.3.0 the `ajax_load` theme parameter to disable Diazo was added. | ||||||||||||||||||
If you use this theme, the next steps are obsolete. | ||||||||||||||||||
```` | ||||||||||||||||||
Comment on lines
+190
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thet I'd say everyone uses this theme in Classic UI, so let's qualify it with the version number. I think this revision is correct, but please verify. Thank you! |
||||||||||||||||||
|
||||||||||||||||||
Manually add the HTTP request parameter and its value as follows. | ||||||||||||||||||
|
||||||||||||||||||
Add a theme parameter to your {file}`manifest.cfg` file. | ||||||||||||||||||
|
||||||||||||||||||
```cfg | ||||||||||||||||||
[theme:parameters] | ||||||||||||||||||
ajax_load = python:request.get('ajax_load') | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
Then disable Diazo for AJAX requests in your {file}`rules.xml` file. | ||||||||||||||||||
|
||||||||||||||||||
```xml | ||||||||||||||||||
<notheme if="$ajax_load" /><!-- don't theme ajax requests --> | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
Choose any method to load this change in your theme. | ||||||||||||||||||
|
||||||||||||||||||
- Restart your instance. | ||||||||||||||||||
- In the {guilabel}`Theming` control panel, select another theme, then switch back to your own theme. | ||||||||||||||||||
- For a programmatical way, see [(Re)Introduce the ajax_load theme parameter and skip diazo theming, if set. `plone/plonetheme.barceloneta` #404](https://github.com/plone/plonetheme.barceloneta/pull/404). | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
### Completely disable Diazo | ||||||||||||||||||
|
||||||||||||||||||
You can fully disable Diazo and plone.app.theming based themes by setting the `plone.app.theming.interfaces.IThemeSettings.enabled` registry entry to `False`. | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.