silvermax / maxsublayout

在Children循环中为您的页面使用任何布局。非常适合主页,拥有不同的子页面类型。如果子页面是重定向页面,它将使用链接页面的子布局。

此软件包的规范仓库似乎已不存在,因此已冻结此软件包。

安装: 267

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 3

类型:silverstripe-module

dev-master 2016-01-18 07:14 UTC

This package is auto-updated.

Last update: 2024-06-27 03:22:59 UTC


README

在Children循环中为您的子页面使用任何布局(基于子页面类型)。非常适合主页,拥有不同的子页面类型。如果子页面是重定向页面,它将使用链接页面的子布局。

如何使用

<% loop Children %>

$Title

$Sublayout <% end_loop %>

$Sublayout将根据Children的Pagetype生成。

示例

(显示来自PortfolioPage pagetype的3个图像)。您可以将其页面作为直接子页面(PortfolioPage pagetype)或创建为链接到PortfolioPage的重定向页面。$FinalData是链接页面的数据,$Title是重定向页面(子页面)的标题。子布局存储在Sublayout文件夹中,并且必须以"sl_"为前缀。

主题文件:themes/your-theme/Sublayout/sl_PortfolioPage.ss

<div class="Sublayout subpageType-$FinalData.ClassName PortfolioPageLayout">
	<section class="ContentFull">
		<h1>$Title</h1>
		<% if FinalData.AllPortfolios.Limit(3) %>
		<% loop FinalData.AllPortfolios.Limit(3) %>
			<section class="columns four<% if MultipleOf(3) %> lastInRow<% end_if %>">
				<div class="gallery_item">$Image.Thumb2
					<h3>
						<strong>$Description</strong>
						<% if BigImageID %><a class="detail" href="$BigImage.Full.Link">Detail</a><% end_if %>
						<% if Link %><a href="$Link">Navštívi&#357;</a><% end_if %>
					</h3>
					<h2>$Title</h2>
				</div>
			</section>
		<% end_loop %>
	<% else %>
		<p>Momentálne bez projektov</p>
	<% end_if %>
	</section>
	
</div>