【问题标题】:Expression Engine 2 Output Channel Field Title表达式引擎 2 输出通道字段标题
【发布时间】:2012-09-28 14:47:09
【问题描述】:

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

代码:

<!-- 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>

【问题讨论】:

    标签: php codeigniter expressionengine


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

      就像@stoep 提到的那样,如果在您的模板中编写 SQL 查询标签最终不是一个可行的选择,您可能会更幸运地编写一个自定义插件来处理这个问题。

      【讨论】:

        【解决方案3】:

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

        编辑:我很快为你创建了插件——你可以在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"}

        【讨论】:

          猜你喜欢
          • 2012-08-03
          • 2012-03-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-07-14
          • 1970-01-01
          • 2011-08-05
          • 2011-11-02
          相关资源
          最近更新 更多