Can PulseCMS Manage Repeatable Content?

Can you implement repeatable content areas in Pulse CMS? For example, if I create a slider with reviews on each slide, how can I make it so that a client can add a review simply by creating a new review slide by pasting text into some area?

Another example of this would be a portfolio where a client needs to add projects to his portfolio page. If I have rows of 3 projects and a client needs to add a project to the portfolio, can I make it so all they have to do is upload the image and paste the text, and it is automatically placed as another object in the portfolio?

I’m fairly new to PulseCMS, and I need to know if this is a feature before committing to this. Sorry if it’s a basic question.

Unfortunately Pulse doesn’t have a repeating block feature (unless I missed it in the v5 release) although it would be nice to see.

The way I’ve done this in the past is to create a simple Pulse plug-in that loops through all the blocks in a given directory and adds them all to the page.

Here’s a very simple example;

<?php /* Simple looping testimonial plug-in for Pulse To use: {{testimonials:testimonials_directory}} */

$testimonialsdir = $tag_var1;
$testimonials = glob(“content/blocks/$testimonialsdir/*.txt”);

foreach ($testimonials as $testimonial) {
echo(’<div class=“testimonial-slide font-reg”>’.PHP_EOL);
$testimonial_text = file_get_contents($testimonial);
echo($testimonial_text.PHP_EOL);
echo(’</div>’.PHP_EOL);
}

unset($testimonialsdir,$testimonials,$testimonial,$tag_var1,$testimonial_text);
?>

If you copy this code into plain text file, name it testimonials.php and upload it into your Pulse install at /inc/tags/ then you should be able to display all of the blocks in a directory simply by using the short code;

{{testimonials:my_blocks_directory_name}}

where testimonials is the name of the plug-in file (testimonials.php) and the bit after the colon is the name of the directory in the content/blocks/ section of Pulse.

This is a very simple example that i’ve used to add testimonials to a content slider in the past so that the client can simply add a new block to a testimonials blocks folder and have it show up on the website.

The downside to this example is that some of the display code is embedded into the PHP which could make things tricky if I wanted to use this same plugin in another page maybe with different styling. If you wanted to make this a little more bullet proof I’d suggest using sub-templates that you could then import using the short code which would make the whole thing a little more versatile.

Adding content for a portfolio page is a little more complex as you’d almost certainly want to add both images and styled text to each entry. I’ve not had a chance to look at Pulse 5’s custom post functionality which may be able to do this for you. Alternatively you could set each portfolio entry to pull block or gallery data from Pulse based on the unique page ID. So for example a page called project 1 would import a block from content/blocks/projects/project1 and a gallery item from content/media/projects/project1.

Your client would need to jump about a little bit in Pulse adding content to both the blocks and media sections but as long as the naming system remains consistent then it should just work.
Regards,
Tim.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

This is a great solution for now but let’s pencil in a repeatable content tag for a future release :slight_smile:

This was added in 5.1 here:

2 Likes