Commit 2d989ea6 authored by nirgendswo's avatar nirgendswo

update

parent 4f0b55fe
# Fuzzy CMS
This micro CMS runs without any Database, all content of a Page is saved into a single Markdown-File. Fuzzy CMS is using the **Lumen Framework**.
This micro CMS runs without any database, all content of a page is saved into a single markdown file. Fuzzy CMS is based on the **Lumen Framework**.
## 1. Requirements
......@@ -9,7 +9,7 @@ This micro CMS runs without any Database, all content of a Page is saved into a
## 2. Install
Download the Package and extract it. Run **composer intall**. Composer will copy a default configuration-file.
Download the package and extract it. Run **composer intall**. Composer will copy a default configuration file.
* APP_DEBUG - true to debug (default: false)
* APP_SITE_TITLE - title of your site (default: "Fuzzy CMS")
......@@ -19,54 +19,43 @@ Download the Package and extract it. Run **composer intall**. Composer will copy
## 3. Themes
Themes are placed under **"/resources/views/themes"**. To create a own Theme, simply create a Directory. To Activated a Theme, simple change the name of the template in the .env-file **APP_THEME** with the name of the Directory of the Theme.
Themes are placed under **"/resources/themes"**. To create an own theme, simply create a directory. To activate a theme, change the name of the template in the .env-file **APP_THEME** with the name of the directory of the theme.
To
## 4. Markdown files
## 4. Media
Content is saved as markdown in files. In the file header there's is a JSON that contains all meta data of a page. You can you use any simple text editor to change your text and data and use tags to change formating or create HTML elements.
```
```
## 4. Markdown Files
Content is saved as Markdown in files, in the head of the file is a JSON, that contains all Meta-Data of a Page. You can you use any Simple Texteditor to change your Text and Data and use Simple Tags to change Formating or create Html-Elements.
The Structure of Files and Directories are represent the hierarchy of your Site. Filenames and Directories are also the Slug, that used to call a Page.
The structure of files and directories represent the hierarchy of your site. Filenames and directories are also the slug, that used to call a page.
| File | Url |
| - | - |
| /database/data/index.md | / |
| /database/data/contact.md | /contact.md |
| /database/data/blog/new-entry.md | /blog/new-entry |
| /database/data/author/index.md | /author |
| /database/files/index.md | / |
| /database/files/contact.md | /contact.md |
| /database/files/blog/new-entry.md | /blog/new-entry |
| /database/files/author/index.md | /author |
### 4.1 Markdown
All Content is parsed by [erusev/parsedown](https://github.com/erusev/parsedown). There is one Extension,
All content is parsed by [erusev/parsedown](https://github.com/erusev/parsedown). There is additional extensions
* A Url with http or https will be handled as external link and the target-attribute will be set to "\_blank"
* An URL with http or https will be handled as external link and the target attribute will be set to "\_blank"
* The ImageHelper class connects your images with posts and optimizes them. See section "ImageHelper" below
### 4.2 JSON
The JSON hold the Meta-Data of a Page. There a some Keys that used by the System. You can add any other Keys to handle additional Data for your Pages.
JSON is used to store meta data of a page. There a some keys that are used by the system. You can add individual keys to handle additional data for your pages.
#### 4.2.1 title (optional)
#### 4.2.1 type (optional)
The "title" is the Title of a Page.
You can set types to handle files in different ways: blog articles, pages, galleries, etc.
#### 4.2.2 type (optional)
#### 4.2.2 view (optional, default = 'page')
You can set types to handle files in different ways, blog article, page, gallery, etc.
#### 4.2.3 view (optional, default = 'page')
The view is the Template that a Page is using. All templates will be rendered with the Blade-Engine. If the View is not set, the System will be use the default value.
There are templates which define the view of your pages. All templates will be rendered with the Blade engine. If no view is set, the system will be use the default view.
#### 4.2.4 index (optional, default: true)
This option is used to hide sites by calling them with there slug. You can use this for Slots (What ever you preferred to call them), to Structure your Content. This is a Example how you can call Snippets. The Snippets are all in a Subdirectory called "features". Each File has set his type as "feature" and have a key called "order" with a Number for ordering them.
This option is used to hide sites by calling them with their slug. You can use this for slots (however you prefer to call them) to organize your content. This is an example how to call these slots. The slots are all in a subdirectory called "features". Each file has set its type as "feature" and have a key called "order" with a numeric value to order it.
```PHP
@inject('pageRepository', 'App\PageRepository')
......@@ -74,6 +63,7 @@ This option is used to hide sites by calling them with there slug. You can use t
['type' => 'feature'],
['parent' => '/features', 'orderBy' => ['order' => 'asc']]) as $feature)
<article>
{{ $feature->data['title'] }}
{!! $feature->html() !!}
</article>
@endforeach
......@@ -81,11 +71,138 @@ This option is used to hide sites by calling them with there slug. You can use t
#### 4.2.5 hidden (optional, default: false)
Is this option set to true the page will be ignored by any Query-Function. A direct call by his slug, will show the page. As an an example, the *404-Page* is hidden.
If this option is set true, the page will be ignored by any query function. A direct call by its slug will show the page. For example, the **404-Page** is hidden.
## 5. ViewHelper
There are a few functions to help in the view.
```PHP
@inject('viewHelper', 'App\ViewHelper')
```
### 5.1 truncate
truncates a string that can contain HTML. The length is counted by letter. The default value is set to 150 letters.
```PHP
$viewHelper->truncated($html, $length)
```
### 5.2 timeElapsed
Returns a human readable "Time Elapsed" from a DateTime object as string.
```PHP
$viewHelper->timeElapsed($dateTime)
```
### 5.3 current
Compares if the page matching the current path.
```PHP
$viewHelper->current($page, $class = 'current')
```
### 5.4 route
Create route from PageModel-Object.
```PHP
$viewHelper->route($page)
```
### 5.5 text
Checks an array if a given key is set and returns the matching value if true. Otherwise it returns false.
```PHP
$viewHelper->text($key, $data)
```
### 5.6 checkbox
Checks an array if a key is set and returns the attribute 'checkbox="checkbox"'.
```PHP
$viewHelper->checkbox($key, $data)
```
### 5.7 selected
Checks an array if a key is set and returns the attribute 'selected="selected"'.
```PHP
$viewHelper->selected($key, $data)
```
## 6. ImageHelper
This helper class optimizes images in templates. It searches image files under **"/resources/files"**.
All files will be copied to **/public/files** while original files remain untouched.
The ImageHelper class can be used directly in the templates.
```PHP
@inject('imageHelper', 'App\ImageHelper')
<img class="project__img" src="{{ $imageHelper->resizeToWidth('teaser.jpg', 700) }}" />
```
It is also available in the markdown.
```PHP
!['alt text']('teaser.jpg'){resizeToWidth:700}
```
### 6.1 scale
Scales an image by a percent value.
```PHP
$imageHelper->scale('teaser.jpg', 70)
!['alt text']('teaser.jpg'){scale:70}
```
### 6.2 resize
Resize the image. It will not be cropped.
```PHP
$imageHelper->resize('teaser.jpg', 300, 300)
!['alt text']('teaser.jpg'){resize:300,300}
```
### 6.2 resizeToHeight
Resizes the height of an image while the width will be automatically changed to keep the correct ratio.
```PHP
$imageHelper->resizeToHeight('teaser.jpg', 300)
!['alt text']('teaser.jpg'){resizeToHeight:300}
```
### 6.3 resizeToWidth
Resizes the width of an image while the height will be automatically changed to keep the correct ratio.
```PHP
$imageHelper->resizeToWidth('teaser.jpg', 300)
!['alt text']('teaser.jpg'){resizeToWidth:300}
```
### 6.4 passThrough
Image will be saved without changes.
```PHP
$imageHelper->passThrough('teaser.jpg', 300)
!['alt text']('teaser.jpg')
```
## 5. Json
A Page can get as JSON without rendering the Template. Use this URL to get a Page,
Accessing a page as JSON without rendering the template. Use this URL to get a page
```
/json/{slug}
......@@ -93,19 +210,22 @@ A Page can get as JSON without rendering the Template. Use this URL to get a Pag
## 6. RSS
RSS-Feeds will be configured by the .env-file. You can add a list with types, separated by comma to the APP_RSS_TYPES. RSS-Feeds will be called with,
RSS feeds will be configured by the .env-file. You can add a list with types,
separated by comma to the APP_RSS_TYPES. RSS feeds will be called by
```
/rss/{type}
```
## 7. Commands
## 7. Actions
| Command | Description |
| - | - |
| install:assets | Copy all files from the active Theme "assets"-Directory to "/public/assets" |
| media:clear | delete all cached media files |
To handle forms you can extend your theme with actions. Create an "Actions" folder in your theme.
Place an action class that is extended by **"App\Http\Actions\PostActionAbstract"**.
To call an action rename the class to the slug which should call the action. For example,
a Slug **"getting-started"** have a an action class **"GettingStartedPostAction"**. The classes need a namespace like, **"Themes\name-of-your-theme\Actions"**.
## 7. License
Don't forget to run **"composer dump"** after you created your action classes.
MIT
Once you prepared your action class, every call of a slug containing an action class, calls the internal **process**-function. **"$this->results"** will contain all results from the logic
and it's by default an empty array which is present in any view.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment