如何添加 Plone

内的标签元素

发布于 2024-10-23 15:00:59 字数 452 浏览 2 评论 0原文

我想更改标准的页面顶部元素,以便可以设置它的样式。

<h1 class="documentFirstHeading">My Heading</h1>

是 Plone 将此元素放置在每个页面上的方式。我想添加一个,以便该行显示:

<h1 class="documentFirstHeading"><span>My Heading</span></h1>

很明显,此代码是由宏生成的 - 但我不知道如何生成 修改宏以添加我的跨度标签。有人可以指点我吗 适当的Plone文件要修改吗?这会设置一个通用的 CSS 图像 替换技术,其他 Plone 站点经常使用它,正如我所看到的 在其他 Plone 网站上,span 标签正好位于我需要的位置。

TIA 为您提供专业知识!

I want to change the standard top of page element so that I can style it.

<h1 class="documentFirstHeading">My Heading</h1>

is the way Plone places this element on each page. I want to add a so that the line reads:

<h1 class="documentFirstHeading"><span>My Heading</span></h1>

It's obvious that this code is generated by a macro - but I have no idea how
to modify the macro to add my span tags. Can someone point me to the
appropriate Plone file to modify? This sets up a common CSS image
replacement technique, and other Plone sites frequently use it, as I see the
span tags exactly where I need them to be, on other Plone sites.

TIA for your expertise!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

青衫负雪 2024-10-30 15:00:59

这并不重要(操作几乎相同),但我假设您正在创建主题包。我还假设您使用的是 Plone 4.0 或更高版本。操作如下:

  • 将位于 *Products.CMFPlone/Products/CMFPlone/skins/plone_kss* 中的 *kss_generic_macro.pt* 文件复制到主题的 *skins/your_templates_folder* 中。通俗地说,这称为“根据您的主题自定义模板”。
  • 在第20行(不同Plone版本行号可能不同),你会找到你需要的块:

    title

要获得 h1 内的跨度,请替换 tal:replace在上面的代码片段中添加到 tal:content

您可能需要重新启动 Plone 站点才能看到所做的更改。检查你的 h1 — 它应该包含你需要的跨度。

重要说明!上面的操作将为您提供每个没有特定模板的通用视图,覆盖 .对于这些情况,您将需要自定义这些特定模板。

it doesn't really matter (the actions are pretty much the same), but I assume you are creating the theme package. I also assume you're on Plone 4.0 or newer. The actions are:

  • Copy over *kss_generic_macro.pt* file, located in *Products.CMFPlone/Products/CMFPlone/skins/plone_kss* to your theme's *skins/your_templates_folder*. In generic terms this is called "customize the template to your theme".
  • On line 20 (line number might differ in different Plone versions), you will find the block you need:

    title

To get the span within your h1, replace tal:replace in the snippet above to tal:content.

You might need to restart your Plone site in order to see your change in action. Check your h1 — it should contain the span you need.

Important note! Actions above will give you within for every generic view that doesn't have specific template, overriding . For those cases you will need to customize those particular templates.

笔芯 2024-10-30 15:00:59

我不是 100% 确定(欢迎编辑 :-D),而且我也不确定您想要什么,但我认为您需要自定义页面视图模板。

在 Plone 3.x 中,模板是 /portal_skins/plone_content/document_view 模板,您可能需要更改

    <h1 class="documentFirstHeading"> 
        <metal:field use-macro="python:here.widget('title', mode='view')">
        Title
        </metal:field>
    </h1>

    <h1 class="documentFirstHeading"> 
        <span>
        <metal:field use-macro="python:here.widget('title', mode='view')">
        Title
        </metal:field>
        </span>
    </h1>

在 Plone 4 和 4.1 中,关键模板是 Portal_skins/plone_kss/kss_generic_macros。查找:

      <span metal:define-slot="inside" 
            tal:replace="context/Title">title</span>

并将“替换”更改为“内容”。

I am not 100% sure (edits welcome :-D), and I am not sure about what you want with that either, but I think you will need to customize the Page view template.

