Coder Social home page Coder Social logo

pinpie / pinpie Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 219 KB

PinPIE is lightweight php-based engine for small sites

Home Page: http://pinpie.rocks

License: MIT License

PHP 99.88% CSS 0.01% JavaScript 0.01% Batchfile 0.12%
cms engine snippets cache php chunk ide cats dogs octocat octodex toomanytags toomanytopics ilovetopics github tags pinpie

pinpie's Introduction

PinPIE Latest Stable Version Build Status codecov Code Climate Total Downloads License

#PinPIE - when PHP Is Enough

About

PinPIE is lightweight php-based engine for small sites

Read more about PinPIE engine in PinPIE docs

Overview

PinPIE is not a framework, nor it is a CMS. PinPIE is a site engine, designed to be quick and efficient even on cheap hostings.

PinPIE stores all contend in php-files. If opcode cacher is used — it will cache this files. That allows PinPIE to include pages, snippets and chunks in the blink of an eye.

Content stored in files allows you to edit your content using favorite IDE or text editor with all that highlighting, auto-formatting, auto-saving, auto-uploading features and familiar hotkeys. Also that allows to benefit from full debug support including exact line numbers and IDE code execution flow controls. This approach is friendly to version control systems — you can have versions of all your content to be safe and protected against loosing something while editing anything. Deployment friendly. Backup friendly.

PinPIE have tag-based parser. Tag syntax is inspired by ModX tag system. Basic tags are:

  • Chunks — a pieces of plain text
  • Snippets — a pieces of php code to execute

Read more in tags readme.

PinPIE provide clear and controllable automatic snippet caching. Caching can be enabled or disabled for each snippet tag separately. Caching control is predictable and simple.

This is a snippet tag. Snippet is a piece of PHP code. This snippet is executed for every request. It is not cached.

[[$snippet]]

And here is the example of cached snippet syntax:

[[60$snippet]]

Look at this one. It is cached for one minute. If snippet file or one of files of its children is changed, PinPIE will execute and recache this snippet automatically.

To cache snippet forever, just use that syntax:

[[!$snippet]]

That snippet will be cached for about ten years, which is a lot.

You don't need to purge cache yourself every time you change something important on the site. PinPIE will automatically recache only changed content. But anyway, you can purge the cache if you want. Read more in cache readme.

Read more about PinPIE engine in PinPIE docs.

##Examples

Look at this example of some possible page:

<!-- A title text. It goes to placeholder in the template -->
[title[=Hello]]

<p>Hi!</p>

<!-- A snippet of PHP code, it outputs some random number each time page is rendered. -->
<p>The answer is [[$rand]].</p>

<!-- A static tag. It will be rendered as <img... with width and height (optional), see below -->
[[%img=/images/cat.jpg]]

<p>Now visit <a href="/about">another page</a>.</p>

<!-- A chunk tag. Piece of plain text which can be used anywhere. -->
[[lorem/ipsum]]

After page is processed, its HTML code will look like that:

...
<!-- Article and header are located in the template.
 Title was set in the template with a placeholder.
 You can find template code below. -->
<article>
  <header>
    <h1>Hello</h1>
  </header>
  
<!-- A title text. It is now above this line. -->

<p>Hi!</p>

<!-- A snippet of PHP code generated a number. -->
<p>The answer is 453.</p>

<!-- A static tag become an image with a hash preventing caching changed files.
  That hash will remain the same until file is changed. -->
<img src="//test.ru/images/cat-1.jpg?time=d9c8899d5833a0616ad2aef0bc2229cd" width="640" height="427">

<p>Now visit <a href="/about">another page</a>.</p>

<!-- A chunk tag. Piece of plain text which can be used anywhere. -->
<p>Lorem ipsum dolor sit amet...

Here the [title[=Hello]] is a constant with some text. In this example it goes into the placeholder [[*title]]. That placeholder is used in the <h1> tag, and in the same time let's assume it is used also in the <title> tag in the template. In that way, this text will appear on the page as a heading and in the head of the page in title.

The snippet [[$rand]] will run PHP code from file /snippets/rand and will output a random number.

The static tag [[%img=/images/someimage.jpg]] is very convenient way to use images, css and js files on the page. It will automatically output something like:

<img src="//test.ru/images/someimage.jpg?time=4134cb552b4782d97e3450bfa42eb049" width="640" height="427">

You can see a time hash to make changed static files updated in browser.
Also PinPIE add the image width and height automatically. This behavior can be changed in config.

Chunk [[lorem/ipsum]] is just a piece of text in a /chunks/lorem/ipsum folder.

You can find more examples in other PinPIE repos or at PinPIE site.

Start using PinPIE

You can install PinPIE with composer:

composer require "pinpie/pinpie"
composer install

Or download code from GitHub and use standalone autoloader file /pinpie/src/autoload.php.

You can find more detailed instructions in start unsing PinPIE docs.

Credits

Author and maintainer of PinPIE is Igor Data (@igordata)

pinpie's People

Contributors

igordata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

robert430404

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.