Back to News & Newsletter Support

gustavo.ar
gustavo.ar

I want iterate in list of news...

How i can give the vars to iterate in my html?

gergo85
gergo85

Please give an example.

gustavo.ar
gustavo.ar

in news.htm now use: ´{% component 'news'%}´ i need use diferent template, in other plugin like Slideshow, these make me a partial in slideshow/default and inside : '{% if SELF.slideshow.slides %} {% for i, slide in SELF.slideshow.slides %}'

gergo85
gergo85

Replace the {% component 'news' %} tag to html content of /components/posts/default.htm. After that you can modify the design of news list.

gustavo.ar
gustavo.ar

Thanks Gergo85, but.. ...try it that way, but it does not work... my file path es \themes\amerip-idc\partials\pages-home\noticias.htm and the content is:

 {# % partial "pages-home/noticias" %# }

  <div class="lt-row row">
  <!-- component 'news' --------------------->

  {# % component 'news'%#}

  {% set posts = __SELF__.posts %}
  {% for post in posts %}

  TITULO: {{ post.title }}

  {%      if loop.first %}          

  {%      endif %}
  {% endfor %}

  <!-- --------------------->
  </div>

Last updated

LukeTowers
LukeTowers

See https://octobercms.com/docs/cms/components#overriding-partials for information on how to override the default partials provided by components. You'll end up with {% component 'news' %} in your page where you want to render the component and your markup for rendering the component in themes/my-theme/partials/news/default.htm

gustavo.ar
gustavo.ar

LukeTowers said:

See https://octobercms.com/docs/cms/components#overriding-partials for information on how to override the default partials provided by components. You'll end up with {% component 'news' %} in your page where you want to render the component and your markup for rendering the component in themes/my-theme/partials/news/default.htm

Thanks LUKE, works!!

1-7 of 7