Resolving Theme URLs
From Documentation
This article is out of date, please refer to https://docs.zkoss.org/zk_dev_ref/ for more up to date information.
Themes comprises of stylesheets and images. The URLs for those resources must be resolved once the theme changes.
Several APIs were available to redirect theme resources to the correct location.
ServletFns.encodeThemeURL(String) is for translating image locations inside *.css.dsp files.
ServletFns.resolveThemeURL(String) is for redirecting the retrieval of stylesheets inside a ThemeProvider.
Example Usage (inside *.css.dsp)
tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {
background-image: url(${c:encodeThemeURL('~./zul/img/grid/column-over.png')});
}
Example Usage (inside a ThemeProvider):
...
public String beforeWidgetCSS(Execution exec, String uri) {
if (uri.startsWith("~./zul/css/") ||
uri.startsWith("~./js/zul/")) {
uri = ServletFns.resolveThemeURL(uri);
}
return uri;
}
...