Jump to content

Confused about Markup Regions - Best practice


Yipper
 Share

Recommended Posts

Hi everyone,

I just started using ProcessWire this weekend and try to get an overview over everything. I'm a bit confused about output strategies and markup regions, because I saw a lot of different approaches and couldn't really tell which the current recommended one is.

Somehow I ended up like this:

_main.php
<body class="">

        <!-- Header -->
        <?php include "_header.php"; ?>
        
        <!-- Navigation -->
        <?php include "_navigation.php"; ?>
        
        <!-- Main -->
        <main class="">
            <?= $content ?>
        </main>
        
        <!-- Footer -->
        <?php include "_footer.php"; ?>
</body>

 

_header.php - ..and on the other layout _*.php files, just using HTML inline php like this:
<header class="">
	<a href="<?= $home->url; ?>">
	</a>
</header

 

1-home.php for the home page template
2-about.php for an about page template - numbered for better overview - using $content .="" for markup regions
<?php
namespace ProcessWire;
$content .= "<h1 class=''>{$page->title}</h1>";
$content .= "<div class=''>{$page->introduction}</div>";

1. Can you please tell me if this is a good way (in late 2024) to structure templates?

2. A problem that I have with the $content .="" approach is that code highlighting and automatic code formatting doesn't really work in VS Code for me then (could be a setup problem).

Thanks in advance for tips and best practices

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