使用sheadawson Silverstripe块模块在块中使用2个图像?

时间:2016-02-10 03:53:54

标签: silverstripe

我正在使用sheadawson / silverstripe-blocks模块:https://github.com/sheadawson/silverstripe-blocks

我想拥有它,以便用户可以将2x图像添加到块中。由于某种原因,它只会通过第一张图像。

根据屏幕截图明确上传两者:

enter image description here

TwoImagesLeftTextRightBlock.php

<?php

class TwoImagesLeftTextRightBlock extends Block {

    private static $db = array(
        'Title' => 'Varchar(255)',
        'Summary' => 'HTMLText',
    );

    private static $has_one = array(
        'Image' => 'Image',
        'SecondImage' => 'Image'
    );

}

块的模板:

<div class="container-fluid">
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1 ptb50">
                <div class="col-md-8">
                    <div class="block-right-title">$Title</div>
                    <div class="block-left-text">
                        $Summary
                    </div>
                </div>
                <div class="col-md-4">
                    <img class="block-icon" src="$Image.URL" alt="">
                    <img class="block-icon" src="$SecondImage.URL" alt="">
                </div>
            </div>
        </div>
    </div>
</div>

检查您可以看到的代码只能浏览第一张图片......有关如何使两者都工作的任何想法?

enter image description here

0 个答案:

没有答案