Skip to content

This version of the PHP template library makes it easy to manage web templates using simple PHP variables. It automatically structures the HTML document, includes meta tags, and allows flexible asset management.

Notifications You must be signed in to change notification settings

asianprogrammer/PHP-Template-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

PHP Template Library - Version

This version of the PHP template library makes it easy to manage web templates using simple PHP variables. It automatically structures the HTML document, includes meta tags, and allows flexible asset management.

Installation

Include the T.php file in your project:

include 'T.php';

Usage

Setting Up Variables

You can set webpage properties using simple PHP calls:

T::title("My Website");
T::favicon("favicon.ico");
T::css(["style.css", "theme.css"]); // Multiple CSS files
T::jsGlobal("global.js"); // Loads in `<head>`
T::js("script.js"); // Loads before `</body>`
T::description("A brief description of my site");
T::keywords("php, template, website");
T::author("John Doe");
T::robots("index, follow");

Open Graph and Social Media Meta Tags

To improve SEO and social media sharing:

T::ogTitle("My Website");
T::ogDescription("A detailed description for social media");
T::ogImage("image.png");
T::ogUrl("https://example.com");
T::ogType("website");

T::twitterCard("summary_large_image");
T::twitterSite("@mytwitter");
T::twitterTitle("My Website on Twitter");
T::twitterDescription("Twitter description");
T::twitterImage("twitter-image.png");

Custom Meta Tags

If you need additional meta tags:

T::meta("<meta name='custom-meta' content='custom-value'>");

Rendering the Template

At the start of your PHP file, call:

T::render();

Then write your HTML content:

<h1>Welcome to My Website</h1>

Finishing the Template

At the end of your file, call:

T::close();

Full Example

include 'T.php';

T::title("My Webpage");
T::favicon("favicon.ico");
T::css("main.css");
T::jsGlobal("global.js");
T::js(["app.js", "extra.js"]);
T::description("A sample webpage");
T::keywords("sample, test, webpage");

T::render();
?>

<h1>Welcome to my website</h1>

<?php
T::close();
?>

Why Use This?

  • Simple and Flexible: Use PHP variables instead of complex functions.
  • Complete Meta Management: Supports SEO, Open Graph, and Twitter Card tags.
  • Better Organization: Automatically structures HTML, CSS, and JavaScript.
  • Works Seamlessly with HTML: No extra steps needed.

This library simplifies PHP templates and improves workflow. Try it today!

About

This version of the PHP template library makes it easy to manage web templates using simple PHP variables. It automatically structures the HTML document, includes meta tags, and allows flexible asset management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages