Skip to content

SageITSolutions/MarkupEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

MarkupEngine

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

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)

Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Installation

Git:

git clone https://github.com/SageITSolutions/MarkupEngine.git

Composer:

composer require sageit/markupengine

Usage

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)

Example Tag.

<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"/>

Integrated Example

<?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>

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Sage IT Solutions - Email

Project Link: https://github.com/SageITSolutions/MarkupEngine

Acknowledgements

About

A reusable class which renders custom HTML markup tags based on provided classes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages