PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
257 stars 49 forks source link

Multi site #88

Closed Zyles closed 10 years ago

Zyles commented 10 years ago

This project looks like a nice fork of Pico. I am trying to find a suitable API documentation engine using Markdown which we can extend.

One specific feature I am looking for is one installation, multiple sites. I assume this is not possible right now. Is it on a roadmap?

We would isolate the templates, themes, content into each virtual host. But the core code would be the same, not having to maintain multiple installations.

So the web servers virtual hosts would point to the PhileCMS installation and serve the correct content based on HOST_NAME.

Thank you.

NeoBlack commented 10 years ago

currently you can set the content folder in the index.php file:


define('CONTENT_DIR',      ROOT_DIR . 'content' . DIRECTORY_SEPARATOR);

the core could be linked into the vhosts.

maybe it would be better to define the content dir within the config.php file instead of the index.php file. I think we could do this before the 1.0.0 release. today we release the first release candidate of the version 1.0.0

if the CONTENT_DIR could be set in config.php a multi site hosting should be possible.

@james2doyle what is your opinion? Is it possible yet or not?

james2doyle commented 10 years ago

Correct me if I am wrong @NeoBlack but @Zyles could add some init code in the index.php that would change the content directory constant based on the URL or maybe a .htaccess environment variable or vhosts file.

You can also add an additional constant for the theme, and maybe a few other things, then read the constant in the config.php file.

See: http://stackoverflow.com/questions/8781181/how-to-set-a-custom-global-from-htaccess

Zyles commented 10 years ago

.htaccess wont be available since we run Nginx.

So there needs to be some kind of HOST_NAME detection in PHP.

Serving the correct content/ dir wont be the biggest problem. But will the correct cache work. Or a specific theme/template per virtual host?

Since all this is set on a higher level.

What I think you would need to do is move the configurations, and everything that is page specific to a lower level, and have Phile act on the higher level for rendering, caching, parsing etc.

And you would do something like: content/docs.example.com/ content/docs.example2.com/

And you put all the themes, markdown, images, templates in there.

So with Nginx we point to the index.php root, which catches the correct hostname and serve the correct content.

I am just wondering if it is a lot of work to restructure it to work somehing like this. I don't want to create yet another fork. :)

james2doyle commented 10 years ago

You could create a plugin that would manipulate the config when the site is loaded. It seems possible but there would be a lot of manipulation of the config, constants and the index.php file, from what I am imagining.

I think it could be possible to do something smart with symbolic linking of the Phile core, and having your own default_config.php

NeoBlack commented 10 years ago

all important constants are set in the index.php file:

define('ROOT_DIR',         realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('CONTENT_DIR',      ROOT_DIR . 'content' . DIRECTORY_SEPARATOR);
define('CONTENT_EXT',      '.md');
define('LIB_DIR',          ROOT_DIR . 'lib' . DIRECTORY_SEPARATOR);
define('PLUGINS_DIR',      ROOT_DIR . 'plugins' . DIRECTORY_SEPARATOR);
define('THEMES_DIR',       ROOT_DIR . 'themes' . DIRECTORY_SEPARATOR);
define('CACHE_DIR',        LIB_DIR . 'cache' . DIRECTORY_SEPARATOR);

in my opinion, the cache, themes, content folder could be set per vhost really easy.

james2doyle commented 10 years ago

Yeah, you can add more constants in the index.php and get pretty far with it. I have one I create called PRODUCTION and I have it true on the live server and false on local. I also have conditionals in my template for serving unminified CSS when in local.

So there is quite a bit of flexibility. You could theoretically use a remote drive as the CONTENT_DIR if you really wanted to.

NeoBlack commented 10 years ago

no update since four month, can we close this issue?

james2doyle commented 10 years ago

We can close it