Jump to content

{$data['records'][0]['breaking_news']} < What is the new format?


Recommended Posts

I have been trying to pull info from specific articles as for instance the bellow will pull the data from the first article.

It is how the 1x2x2 database template does it for the 1x article.


Sadly this has now changed and I have managed to recreate the 2x2 bit of the article template but I can not seem to find the correct way to pull the same data in the new version of pages.

I know it can be done but I am pulling my hair out trying to figure it out.

If anyone can please help it would be appreciated as it is my final stumbling block


Link to comment
Share on other sites

If you look at the old 1x2x2 template for ip.content it shows the first post using the {$data['records']  [0]  ['article_title']} to pull the latest article name etc,.. Since version 4 this has changed and I can not figure out how to do it. I have tried many variations but nothing seems to work and it is probably something really simple I have not grasped. I have built a rough template for the other posts which are in a {{foreach}} loop and I have them displaying and resizing lovely in both mobile and Desktop views but I am trying to rebuild the 1x article part at the top and unless I know how to pull the specific data then I am stumped.

BTW thanks for sorting out that problem with the pagebuilder templates @Matt it now works flawlessly :)

Link to comment
Share on other sites

Manually loading the first entry and then offsetting the rest sounds a little bit messy.  

I have a similar layout on my 4.0 front page: http://typography.guru

What I did was to simply call a different template for the first record, but keeping the original loop. 

{{foreach $articles as $id => $record}}
{{if ($id == 0)}}
{template="entry" app="cms" location="database" group="article_template_first" params="$record, $database"} 
{template="entry" app="cms" location="database" group="article_template_standard" params="$record, $database"}


Link to comment
Share on other sites

Thanks for the help @opentype it is much appreciated.

I have altered my index template in the pages template editor to the above code you posted.


Then I created the two templates 


I placed the contents of the entry template into the newly created templates and altered the first template around a little as a tester.

I am now getting error EX0 on my front page.

Any help on this is appreciated as this is exactly what I am trying to do :)

Many thanks for your input :)

Link to comment
Share on other sites

Jeeees my stupidity today astounds me, just realised I have been creating the templates in the wrong place lol

It works a treat, I just need to do some messing now to get my bottom articles to display side by side again.

Many thanks.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...