This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

perseus.lonten
perseus.lonten

Hey,

http://kopy.io/G3OYL

i have a problem. i am trying to make a loop for show this information on my frontpage. I have records more than one. I tried to make a loop for that but it doesnt work for twig or i just cant find the true way. Any one help me?

Thanks

Crazymodder
Crazymodder

Hey,

In you link is no twig syntax is normal php. I twig you can build a loop like this

{% for user in users %}
    <li>{{ user.username }}</li>
{% endfor %}
perseus.lonten
perseus.lonten

i actually make sql query on my code page. Your twig code doesnt show my records.

Crazymodder
Crazymodder

Please do a die and dump in your PHP Code an see if there any objects fetched from database. Also you have to pass your object to the page.

$this->page
perseus.lonten
perseus.lonten

http://kopy.io/ZFu6O

When i am doing this. My page working. But my records are more than one. So i need a loop for this. But i cant do it with twig. My database is working .

I use your twig code but it doesnt show anything on my page.

I find a way to make this. I use builder plugin. I just have a problem about it.

{%if record.uyeid == {{ sessionuye }} %}

  • {{ attribute(record, displayColumn) }}
  • {% endif %}

    {{sessionuye }} isnt work.

    Last updated

    Crazymodder
    Crazymodder

    Why you can't do it with twig? Your code is also twig code. Can you post your code?

    Last updated

    perseus.lonten
    perseus.lonten

    Oh i missed your message sorry. I am sharing my all code. At my code part $this['takipci'] is overwriting. I dont want it. I need it turn a array and i wanna use that array in my frontpage in my if conditions.

    Code Part http://kopy.io/ynKNf

    Front Part

    http://kopy.io/uUrNo

    Now this if condition just work for last record. Cause overwriting. I make it a loop. I am working on this like 5 days. I cant find a way :(

    Thanks Crazymodder

    Daniel81
    Daniel81

    You are currently echoing a twig variable within your Twig if statement - instead, just try

    {% if record.uyeid == sessionuye %}
            • {{ attribute(record, displayColumn) }}
    {% endif %}

    no need for the {{ }} wrapped around sessionuye

    Last updated

    1-8 of 8

    You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.