Jump to content

Recommended Posts

Posted

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

Posted

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
Posted

@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.

Posted
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
Posted
2 hours ago, rookie said:

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

It is a free ProField.

Welcome to the forums and ProcessWire ?.

  • Like 1
Posted

 

10 hours ago, Robin S said:

Everything is possible in ProcessWire. ?

 

I'm afraid it is.

@kongondo

Thank you.

I'd thought so. But better safe than sorry, right?

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
×
×
  • Create New...