Welcome Guest, Not a member yet? Register   Sign In
Why View Parser Filter not working on Loop Substitutions ?
#1

Hi, i try to make template with view parser ci4

in my case, i have data example like this :
Code:
$data=['blog_entries' => [
                   ['post' => '2020-02-02']
];
 
and i want to change date format to 'd-m-Y' using filter view parser

 
Code:
{blog_entries}
        <div>{post|date(d-m-Y)}</div>
{/blog_entries}

But it doesnt work
Reply
#2

Your missing the quotes on the date.

Code:
{blog_entries}
        <div>{post|date('d-m-Y')}</div>
{/blog_entries}

Try that if it doe's not work then something else is wrong, hard to tell without see more of the code.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(07-12-2020, 08:20 AM)InsiteFX Wrote: Your missing the quotes on the date.

Code:
{blog_entries}
        <div>{post|date('d-m-Y')}</div>
{/blog_entries}

Try that if it doe's not work then something else is wrong, hard to tell without see more of the code.
I am just starting to try CI4 and I ran into the same problem. And - no, the problem is not with the quotes, the same filter works fine without quotes if out of the loop. And the loop works fine if the date filter is not applied on the date.
Reply
#4

got same problem
Reply
#5

I'm having the same issue.
I have a value inside an array so when I'm trying to use filter, Parser shows the "brute code". This happens when I call filters with parameters, like number_format.
Code:
{array}
  {subarray}
      {value|number_format(3)}
  {/subarray}
{/array}

This doesn't work. Will show same code on the view.


On the other hand if I use "abs", works with no problem.
Code:
{array}
  {subarray}
      {value|abs}
  {/subarray}
{/array}
Shows as expected and getting transformed data.


Any ideas why is this happening?????
Reply
#6

Follow the instructions posted here: https://github.com/codeigniter4/CodeIgni...ssues/5825
Works for me on CI 4.2.0
Reply




Theme © iAndrew 2016 - Forum software by © MyBB