![Logo](/SageITSolutions/MarkupEngine/raw/main/images/logo.png)
Allows you to create HTML markup tags that are rendered via class extensions to the included CustomMarkup Class. Markup intended for simple visual elements reaused throughout code and should not inlcude Database calls (separate of View and Modal)
To get a local copy up and running follow these simple steps.
Git:
git clone https://github.com/SageITSolutions/MarkupEngine.git
Composer:
composer require sageit/markupengine
This project consists of an included MarkupEngine class which parses custom HTML tags into valid HTML.
Components:
- MarkupEngine.php class (parser)
- CustomMarkup.php class (abstract base class used by parser)
- tags/mytagname.php (customizable folder containing tag classes which must extend CustomMarkup)
<header title="attribute">
This is an example block of code.
This body would return as the Tag's "Content" while some would be an accessible attribute in the header class.
</header>
<youtube src="QR-tZqiKCrg"/>
<?php
require_once '../lib/MarkupEngine.php';
$ME = new MarkupEngine([]
'parse_on_shutdown' => true,
'tag_directory' => __DIR__.DIRECTORY_SEPARATOR.'tags'.DIRECTORY_SEPARATOR,
'sniff_for_buried_tags' => true
]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example Page</title>
<meta name="author" content="Daniel S. Davis">
<!-- Date: 2020-10-06 -->
</head>
<body>
<youtube src="QR-tZqiKCrg"/>
</body>
</html>
Inside the related tag file; tags/youtube.php:
<?php
namespace MarkupEngine;
class Youtube extends CustomMarkup{
public function render(){
return <<< HTML
<iframe width="560" height="315"
src="https://www.youtube.com/embed/{$this->src}"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
HTML;
}
}
?>
Resulting output:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example Page</title>
<meta name="author" content="Daniel S. Davis">
<!-- Date: 2020-10-06 -->
</head>
<body>
<iframe width="560" height="315"
src="https://www.youtube.com/embed/QR-tZqiKCrg"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
</body>
</html>
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Sage IT Solutions - Email
Project Link: https://github.com/SageITSolutions/MarkupEngine