質問

I have two static html files, one is a design for a homepage, the other is a design for a regular page.

I have a rules to determine which one to use, like this:

<rules css:if-content="body.section-front-page">
    <theme href="home.html" />
</rules>

<rules css:if-not-content="body.section-front-page"
       css:if-content=".portaltype-document">
    <theme href="index.html" />
</rules>

Though I am realizing now that these two pages have common elements, such as the header. Is there a way to use the header from one page or something, that means if I make changes to the htmlt, it only needs to be done in one place? Another way of asking, can you mix together design files?

役に立ちましたか?

解決

You would need to have just the one theme file to do that.

If you design the theme file properly and you do have common elements between the home page and the other site page templates this should be quite possible.

I guess the design is key here... the following site uses one theme file but has a very different home page using rules similar to your css:if-content="body.section-front-page" to determine not to show the left and right columns for example.

http://www.lotterywest.wa.gov.au/

他のヒント

This is not possible.

Diazo (version 1.0.4-py2.7) simply loads the theme file (see diazo.rules.expand_theme(element, theme_doc, absolute_prefix)). The loaded file must have a etree.parse()able format and AFIK there are no "rules" to embed or include further files or code.

I've been trying to find a workaround with no success until now. My alternative idea was to include the common code as a replace rule and then apply the other rules. E.g. have a given id in your theme-file and expanding it with a diazo rule. This works only if you do not need to expand your code (see my question https://stackoverflow.com/q/21703070/1659599).

If you only nedd to add html text without further replacements then you could add this by a rule.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top