Jump to content

Some kind of a page builder


rookie
 Share

Recommended Posts

hi there everybody,

I'm new to Processwire and I'm trying to figure out how things can be done. First of all i'm no developer so i have some difficulties with php and coding at all.

So I tried to put some sections on the home page of the website I am going to create. The point is that i'm unsure if this is the way to go. Maybe there is an easier way or something completely different. I would like to do this without any plugins or some kind of stuff.

How can i limit the amount of columns if i do it this way? ( a 3 column section can have only 3 columns right? )

And Yes i did read the tutorials.

How do you guys do this?

For a better understanding I have included some pictures.

Thank you.

Screenshot_2020-08-17_17-02-08.png

Screenshot_2020-08-17_17-03-38.png

Link to comment
Share on other sites

Welcome to the forums, @rookie!

The question you're asking is very interesting and important. But I think you have to read the forums a bit before continuing with it. For now it seems like any answer will be not good enough for you. So do search the forums for 'page builder' and 'content builder'. It is better to search with google though)

It is possible to do it with the page structure you're showing. But without  Repeater an PageTable fields (or preferably RepeaterMatrix) it will be pretty hard to maintain. So take your time to explore a bit.

  • Like 1
Link to comment
Share on other sites

@Ivan Gretsky

Thank you. I think you're right it will be really hard to maintain it this way.

With the search you recommended, I found another way. I will try the combination with PageTable and PageTableExtended. This seems like a more elegant way to go.

I just wonder if the PageTable module is an ProField or not.

@Robin S

Thank you. Yes, you are right, this is how it works. I just thought that this would somehow be possible in the backend as well.

Link to comment
Share on other sites

1 hour ago, rookie said:

I just thought that this would somehow be possible in the backend as well.

Everything is possible in ProcessWire. ?

For example, you could create a "max_children" integer field and add it to the template of any pages you want to limit the children of. Then use this hook in /site/ready.php:

$wire->addHookAfter('Page::addable', function (HookEvent $event) {
	/** @var Page $page */
	$page = $event->object;
	// If page has the "max_children" field, and the field isn't empty, and the number of children is at the maximum...
	if($page->hasField('max_children') && $page->max_children !== '' && $page->numChildren >= $page->max_children) {
		// ...then don't allow child pages to be added
		$event->return = false;
	}
});

But this is not to say it's the best solution, just that it's possible. ?

  • Like 2
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

×
×
  • Create New...