dev-master
9999999-devGlance - Theme manager of sites PHP
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Glance - Theme manager of sites PHP
With a manager of themes you can separate your styles (as CSS, JS, images among others) in your web application, without worrying many about changes in the URIs in your template file (as .tpl, .html, .phtml among others)., (*1)
For example, to get files of style, you use only:, (*2)
$theme->css("custom.css");
or all CSSs., (*3)
$theme->css();
See several examples or see one Demo, (*4)
$ mkdir your_project
$ cd your_project
$ php -r "readfile('https://getcomposer.org/installer');" | php
{
"require": {
"roggeo/glance": "dev-master"
}
}
$ php composer.phar update
Or simply (if you have installed Composer) run the following commands in your application folder:, (*5)
$ mkdir your_project $ cd your_project $ composer require roggeo/glance:dev-master
# Name of the themes, if enabled tell true
themes:
"sometheme1":
"sometheme2":
"sometheme3": true
"sometheme4":
#Information of a specific theme
theme : Litht
author : Geovani
email : name@email.com
date : 2015-11-08
license: http://opensource.org/licenses/MIT
link : https://yoursite.com
description: >
Theme default for Glance
require_once __DIR__.'/../../vendor/autoload.php'; use Glance\Response; Response::listenMessage();
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?get=$1 [L]
</IfModule>
Theme, see example of one., (*7)
Demo, see how to use., (*8)
... //code configuration ... //images $theme->img("name-image", "png"); $theme->img(array("image-1","image-2"), "png"); $theme->img("name-image.jpg"); //css $theme->css("custon.css"); $theme->css(array("custon", "main")); $theme->css(array("custon.css", "main")); $theme->css(); //javascript $theme->js("custon.js"); $theme->js(array("custon", "main")); $theme->js(array("custon.js", "main")); $theme->js(); //Call files of another Theme $theme->css('side','dark'); $theme->js('home', 'dark'); $theme->img('book','png','dark'); $theme->enqueue('img/book.png','dark'); //All $theme->enqueue('image.png'); $theme->assets('style.css','bootstrap');
Create a index.php at the root of your project with the following content:, (*9)
setFolderTheme('C:\\themes');
$theme = new Glance($conf);
?>
<html>
<head>
<title>Theme Light</title>
<meta charset="UTF-8">
<?php $theme->css();?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>Theme Light default Glance</div>
<?=$theme->enqueue('img/light.jpg')?>
<br />
<br />
<?=$theme->img('light.jpg')?>
<br />
Or
<br />
<?=$theme->img('light')?>
<br />
<br />
<br />
<?php
foreach($theme->img(array("books1","books2"), "png") as $book):
echo "$book<br/>";
endforeach;
?>
<?=$theme->js('light')?>
<div>
<p>Other theme</p>
<ul>
<li><?=$theme->css('side','dark')?></li>
<li><?=$theme->js('home')?></li>
<li><?=$theme->img('book','png','dark')?></li>
<li><?=$theme->enqueue('img/book.png','dark')?></li>
</ul>
<?php
foreach ($theme->enqueue(array('img/book.png'), 'dark') as $book):
echo "$book<br/>";
endforeach;
?>
</div>
<div>
<?php echo $theme->img('books1')?>
<br/>
<?php echo $theme->assets('style.css','bootstrap')?>
</div>
</body>
</html>
For tests use PHPUnit after to use the recommendations above with Composer:, (*10)
More details PHPUnit, (*11)
$ cd you_project/vendor/roggeo/glance
$ phpunit
If case of your interest, you can help improve this project. See how:, (*12)
Glance - Theme manager of sites PHP
MIT