Jump to content

Markup Regions, Did i understand it right ?


EyeDentify
 Share

Recommended Posts

Hello Forum members.

I just wanted to confirm with you PW gurus on here that i got the thinking behind regions in the latest blog post right:
https://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/

So my understanding from the quick glance of the article is that if i were to use the new regions functionality it would in simple terms work like this:

The referenced HTML in any of my other page template files would be inserted at the designated place in the home.php template file instead of replace it with all HTML in that page template file that was requested ?

And the home.php template file would become sort of a View, that used HTML from the other templates files to change acording to the needs?

So that i would only need to put the HTML that changed in my other page template files and have the "full" HTML markup in the home.php ?


I just wanted to see if i got it right.

Thx in advance.

 

ProcessWire Official Markup Regions Documentation (New 2022-09-08)
https://processwire.com/docs/front-end/output/markup-regions/

Edited by EyeDentify
Added a link to the offical doc on Markup Regions
  • Like 1
Link to comment
Share on other sites

Hi @EyeDentify I think you got it totally right, at least this is also my understanding of it.

EDIT: I missed this one: "...full" HTML markup in the home.php"

This "full" markup is supposed to be in "_main.php", but I suppose it was just a mistake that you referred to "home.php".

Edited by szabesz
  • Like 1
Link to comment
Share on other sites

51 minutes ago, szabesz said:

Hi @EyeDentify I think you got it totally right, at least this is also my understanding of it.

EDIT: I missed this one: "...full" HTML markup in the home.php"

This "full" markup is supposed to be in "_main.php", but I suppose it was just a mistake that you referred to "home.php".

I thought that the home.php was the central one in this.

But maybe i missunderstood the article.

What was the purpose of the _main.php file ?

Link to comment
Share on other sites

Quote: "Let's say that I'm using a _main.php file that serves as my primary document markup, like used in our current default site profile. It contains the main document markup, like this:"

Ryan normally calls it _main.php (see: $config->appendTemplateFile = '_main.php') and this is where the skeleton of the HTML goes. This skeleton is extended and changed by writing code in the template files assigned to public pages, such as home.php. Otherwise you got it right I think.

Edited by szabesz
typo
  • Like 3
Link to comment
Share on other sites

11 minutes ago, szabesz said:

Quote: "Let's say that I'm using a _main.php file that serves as my primary document markup, like used in our current default site profile. It contains the main document markup, like this:"

Ryan normally calls it _main.php (see: $config->appendTemplateFile = '_main.php') and this is where the skeleton of the HTML goes. This skeleton is extended and changed by writing code in the template files assigned to public pages, such as home.php. Otherwise you got it right I think.

Ok i think i got it now.

So Ryan just includes the HTML in the included _main.php file instead of putting it directly in home.php ?

Other then that i got it right ?

Link to comment
Share on other sites

Well, I'm not sure what you are referring to by "main.php", but Ryan's blog post can be understood by looking at the "site-default" profile. You might want take a close look at it. There is a _main.php file used by this profile, the whole article should be viewed in this context.

Link to comment
Share on other sites

Just now, szabesz said:

Well, I'm not sure what you are referring to by "main.php", but Ryan's blog post can be understood by looking at the "site-default" profile. You might want take a close look at it. There is a _main.php file used by this profile, the whole article should be viewed in this context.

I wrote wrong, i mean home.php not main.php for the "/" home path.

  • Like 1
Link to comment
Share on other sites

34 minutes ago, szabesz said:

I see. Then the answer is yes. The "skeleton" of the markup is in _main.php, just like in the case of "site-default" profile.

Thank you for the help getting my head around this :)

Now that i grasp it, i can see how usefull this could be in the future :)

  • Like 1
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...