Add content block to pagelist after x number of results

Permalink
Hi,

I'm using 8.2.1 and was trying to list blog posts using the pagelist block with ability to add Stack and/or any other Block once every x numebr of pagelist results.

I have made visual demo to what needed to be achieved.

Appreciate any help.

1 Attachment

 
JohntheFish replied on at Permalink Reply
JohntheFish
The main problem you need to overcome is that the page list is a block, so trying to put a block inside in the normal c5 editable way will screw up the way blocks are edited.

There are some ways round that. There may be others beyond simple variations.

a) Hard code the names of a series of stacks into the block, or make the list editable though the edit dialog, or make them attributes of the pages listed. A sort of 'After this page is listed' attribute. Then add code to pull the stacks in. You can get the code from the core stack pseudo-block.

b) Have an area on the listed pages of 'blocks to list'. Test for that when you list the page and list it after the page.

c) Have an area on the same page as the page list that contains the blocks you want to put into the page list. Then render those blocks from within the view of the page list.

d) As (c), but use some javascript to move the blocks from the other area into the desired places in the page list.

(d) is likely the easiest as it is just shifting DOM elements. It also avoids any issues associated with editing (don't pull them in edit mode) and with loading block assets and design (c5 has already done that for you) and with permissions (again, c5 has already done that for you).