erykai/template

Populate template

Fund package maintenance!
Erykai

v1.1.5 2023-04-10 19:46 UTC

This package is auto-updated.

Last update: 2024-12-10 23:41:53 UTC


README

Populate template

Maintainer Source Code PHP from Packagist Latest Version Software License Quality Score Total Downloads

create config.php

$path =  __DIR__ . '/public/theme';
define('TEMPLATE_PATH', $path);
const TEMPLATE_URL = 'https://lvh.me';
const TEMPLATE_CLIENT = 'client';
const TEMPLATE_DEFAULT = 'default';
const TEMPLATE_DASHBOARD = 'admin';
const TEMPLATE_REGEX_GLOBAL = '/{{([A-Z_]+)}}/';
const TEMPLATE_REGEX_TEXT = '/{{([a-zA-Zà-úÀ-Ú0-9|-|_|?!.,\' ]+)}}/';
const TEMPLATE_REGEX_ROUTE = '/{{#(\/[a-z-]+[\/|[a-z])+#}}/';

create translate.php

const TRANSLATE_PATH = 'translate';
const TRANSLATE_API_KEY = null;
const TRANSLATE_API_URL = 'https://translate.erykia.com/api/v1';
const TRANSLATE_DEFAULT = 'pt-BR';

example create path "public/theme/admin/index.html" insert in index.html

<html lang="{{LANG}}">
<link rel="stylesheet" href="{{TEMPLATE_URL}}/public/theme/{{TEMPLATE_DASHBOARD}}/assets/css/style.css">
<script src="{{TEMPLATE_URL}}/public/theme/{{TEMPLATE_DASHBOARD}}/assets/script.js"></script>
<h1>{{Hello World}}</h1>
<a href="{{TEMPLATE_URL}}{{#/about#}}">{{About}}</a>
<a href="{{TEMPLATE_URL}}{{#/client/login#}}">{{Login}}</a>\

and "public/theme/admin/pages/home.html" insert in home.html

<h2>{{Home}}</h2>
<a href="{{TEMPLATE_URL}}{{#/contact#}}">{{Contact}}</a>
require "config.php";
require "translate.php";
require "vendor/autoload.php";
use Erykai\Template\Template;
$T = new Template(TEMPLATE_DASHBOARD);

$T->nav("index","pages/home");
echo $T->getIndex();

Contribution

All contributions will be analyzed, if you make more than one change, make the commit one by one.

Support

If you find defaults send an email reporting to webav.com.br@gmail.com.

Credits

License

The MIT License (MIT). Please see License for more information.