1

我正在为我的一个客户项目使用 Concrete5 CMS,但有一个问题(理想情况下)我希望能够以这样一种方式嵌套 HTML 结构,以便内容编辑器能够编辑网站而无需知道或编写任何 HTML。一个示例结构是...

<header class="page-header"><!-- Defined as a GlobalArea -->

    <div class="site-meta"><!-- Defined as a Block Group (Stack?) -->
        <p class="contact-info"><!-- Defined as a Block -->
            <!-- User editable content -->
        </p>
        ....other content...
    </div>

    <div class="branding"><!-- Defined as a Block group -->
        <div class="logo"><!-- Defined as a Block -->
            <!-- User editable content -->
        </div>

        <hgroup><!-- Custom wrapper of sub-blocks -->
            <h1 class="brandname"><!-- Defined as a Block -->
                <!-- User editable content -->
            </h1>

            <h2 class="tagline"><!-- Defined as a Block -->
                <!-- User editable content -->
            </h2>
        </hgroup>
    </div>

    <p class="description"><!-- Defined as a Block -->
        <!-- User editable content -->
    </p>
</header>

如您所见,我需要在定义的内容“区域”(或分组区域)内将单独的用户可编辑内容“块”分组到更大的“元”块中。虽然我的理解是 Concrete5 不能以这种方式运行——即区域不能包含其他区域,块不能包含其他块。

在这种情况下,我想知道如何仅使用原始 php 代码从数据库中手动加载特定的内容块。通过这种方式,我希望能够为给定区域预定义内容块,并希望在 HTML 的特定结构中强制插入块。

感谢人们可以为我提供的任何和所有帮助。

4

2 回答 2

2

具有嵌套区域的上层区域组真的有业务需求吗?这通常由模板处理。例如:

<header class="page-header">

    <div class="site-meta">
        <p class="contact-info">
           <?php
                $a = new Area('Contact Info');
                $a->display($c);
            ?>
        </p>
        <!-- ....other content... -->
    </div>

    <div class="branding">
        <div class="logo">
            <?php
                $a = new Area('Logo');
                $a->display($c);
            ?>
        </div>

        <hgroup>
            <h1 class="brandname">
                <?php
                    $a = new Area('Brand Name');
                    $a->display($c);
                ?>
            </h1>

            <h2 class="tagline">
                <?php
                    $a = new Area('Tag Line');
                    $a->display($c);
                ?>
            </h2>
        </hgroup>
    </div>

    <p class="description">
        <?php
            $a = new Area('Description');
            $a->display($c);
        ?>
    </p>
</header>
于 2012-10-31T23:11:38.343 回答
2

看看免费的 Designer Content 插件......您可以创建嵌入了标记的自定义块。这将为您提供您要创建的标记的大部分方法。如有必要,您可以使用它创建的块代码并更精确地自定义您的自定义块。

http://www.concrete5.org/marketplace/addons/designer-content/

于 2012-10-30T21:27:51.800 回答