表达式引擎2输出通道字段标题

时间:2012-09-28 14:47:09

标签: php codeigniter expressionengine

您好我在EE2中循环通道并输出所有字段值但是如何输出我在后端标记它的字段标题?

CODE:

<!-- Loop to out put a field called Location -->

{exp:channel:entries channel="vacancies"  disable="pagination|member_data|categories"}
    <p>{vacancy_location}{title}{/vacancy_location}: {vacancy_location}</p>
{/exp:channel:entries}

期望的输出:

<p>Location: Some Location</p>

3 个答案:

答案 0 :(得分:1)

对我来说有用的是安装EE2附带的SafeCracker模块并使用其{label:}标签

http://expressionengine.com/user_guide/modules/safecracker/index.html#label-my-field-name

答案 1 :(得分:0)

你不能..获得它的唯一方法是从数据库中提取它。您可以为该任务编写自定义插件。另一种选择是将字段标签放在全局模板变量中。

编辑:我很快为您创建了插件 - 您可以在https://github.com/Stoep/pi.field_information抓取它,将其放在third_party / field_information /

用法:
{exp:field_information channel =“news”field_name =“news_content”information =“field_label”} {exp:field_information channel =“news”field_name =“news_content”information =“field_instructions”}

答案 2 :(得分:0)

您可以通过SQL查询标记完成此操作,但一般来说,分配给后端字段的标签仅供条目发布/编辑屏幕中使用。输入内容的人员看到的这些字段的标签可能并不总是与您希望向前端网站的访问者公开的标签相同。

就像@stoep提到的那样,如果在模板中编写SQL查询标记不会最终成为一个可行的选项,那么编写自定义插件来处理这个问题可能会更好。