如何在超链接中使用自定义字段?
有人知道如何将自定义字段链接到 4 段深的页面吗?
<td valign="top" align="center">Hotels:</td>
<td valign="top">{toursRelatedHotels}{title}{/toursRelatedHotels}</td>
我想链接“酒店”字段的 {title}
,但我发现很难做到这一点。
我这样做的方式如下
{toursRelatedHotels}<a href="{title_permalink='destination/{toursRelatedCountries}{url_title}{/toursRelatedCountries}'}">{title}</a>{/toursRelatedHotels}
似乎在链接中看不到国家/地区的 url_title。我还能怎样做呢?
Would anyone know how to link the custom field to a page that lies 4 segments deep?
<td valign="top" align="center">Hotels:</td>
<td valign="top">{toursRelatedHotels}{title}{/toursRelatedHotels}</td>
I would like to link the {title}
of the Hotels field, Im finding it hard to do so.
The way I am doing it is as follows
{toursRelatedHotels}<a href="{title_permalink='destination/{toursRelatedCountries}{url_title}{/toursRelatedCountries}'}">{title}</a>{/toursRelatedHotels}
It seems that the url_title cannot be seen of the country in the link. how else can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通常使用(商业)附加结构构建网站,它允许您在几乎任何地方轻松使用 {page_url} 标记,并避免大量 url 深度问题。
http://buildwithstruct.com/
I usually build sites with the (commercial) add-on Structure, which allows you to easily use a {page_url} tag pretty much anywhere and avoid numerous url depth issues.
http://buildwithstructure.com/
您能给我们提供更多信息,或者包含完整的模板代码吗?您是否正在尝试访问相关条目或父条目的 url_title?
当您尝试显示有关相关条目的信息时,ExpressionEngine 可能有点有趣。通常,最好的办法是将新模板嵌入到相关条目循环中。
{toursRelatedHotels}
{embed="template_group_name/template_name" hotel_id="{entry_id}"}
{/toursRelatedHotels}
请查看此处了解更多信息 - http://expressionengine.com/user_guide/templates/embedding.html
Could you give us a bit more info, or maybe include the full template code? Are you trying to access the url_title of the related entry, or the parent entry?
ExpressionEngine can be a bit funny when you are trying to show information about related entries. Often the best thing to do is to embed a new template inside your related entries loop.
{toursRelatedHotels}
{embed="template_group_name/template_name" hotel_id="{entry_id}"}
{/toursRelatedHotels}
Have a look here for more info - http://expressionengine.com/user_guide/templates/embedding.html