Suggestions for including partials and php templates

Hi, I am trying to integrate PG in our workflow to create pages for our custom PHP website. Ideally I would like to be able to save files either in static or php template format (smarty) that extend from my master layout.

I understand it’s a requested feature not implemented to include PHP files but I am wondering what about HTML files:

To emulate my master layout while designing I could create a header.html from my parsed php. This would include all the heading, library loading, CSS, etc and finish at a certain <div class="container>.

The footer.html to include at the end would then start at closing that "</div>" and the remaining of the page but the saved file would not include either header or footer so once parsed by the server they could work without me needing to delete code or “move it”.

It is something similar to the editable areas of masterpages, but i do not need/want to save any of it with the file itself.

It would be great if someone could orientate if there is another way to do this via, libraries or plugins.

Thanks.

Hi @luison

Not sure to understand correctly your needs but here’s what I’d try : using Pinegrow Components would be a more flexible approach for your PHP/Smarty workflow.

You could create separate components for your header and footer in Pinegrow, then use Component Preview to visualize the complete page while editing. When saving, you’ll only export the specific content area (without header/footer), which can then be wrapped with your PHP/Smarty includes.

Possibly looks like:

<?php include 'header.php'; ?>
   <!-- Only this middle section is managed in Pinegrow -->
   <div class="specific-content">
      <!-- Your page content here -->
   </div>
<?php include 'footer.php'; ?>

I think this method provides better modularity and easier maintenance than using Master Pages, while still allowing you to see the full page layout during design. Hope that helps.