开发者

Skinning different micro-sites based on subdomain

开发者 https://www.devze.com 2023-03-09 01:54 出处:网络
Plone 3.3.4 Version of collective.xdv from http://good-py.appspot.com/release/collective.xdv/1.0?plone=3.3.4
  • Plone 3.3.4
  • Version of collective.xdv from http://good-py.appspot.com/release/collective.xdv/1.0?plone=3.3.4

Summary

Looking for suggestions on how to use xdv to apply different skins to the same site, based on which URL was used in the request.

Text

Requirements

We need several micro-sites, each with its own skin and different from the main site. The micro-sites shall have a subset of the content of the main site. Part of the main site content shall not be visible on the micro-sites, but this can be achieved by simply hiding links to those parts, both from navigation, sitemap, and portlets. It's ok if users find hidden content through URL-hacking. The HTML of micro-sites should be customizable. Each micro-site shall be accessed through a subdomain of the main site. i.e. let the main site be http://site.com, micro-sites will be at http://a.site.com, http://b.site.com, etc.

The client wants to be able to activate a new micro-site with no additional development, just some html, css and image files, and adding a virtualhost to apache config.

Possible Solutions

collective.xdv sounds great, but we have not been able to figure out how to have it pick a different theme.html file based on the URL. Most of the solutions out there seem to focus on creating sub-sites that are based on a subfolder of the Plone site. We do not want to have different content for the microsite, just a different skin (and some content hidden from navigation), so we don't want to create a new folder for each microsite.

A couple ideas we want to try are to a) customize the main template to 开发者_Go百科have it add a different class to the html body for each subdomain, and then use xdv rules that look for that class, and b) to patch the publisher to do something based on subdomain.

Another approach would be to branch collective.xdv to modify its "alternate themes", so it would use the URL to select a theme.

Anything else we might have missed?

Thanks!


You should consider migrating to the last Plone 4.1 release. Using the new and shiny plone.app.theming (only available for Plone > 4.1) you can use theme parameters(consult the documentation here) inside your diazo (the former xdv) rules file like e.g. the $host variable (or whatever custom parameter you may want to set for your usecase - configurable via the plone.app.theming control panel). If you are stuck with Plone3.x/collective.xdv then your best option will be setting headers in your webserver, e.g (Nginx example).

location / {
...
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-XDV "true";
proxy_set_header X-Subsite "sub-a";
}

and accessing these from the request.

0

精彩评论

暂无评论...
验证码 换一张
取 消