-
Notifications
You must be signed in to change notification settings - Fork 2
Creating a tag
Skylar Kelty edited this page Aug 3, 2013
·
3 revisions
Tags are HTML elements that are picked up by Spark and processed by a user-defined function
A Spark tag will look like this in a HTML page, prior to being parsed:
<SparkExample>Any Content Here</SparkExample>
A Spark tag can be defined like so:
$spark->addTag("Example", function($html, $inner) { return "<p>This is an example tag</p>"; });
When Spark hits a tag it will call the function you see defined above and replace the tag with the resulting markup. For example, if we take the 'Example' tag above and run this page through Spark:
<html><body><SparkExample></SparkExample></body></html>
We will get:
<html><body><p>This is an example tag</p></body></html>