[BlueBream] handling URLs for multiple sites in single bluebream instance
josh at hipro.co.in
Sat Jun 18 13:40:56 EDT 2011
On Fri, 2011-06-17 at 21:59 +0530, Joshua Immanuel wrote:
> Ok, let me give an use-case. Say, I have a base page layout template
> for the inner sites like "http://localhost:xxxx/site1" which has many
> application related menu links on the top and left hand side of the
> page with center space for contents. All these links are of the format
> "/container1/...". When I use virtual hosting to '/site1' I have no
> problem, all the links will be a valid one, as it will be prefixed by
> But, If I don't use virtual hosting and I expose
> "http://localhost:xxxx/" URL to the user to create new sites. The
> links in base page layout template for the inner sites will be an
> invalid one as it will be pointing to
> "http://localhost:xxxx/container1/.." instead
> of "http://localhost:xxxx/site1/container1/.."
> I am trying to figure out how to prefix the links in the base page
> layout template with site names based on which site they belong. So
> that the links in the base page layout template of 'site1' would be of
> the format '/site1/container1/.." and the links in base page layout
> template of 'site2' would be of the format '/site2/container1/.." etc.
> I guess the solution to this (without virtual hosting) would be: when
> I render the base page layout template for
> "http://localhost:xxxx/site1" get the 'site1' part from the request
> URL and prefix all the related menu links with them. Is there any
> other better solution?
> But, If I use this base page layout template as a macro (just to fill
> its center content with an add form say) still the menu links has to
> be a valid one. How to handle this?
I used the following code in the base page layout template to get the
site name from the URL
effURL python: fullURL[len(rootURL)+1:].split('/');">
<span tal:condition="python: len(effURL) > 1">
<span tal:define="global urlPrefix python: effURL"
<span tal:condition="python: len(effURL) <= 1">
<span tal:define="global urlPrefix python: ''"
I prefix all my menu links with the 'urlPrefix' variable. I guess this
is not the best solution but it solves my problem.
HiPro IT Solutions Private Limited
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/bluebream/attachments/20110618/2a8fa30b/attachment.bin
More information about the bluebream