wheelmaker24 Posted February 13, 2016 Share Posted February 13, 2016 Hi guys, I'm currently designing the backend fields of a new intranet publishing platform and I think that there's still some improvement possible. Like I know you, you probably have some great ideas for my issue To explain the structure in the frontend: The starting page is divided in three horizontal sections with each section having cards in them (the first section having 8 cards, sections 2 and 3 each having 3 cards). Normally the first section should display the latest news, the second section should display social media postings and the third section should display news from a specific category. My current approach: I've created a "page-sections" template for my starting page, which has three "section" templates as children. For each section I've defined a field "Standard selectors" with content like template=news, sort=-date Now the tricky part: It should be easily possible to define some "sticky" cards in each section. For example in the first section the third card should be an important news, the fifth card likewise and the seventh card should be a promotion card. So what I was trying to do is adding a "page" field to my section template like the following: As you can see I've added 8 pages (resembling the 8 cards for the first section) where pages 3, 5 and 7 are specifically selected items and the others are just an empty page named "Standard-Kachel" (meaning "standard card"). This standard card field should be filled out with the fields from the "standard selectors". With this I would be totally happy! The problem is that the page field does not accept the same page selected multiple times. Is this possible anyway? Another idea was to use the ProField Table instead. But there one would need another approach to add the page field as a column. Maybe you've got another idea? ;-) Thanks a lot! Link to comment Share on other sites More sharing options...
DaveP Posted February 13, 2016 Share Posted February 13, 2016 If I understand the situation correctly, I would do it a bit differently. Have your Cards field just to specify the 'featured content' (3,5 & 7), and populate the others programatically. <?php $standardCards = $pages->find('selector'); $featuredCards = $page->cards; $cardsNumber = 8; $featured = array(3, 5, 7); $currentStandard = ""; $currentFeatured = ""; $output = ""; for($c = 1; $c <= $cardsNumber; $c++){ if(in_array($c, $featured)){ if(!$currentFeatured){ $currentFeatured = $featuredCards->first(); } else { $currentFeatured = $featuredCards->next($currentFeatured); } $output .= $currentFeatured; //or whatever to generate actual html } else { if(!$currentStandard){ $currentStandard = $standardCards->first(); } else { $currentStandard = $standardCards->next($currentStandard); } $output .= $currentStandard; } } echo $output; Hmm, is that a bit long-winded? I'm sure someone will come up with a far superior solution. Usual disclaimer - written in browser and completely untested. Link to comment Share on other sites More sharing options...
wheelmaker24 Posted February 13, 2016 Author Share Posted February 13, 2016 This would be a great solution if it would always be the cards 3, 5 and 7 to be stickies. That's not the case: It might be that there is no sticky card at all. Also I would like to have something that works not only on one page but on many others as well. Into the bargain it should be easily manageable by editors. That's why I came up with something that is manually draggable like the page field… Link to comment Share on other sites More sharing options...
wheelmaker24 Posted February 13, 2016 Author Share Posted February 13, 2016 I think I've found a solution: Following the same approach as above but changing the pages field to be a repeater field with a single-select page field in it ;-) Perfect! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now