Skip to content

Instantly share code, notes, and snippets.

@rustyeddy
Created January 26, 2013 16:44
Show Gist options
  • Save rustyeddy/4643197 to your computer and use it in GitHub Desktop.
Save rustyeddy/4643197 to your computer and use it in GitHub Desktop.
HTML helper functions to make life just a little bit easier.
<?php
function href($url, $anchor, $class = null)
{
$html = "<a ";
if ($class != null) {
$html .= 'class="' . $class . "' ";
}
$html .= 'href="' . $url . '"' . ">" . $anchor . "</a>";
return $html;
}
function img($src, $class = null)
{
$html = "<img ";
if ($class != null) {
$html .= 'class="' . $class . "' ";
}
$html .= 'src=' . $src . ' />';
return $html;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment