My friend and I who is a bit of a newbie like me were discussing writing a PHP function to do some shorthand html..
For example:
function hf($tag,$var) {
return '<' . $tag . '>' . $var . '</' . $tag . '>';
}
echo hf('h1','howdy');
Of course, this 'shortcut' actually takes longer to write in the end than just:
<h1>howdy</h1>
I think its still even longer than if in php having to type:
$var = '<h1>howdy</h1>';
But maybe starts becoming a little more closer to being a shortcut when doing something like:
$var = '<div>' . hf('h1','howdy') . '</div>';
But really - its not a shortcut at all. Maybe only on larger tags with 3 or more characters does it start becoming a teeny shortcut.
I thought though we would take it to the experts out there to see if you have thought of a 'shorthand' way of producing html while working in php.
I think textmates shorthand is pretty excellent ie:
h1. howdy
That seems to trump them all but I haven't seen a textmate serverside parser or something like that out there.
Have you got a faster method for doing this? My friend and I both agree that all this open and closing and forward slashes gets a bit tedious and its a bit like finger dancing sometimes when you're working in php handling doing all the apostrophes and fullstops also.