Converting from old PHP routing to new on existing project

Hi all

I’m keen to change an existing PHP project so it uses the new routing and templates. I currently have some include files like header.php and footer.php using the traditional

<?php include['header.php']; ?>

so am keen to know the best technique for changing these to the new partials and layouts.

Cheers

Jon

If your pages all share the same structure and use the same header.php (and footer.php) include, the best approach is to move that content into a layout page. This way it’s automatically applied to all content pages using that layout.

If the include is only needed on specific pages, then convert it into a partial and include it only where required.

Layouts replace the old global includes, while partials replace conditional or page-specific includes.

1 Like

If you have an existing typical PHP site - with includes for headers for footers etc. - can you create new pages with the new features, alongside the existing structure? I’m wondering for example if the .htaccess file will be replaced and the routing will stop working with existing pages.

Is the best option to duplicate an existing site and recreate it all using the new features ?