我正在为我新安装的Mura创建一些自定义页面布局(我是Mura新手,但我们在工作中使用它,所以我在学习,因为我go),但我需要对页面正文提供一些帮助。遵循Mura附带的默认布局,以下代码输出页面正文:
#$.dspBody(
body=$.content('body')
, pageTitle=pageTitle
, crumbList=0
, showMetaImage=0
)#
当为页面指定了关联图像时,如果我有页面索引(例如文件夹),则会显示此图像,这很棒。但是,当您查看页面本身时,它也会出现在正文的顶部。
查看上面的代码,是否有其他属性我可以放在那里删除相关的图像?如果是这样,我的可用房产有哪些?我似乎无法在Mura网站上找到关于这段代码的任何文档。
根据要求,有问题的布局的整个代码
<cfoutput>
<cfinclude template="inc/html_head.cfm" />
<body id="#$.getTopID()#" class="depth-#$.content('depth')# #$.createCSSHook($.content('menuTitle'))#">
<div class="coverImageWrapper">
<div class="coverImage">
<cfinclude template="inc/header.cfm" />
<cfinclude template="inc/departmentName_socialMedia.cfm" />
<cfinclude template="inc/topNav.cfm" />
</div>
</div>
<div class="secondaryPageWrapper">
<div class="container">
<div class="row">
<div class="col-md-8 mainCol">
<cfinclude template="inc/breadcrumb.cfm" />
<cfset pageTitle = $.content('type') neq 'Page' ? $.content('title') : ''>
#$.dspObjects(2)#
#$.dspBody(
body=$.content('body')
, pageTitle=pageTitle
, crumbList=0
, showMetaImage=0
)#
</div>
<aside class="col-md-4 sideCol">
#$.dspObjects(3)#
</aside>
</div>
</div>
</div>
<cfinclude template="inc/department_footer.cfm" />
<cfinclude template="inc/footer.cfm" />
<cfinclude template="inc/html_foot.cfm" />
</body>
</cfoutput>
答案 0 :(得分:3)
@JesseEarley,
首先,请在http://docs.getmura.com/v7/theme-developers/查看我们的在线主题开发人员指南。我相信你会发现它很有用。
至于您的相关图片问题,如果您使用的是最新版本的Mura,并使用默认主题MuraBootstrap3,那么您将找到一个标有cout
的目录。在那里,您应该会看到标有content-types
的另一个目录,其中包含标有page
的文件。这个文件是控制身体视图的。在该文件中,有一段代码专门用于输出相关图像:
index.cfm
如果您愿意,可以在此处输入您的自定义逻辑,或完全删除它。
<强>澄清强>
对 <!--- Primary Associated Image --->
<cfif $.content().hasImage(usePlaceholder=false)>
<cfscript>
img = $.content().getImageURL(
size = 'carouselimage' // small, medium, large, custom, or any other pre-defined image size
,complete = false // set to true to include the entire URL, not just the absolute path (default)
);
</cfscript>
<div class="mura-asset">
<a class="mura-meta-image-link" href="#$.content().getImageURL()#" title="#esapiEncode('html_attr', $.content('title'))#" rel="shadowbox[body]">
<img class-"mura-meta-image carouselimage" src="#img#" alt="#esapiEncode('html_attr', $.content('title'))#">
</a>
</div>
</cfif>
<!--- /Primary Associated Image --->
的调用会触发$.dspBody()
下的方法。在该方法中,Mura将查看您是否有任何覆盖指定内容类型的呈现(例如,requirements.mura.content.contentRenderer.cfc:dspBody()
,Page
,Folder
等),并且有一个覆盖输出的方法数。例如,在你的主题Calendar
中你可以有一个名为eventHandler.cfc
的方法,如果它返回一个字符串,那么将使用该字符串。以类似的方式,Mura将扫描主题中的特定目录,例如onPageDefaultBodyRender()
,如果找到,则会扫描content_types
等内容类型,然后使用page
作为渲染的身体。这正是在这种情况下发生的事情。
正如我在下面的笔记中所述,我目前正在编写文档,并且将以更清晰,更有希望更清晰的格式提供此信息。目前,您可能希望在http://docs.getmura.com/v7/videos/webinars/super-fast-app-dev-with-mura-7/查看我的演示文稿,以便在我编写新文档时快速了解其中一些内容。
此外,您也可以暂时删除index.cfm
目录,或将其重命名为其他目录,以查看content_types
如何在不覆盖的情况下呈现您的内容。
干杯, 史蒂夫