Code Monkey home page Code Monkey logo

ez-template's Introduction

THIS PROJECT HAS BEEN DEPRECATED

Screenshot

EZ Template is a very simple PHP class developed to make the creation of simple websites with dinamic content very easy.

How to use

See the example folder in this repository for a complete example

EZ Template is extremetely easy to use. You at least two files

  • Your main php file
  • A template file (with .html as its extension)

You set up the template file with "variables" which will contain your dynamic or programmer-set content:

	<title>[title] | My Website</title>
	<meta name="description" content="[description]" />

In the example above [title] and [description] are our variables. They have to be enclosed in square brackets [] but the name can be whatever you like. You can also add as many as you like in your template file, however you want or see fit.

Basically, EZ Template replaces your variables with actual content and ignores the rest of the file.

For your actual php file, you just need to include the class:

	require 'EZ_Template.class.php';
	//create object
	$tem = new EZ_Template;

Then simply setup the variable content using the assign() method method.

	$tem->assign('title', 'Ez Template');
	$tem->assign('description', 'Welcome to this example page');

And finally, just call the render() method which takes a string as a parameter. The parameter should be the name of your template file.

	$template_name = 'template';
	$tem->render($template_name);

You can also add if statements in your template file, see the example folder.

Any feedback is appreciated. If you have any suggestions to improve this extension, don't hesitate to let me know.

ez-template's People

Contributors

overstruck avatar

Watchers

 avatar  avatar  avatar

Forkers

quasi-project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.