In Plone 3.x, the template is the /portal_skins/plone_content/document_view template, and you probably will want to change

    <h1 class="documentFirstHeading"> 
        <metal:field use-macro="python:here.widget('title', mode='view')">
        Title
        </metal:field>
    </h1>

to

    <h1 class="documentFirstHeading"> 
        <span>
        <metal:field use-macro="python:here.widget('title', mode='view')">
        Title
        </metal:field>
        </span>
    </h1>

In Plone 4 and 4.1, the key template is portal_skins/plone_kss/kss_generic_macros. Look for:

      <span metal:define-slot="inside" 
            tal:replace="context/Title">title</span>

and change the "replace" to "content".

尘曦 2024-10-30 15:00:59

在为您做了一些研究之后,我发现您正在寻找的宏位于“/portal_skins/plone_kss/kss_generic_macros/”,特别是您正在寻找“generic_title_view 宏”。

如果您想知道我是如何得到这个的,我首先查看了 main_template.pt 文件并看到:

<metal:title define-slot="content-title">                              
    <metal:comment tal:content="nothing">
        If you write a custom title always use 
        <h1 class="documentFirstHeading"></h1> for it
    </metal:comment>
    <h1 metal:use-macro="context/kss_generic_macros/macros/generic_title_view">              
       Generic KSS Title. Is rendered with class="documentFirstHeading".                    
    </h1>                                                                                    
</metal:title>

从那里我只是在皮肤中寻找 kss,希望这就是您正在寻找的东西。

after doing some poking around for you I was able to figure out that the macro you're looking for is located at '/portal_skins/plone_kss/kss_generic_macros/' specifically you're looking for the 'generic_title_view macro'.

If you're wondering how I got this, I looked first at the main_template.pt file and saw:

<metal:title define-slot="content-title">                              
    <metal:comment tal:content="nothing">
        If you write a custom title always use 
        <h1 class="documentFirstHeading"></h1> for it
    </metal:comment>
    <h1 metal:use-macro="context/kss_generic_macros/macros/generic_title_view">              
       Generic KSS Title. Is rendered with class="documentFirstHeading".                    
    </h1>                                                                                    
</metal:title>

and from there I just poked around in the skins looking for kss, Hopefully this was what you were looking for.

金兰素衣 2024-10-30 15:00:59

感谢 spliter,我现在已经完成了部分页面的样式。正如他提到的,这些更改还影响了所有没有特定模板覆盖的通用视图。我猜测这些是诸如详细信息视图之类的东西,当单击给定部分下的特定文章的链接时会出现该视图。

因此,尽管我的部分页面按预期显示,但当我单击一篇文章时,会发生以下情况:

如果我将跨度标记之间的文本设置为显示:无,则该行为根本不会反映在详细信息页面中,因为跨度不适用于详细信息页面的 h1 标签内。

但是,由于我在“部分”页面上为 h1 元素设置特定的背景图像,因此该背景图像确实出现在详细信息页面 h1 上。

如何覆盖我的详细信息页面的该行为? - 也就是说,我不想在详细信息页面 h1 元素上显示背景图像。我需要能够分别处理“部分”和“详细信息”页面上的 h1 元素。

抱歉我在这里缺乏经验,但是习惯 Plone 的工作方式似乎很耗时,至少对我来说是这样。

Thanks to spliter, I now have the styling for the Section pages done. As he mentioned, the changes also affected all generic views that don't have specific template overrides. I am guessing that these are things like the Detail view, which is what comes up when one clicks on alink to a particular article under a given Section.

So, although my Section pages display as intended, when I click on an article, this is what happens:

If I set the text between span tags to display:none, that behavior is NOT reflected in the detail pages at all, as the span is not applied inside the h1 tags on detail pages.

BUT, since I am setting particular background images for the h1 elements on the Section page, that background image DOES appear on the detail page h1's.

How do I override that behavior for my detail pages? - that is, I DON'T want background images on detail page h1 elements. I need to be able to address h1 elements on Section and Detail pages separately.

Sorry for my lack of experience here, but getting used to the way Plone works seems to be time-cosuming, at least for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文