Jump to content

Recommended Posts

Posted

So in the Markup Regions output strategy, the docs seem to suggest that we can render markup using a different base to _main.php, for use on specific pages (like rss feed, homepage, etc) if needed. Have I understood that correctly?
https://processwire.com/docs/front-end/output/markup-regions/

It says "we can do so by editing the template settings in the ProcessWire admin to use a different file, or no file at all, when appropriate. (This is found in Setup > Templates > [choose a template] > Files [tab])."

I'm not sure, however, what setting I should change here. Let's say I want this template to apply Markup Actions to 'base.php' instead of _main.php, where would I set that here? Most of my confusion stems from the "Prepend" and "Append File" wording... 

I'd really appreciate any help 🙂 Thanks

image.thumb.png.72b4e48853aa9f623eaae73f1a80aa83.png

Posted

If you check the "Disable automatic append of file: _main.php" setting, then you can specify your "base.php" to be appended in place using the field right above

  • Like 1
Posted

Thank you, @monollonom. I suspected it was that but I wasn't sure. 

While I have you 😄 - If I use multiple base files like _main.php in this way, do I need to change anything in config.php or am I good?
Thanks again.
 

Posted

The idea is to have the _main.php be the base for most of your templates and then on a case-by-case basis disable it per template and specify another appended file, e.g. _rss.php. So I would say no need to change anything in config.php 🙂

  • Like 1
Posted

Thanks again @monollonom. That helps a lot. Still trying to scope out what output stategy is best for a portfolio site I've built as static html, with possible a small store at a future date. I would like to ensure my GSAP scroll animations work properly so controlling JS and CSS from one working base seems better than using lots of include templates, Idk... Rather new to this. 

By the way, I had a look at your site. Your work is very impressive, well done. Did you build any of those sites with ProcessWire by any chance? 
 

  • Like 1
Posted

Hi,

as i stongly agree with @monollonom about this checkbox to use a different, say frame, than the usual _main and the fact that in general you don't need a specific config, there are ready, init and so on for this i'd like to add a few things

change your  _main frame would useful for rss feed, sitemap; well xml files 🙂 but also for modals for example (and sometimes for dynamic css or js files) as you often need a lighter when not totally different html head and quite often too far less js files to the bottom of the file but not at all for the home page
if you have a closer look to what this _main file allows with marlup regions you'll see that it goes far above a main div with an id you can use in every template with totally (or not) diffeerent html content and around, above and below, div (or else) you will have (or not) on every template/page

even before diving deep into the markup regions world, first thing first, as this _main.php file is a php one let's take a simple example, the homepage
quite often you have a section name hero (i still don't know why...) with a big image, carrousel, or any gsap animated witchcraft 🙂 and on top of this other page a simpler and horter image with or not a title sometimes a breadcrumbs...
well, before that main div/section you will (or not) use everuwhere, why not simply use php... if page id is 1 (or template == home) hop, your big whatever it is and else what you need in the other page
of course, is there are some pages, say, in your case your futur shop, for which you need a different head part, well you see where i'm going... and you may have noticed i quite often said "or not", this is processwire way of life 🙂, nothing is  compulsory it is all about your logic, its own logic is just here to help you do things faster than if you had to write every single thing by yourself but you can think exactly the same way as if you did

and now if you dive a little deeper into markup regions, its optional attributes, you'll see how powerful it is

have a nice day (and a great pw journey :))

Posted
12 hours ago, ai_slop said:

By the way, I had a look at your site. Your work is very impressive, well done. Did you build any of those sites with ProcessWire by any chance? 

Thanks! All of them are built using ProcessWire, it's my tool of choice ever since I got introduced to it close to 10 years ago 🙂

  • Like 1
Posted

Thanks @virtualgadjo, appreciate the advice.

It's a little difficult at first (for a newcomer, at least) to wrap one's head around markup regions but it sounds flexible and more future proof than sticking with direct output and includes.

You're right about the JS and animation overhead. That's the main thing that's bothering me. For my site, the homepage is animation and image heavy so I'm wondering whether I should just serve it as a static page without _main.php (with a few project thumbnail <a> tags thown in) and then use _main.php for the other pages. 

The idea would be to avoid cutting out bits of scripts from my existing static home page and putting them into templates for appendng - only to append them back in with markup regions.

I guess serving home.php as the homepage wouldnt impact the URLs or anything


 

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