Hello all, 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 > "http://localhost:xxxx/site1" > > 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 <body tal:define=" rootURL request/getApplicationURL; fullURL request/getURL; effURL python: fullURL[len(rootURL)+1:].split('/');"> <span tal:condition="python: len(effURL) > 1"> <span tal:define="global urlPrefix python: effURL" tal:replace="nothing"/> </span> <span tal:condition="python: len(effURL) <= 1"> <span tal:define="global urlPrefix python: ''" tal:replace="nothing"/> </span> ... </body> I prefix all my menu links with the 'urlPrefix' variable. I guess this is not the best solution but it solves my problem. Thanks -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Description: This is a digitally signed message part
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )