Jump to content

Thousands of pages - One site with multiple pages or One install with multiple sites?


einsteinsboi
 Share

Recommended Posts

 apeisa

It does sound straightforward when you frame it like that (template != template file).  I'm going to play around a bit more with that idea of one template and then loading site specific css and html, and report back. But if you have a minute to do a code sample for me that would be epic :)

I would set something like this:

Create template called babysite. Give it all the fields you need.

Then create /templates/babysite.php It would be something like this:

<?php

$pathToTemplate = $config->paths->templates . "babysites/" . $page->name . "/index.php";

// If babysite index.php exists, we include it, otherwise we include default or throw an error
if (file_exist($pathToTemplate)) include($pathToTemplate);
else throw new WireException("TemplateFile couldn't be found");

This assumes you keep your babysites at /site/templates/babysites/babysitename/index.php

That is good folder to keep babysite assets too, but of course you can get those from everywhere.

You could of course take this much further. But if babysites doesn't share much together (like some basic structure), then I think this would be simplest and most straightforward way to go.

  • Like 1
Link to comment
Share on other sites

I would set something like this:

Create template called babysite. Give it all the fields you need.

Then create /templates/babysite.php It would be something like this:

<?php

$pathToTemplate = $config->paths->templates . "babysites/" . $page->name . "/index.php";

// If babysite index.php exists, we include it, otherwise we include default or throw an error
if (file_exist($pathToTemplate)) include($pathToTemplate);
else throw new WireException("TemplateFile couldn't be found");

This assumes you keep your babysites at /site/templates/babysites/babysitename/index.php

That is good folder to keep babysite assets too, but of course you can get those from everywhere.

You could of course take this much further. But if babysites doesn't share much together (like some basic structure), then I think this would be simplest and most straightforward way to go.

Huh... if I understand this correctly, each babysite has its own index.php file which has the site specific HTML and CSS, and the babysite template directs each site to find its markup in its index.php. 

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