expressionegine 矩阵插件检查字段是否为空

发布于 2025-01-01 08:28:07 字数 276 浏览 3 评论 0原文

我有一个包含几列的矩阵字段。当用户提交表单时,我只想显示用户输入的列字段。

如何检查矩阵字段是否为空?

只是为了澄清我正在谈论表达式引擎的矩阵扩展。

例如,这对我不起作用,因为该行可以提交为空:

{if "{exercise_set1:total_rows}" >= 1}
{exercise_set1:table cellspacing="0" cellpadding="0" class="format_head"}
{/if}

I have a matrix field with several columns. When user submits the form I want to display only column fields user entered.

How can I check if matrix field is empty?

Just to clarify I'm talking about expressionengine's Matrix extension.

For example this wont work for me since the row can be submitted empty:

{if "{exercise_set1:total_rows}" >= 1}
{exercise_set1:table cellspacing="0" cellpadding="0" class="format_head"}
{/if}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我纯我任性 2025-01-08 08:28:07

要检查是否有任何行填充,

   {if your_matrixfield:total_rows>0}
        {your_matrixfield}
            Do your thing
        {/your_matrixfield}
    {/if}

我遇到了一个问题,用户可以将文件附加到条目,但是当没有附加文件时,不会生成图库

To check if there are any rows filled use

   {if your_matrixfield:total_rows>0}
        {your_matrixfield}
            Do your thing
        {/your_matrixfield}
    {/if}

I had the problem that users could attachs files to an entry but when no files were attached do not generate the Gallery

流心雨 2025-01-08 08:28:07

您只是想检查是否设置了任何内容?

{matrix_tagpair}
   {if column_var}{column_var}{/if} 
   OR
   {if column_var != ""}{column_var}{/if}
{/matrix_tagpair}

You just want to check to see if anything is set?

{matrix_tagpair}
   {if column_var}{column_var}{/if} 
   OR
   {if column_var != ""}{column_var}{/if}
{/matrix_tagpair}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文