Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/netfloex/simple-php-site

Simple php site with routing and layout support
https://github.com/netfloex/simple-php-site

layout less lesscss php routing

Last synced: 7 days ago
JSON representation

Simple php site with routing and layout support

Awesome Lists containing this project

README

        

# Simple PHP Site
## Features
* Layout - [Configurable here](views/layout.php)
* [Less](https://lesscss.org) - [Configurable here](less/index.less)
* Custom directory names - [Configurable here](config/paths.json)
* Very basic routing - [Configurable here](config/pages.json)

## How To install
```
cd /var/www/
git clone https://github.com/Netfloex/Simple-PHP-Site.git *dirname*
```
> If you use apache
```
nano /etc/apache2/sites-enabled/simple.conf

ServerName *host*
DocumentRoot "/var/www/*dirname*/public"

# To allow rewriting to the router

AllowOverride All
allow from all
Options +Indexes

```
## Getting started
* To change the layout of your site (basic html structure for every page) you can edit the file contents in [views/layout.php](views/layout.php).
* The landing page is easily editable in [views/index.php](views/index.php), this page will inherit from the layout.
* To style your page, dont edit _public/css/app.css_, this file is automatically generated. Instead you can edit [less/index.less](less/index.less).
* To use multiple stylesheets you can import them in your [less/index.less](less/index.less) by using `@import 'file'`.
* To add or change existing routes you can edit the JSON config in [config/pages.json](config/pages.json).
## Routes
```js
// config/pages.json
{
"/": { // Landing page
"title": "Main", // The title of the page
"doc": "index" // views/index.php
},
"mypage": { // Add your own!
"title": "Jo gamer" // If you dont specify the document property it automatically looks for "views/mypage.php"
},
"notFound": { // This page is used for a 404 error
"title": "404, not found",
"doc": "404"
}
}
```