技术重要还是业务重要_重要主题

技术重要还是业务重要

For some themed location /foo/bar, you want “bar” and everything below it to look different than “foo”.

对于某些主题位置/ foo / bar,您希望“ bar”及其下面的所有内容看起来都不同于“ foo”。

I had to do a bit of placeful theming lately and I thought I would share the techniques I used (thanks davisagli, jonbaldievieso, vedawms). Let’s say you have a Plone 3 site, and for some location /foo/bar/baz, you want ‘baz’ and everything below it to look different. I made this change through the web because I was in a hurry, but the same can be done in filesystem code.

最近我不得不做一些有意义的主题设计,我想我会分享我使用的技术(感谢davisagli,jonbaldievieso和vedawms)。 假设您有一个Plone 3网站,对于/ foo / bar / baz的某个位置,您希望“ baz”及其下面的所有内容看起来都不同。 我急着通过网络进行了更改,但是在文件系统代码中也可以这样做。

The steps are:

这些步骤是:

1.覆盖getSectionFromURL(导航到portal_skins / plone_scripts / getSectionFromURL并进行自定义) (1. Override getSectionFromURL (navigate to portal_skins/plone_scripts/getSectionFromURL and customize))

Normally, this bit of code returns the section id for whatever section you are in. So if your site has three top level folders A, B, C, getSectionURL returns section-A when you are inside of A, section-B when you are inside of B, and so on. However, when you are inside of a sub-section, e.g. /A/news-items-folder, it *still* returns the section id, in this case section-A. The override makes getSectionURL return the sub-section, e.g. /A/news-items-folder, or /foo/bar/baz.

通常,这段代码返回您所在区域的部分ID。因此,如果您的站点有三个顶级文件夹A,B,C,则当您位于A内时,getSectionURL返回A区域;当您位于B内时,SectionURL返回B区域。在B里面,依此类推。 但是,当您位于小节(例如/ A / news-items-folder)内时,它* still *会返回小节ID,在本例中为A节。 重写使getSectionURL返回子节,例如/ A / news-items-folder或/ foo / bar / baz。

 # Courtesy of jonb at onenw.org
# Courtesy of jonb at onenw.org
# getSectionFromURLcontentPath = context.portal_url.getRelativeContentPath(context)
# getSectionFromURLcontentPath = context.portal_url.getRelativeContentPath(context)
if if not not contentPathcontentPath :
    :
    return return None
None
elseelse :
    :
    s s = = ''
    ''
    sectionId sectionId = = ''
    ''
    for for pathItem pathItem in in contentPathcontentPath :
        :
        sectionId sectionId += += pathItem pathItem + + '-'
        '-'
        s s += += 'section-' 'section-' + + sectionIdsectionId [:[: -- 11 ] ] + + ' '
        ' '
        return return ss [:[: -- 11 ]
]

2.覆盖plone.logo(导航到/portal_view_customizations/zope.interface.interface-plone.logo并进行自定义) (2. Override plone.logo (navigate to /portal_view_customizations/zope.interface.interface-plone.logo and customize))

For some reason (good or not, I don’t know) Plone includes an image tag in the html code it uses to generate the Plone logo. This means that it will always output something like:

由于某种原因(无论好坏,我都不知道),Plone在用于生成Plone徽标的html代码中包含一个图像标签。 这意味着它将始终输出如下内容:

which is a problem if you want to placefully replace the logo because there is no easy way to do it (perhaps you could use some trick to return a different image file with the same file name).

如果您想替换掉徽标,这是一个问题,因为没有简单的方法可以这样做(也许您可以使用一些技巧来返回具有相同文件名的其他图像文件)。

Plone ships with:

Plone随附:

<a metal:define-macro="portal_logo" id="portal-logo" accesskey="1" tal:attributes="href view/navigation_root_url" i18n:domain="plone">
    <img src="logo.jpg" alt="" tal:replace="structure view/logo_tag" /></a>
<a metal:define-macro="portal_logo" id="portal-logo" accesskey="1" tal:attributes="href view/navigation_root_url" i18n:domain="plone">
    <img src="logo.jpg" alt="" tal:replace="structure view/logo_tag" /></a>

Replace that with:

替换为:

3.添加CSS(导航到/portal_skins/plone_styles/ploneCustom.css并进行自定义) (3. Add CSS (Navigate to /portal_skins/plone_styles/ploneCustom.css and customize))

Next, add in some CSS to make use of the previous two changes:

接下来,添加一些CSS以利用前两个更改:

body.section-foo-bar-baz { background-image: url(gradient.png);}.section-foo-bar-baz
#portal-globalnav li a { border: 0px; background: #0066CC; color: white; font-size: 110%; font-face: bold;}.section-foo-bar-baz
#portal-globalnav { background: #0066CC; padding: 0.25em;}.section-foo-bar-baz
#portal-breadcrumbs,.section-foo-bar-baz #portal-personaltools { background: white;}.section-foo-bar-baz
#portal-top { background: white;}.section-foo-bar-baz
#portal-logo { margin: 1em; background-image: url(ama_logo.gif); background-repeat: no-repeat;}.section-foo-bar-baz
#visual-portal-wrapper { background: white; margin: auto; width: 883px; position: relative;}.section-foo-bar-baz
body { background-image: url(gradient.png); background-repeat: repeat;}
#portal-logo { margin: 1em; background-image: url(logo.jpg); background-repeat: no-repeat;}
#portal-logo a { display: block; width: 650px; height: 80px;}
body.section-foo-bar-baz { background-image: url(gradient.png);}.section-foo-bar-baz
#portal-globalnav li a { border: 0px; background: #0066CC; color: white; font-size: 110%; font-face: bold;}.section-foo-bar-baz
#portal-globalnav { background: #0066CC; padding: 0.25em;}.section-foo-bar-baz
#portal-breadcrumbs,.section-foo-bar-baz #portal-personaltools { background: white;}.section-foo-bar-baz
#portal-top { background: white;}.section-foo-bar-baz
#portal-logo { margin: 1em; background-image: url(ama_logo.gif); background-repeat: no-repeat;}.section-foo-bar-baz
#visual-portal-wrapper { background: white; margin: auto; width: 883px; position: relative;}.section-foo-bar-baz
body { background-image: url(gradient.png); background-repeat: repeat;}
#portal-logo { margin: 1em; background-image: url(logo.jpg); background-repeat: no-repeat;}
#portal-logo a { display: block; width: 650px; height: 80px;}

I hope this helps someone get started with placeful theming.

我希望这可以帮助某人开始进行场所主题化。

翻译自: https://www.pybloggers.com/2008/06/placeful-theming/

技术重要还是业务重要

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值