Jump to content

Do everything go in the blocks or can you use Processwire basic template logic mixed with blocks?


Atlasfreeman
 Share

Recommended Posts

When working with the rock page builder if i know i want some markup untouched such as i want to do a array  finding all children and putting and image, can i do this on a "template" as i normal would in ProcessWire or du i need to do it in the block? If doing it in the block the enduser could move it around (not a big problem for the case i am working ATM). But im quorious should everything go in the blocks now?

  • Like 1
Link to comment
Share on other sites

Hey @Atlasfreeman thank you for that question!

That's totally up to you 🙂 RockPageBuilder gives you the freedom to define different types of content elements that the end user can place on the page in any order.

On 11/28/2023 at 12:50 PM, Atlasfreeman said:

such as i want to do a array  finding all children and putting and image, can i do this on a "template" as i normal would in ProcessWire or du i need to do it in the block?

I'm not sure I understand? Do you mean a listing of child pages? Like on a blog overview page that lists all children (aka blog posts) and shows a preview image for every post?

If that is what you are asking then there are two possible solutions:

1) Create and use a block to list children

This approach is more flexible but might need some training for the client to understand the concept. The benefit is that you can add content on top of that page listing or below. You have a lot of freedom. You could even add block settings, for example a setting of how many blog posts should be shown. For the blog overview page you might choose 12.

One benefit of this approach is that you can reuse this blog on other pages. For example you could add the same block on the frontpage but only show 3 blog posts. You could then add another setting (checkbox) to show pagination or not. For the frontpage you'd hide pagination, for the blog overview page you'd show pagination.

2) Create and use a dedicated template

That approach is less flexible but easier for the end user as it has less options and less freedom.

----

I tend to go with option 1. It's really not hard to do and it's also easy to understand for most of my clients.

Does that help?

Link to comment
Share on other sites

Normally i would do a page where all "children" or specific template where found to give the viewer and overview of what they can click on (im often doing portfolio websites).
Then the end-user only need to do new "under pages", and their new project will automatic come on the front page (I think that is nice, and a feature i love about processwire)
I find the block system very intuitive and have made it with this now. Maybe you could make a lock block feature one day in the future.

Anyway, you are talking about how to create reuse of blocks and how they can have variation we also see this in the demo, and i can see it in the prebuilt block, tought i never used .latte is there anywhere you can direct me to how you do this in php, is there any guide for this?

I think your variations are this in the .latte files (or a part/start of it):

{var $maxw = "maxw-".$block->settings('maxw')}
{var $width = $block->thumbWidth()}

Link to comment
Share on other sites

Hey @Atlasfreeman there's really no difference in using block settings in latte or php files. Only the syntax is a little different of course.

In latte you write {$block->settings('foo')} which would be <?= $block->settings('foo') ?> in PHP.

52 minutes ago, Atlasfreeman said:

Normally i would do a page where all "children" or specific template where found to give the viewer and overview of what they can click on (im often doing portfolio websites).

Yeah, that might be a good use case for sticking with the good old approach of dedicated templates. You can still use the RockPageBuilder blocks field on that template, so you will save a lot of time nevertheless 🙂 

54 minutes ago, Atlasfreeman said:

I find the block system very intuitive and have made it with this now. Maybe you could make a lock block feature one day in the future.

What do you mean by lock block? A block that is only editable by userusers?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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