Categories
All Personal

Preschool presents and PHP

I’ve been at home for the past two days. Yesterday, my son woke up with a nasty cough and hoarse voice, so we kept him home from preschool. My wife had to work during the day and go to her Montessori class in the afternoon, so I stayed home as well to take care of the boy. He’s lots of fun to be around — we went out for lunch to Metropolitan Market, where he scarfed down 8 pieces of California roll and most of an apple, we played ‘cave’ with two sofas and a blanket, and I got some occasional bits of work done while he entertained himself in the sandbox out on the deck. As the day progressed, however, I noticed my throat getting sore, and I had a number of sneezing fits, both of which are usually pretty good indicators that I’m about to become ill myself.
Sure enough, last night I could hardly sleep because my throat hurt so much, and today my head feels like it’s all stuffed up with lovely goo. I decided to stay home from work to get some rest and avoid giving this preschool germ to everyone around me. I got some quality bed rest in the morning, and spent the afternoon tweaking some of the PHP code in one of my WordPress plugins to interact better with Mint.
PHP is weird. There seem to be two distinct styles — HTML with PHP embedded inside of it, or PHP with HTML embedded inside of it. On occasion I’ve seen code where the designer couldn’t keep track of which was inside what, and it’s just a gnarly mess to read. (Then again, I suppose my stuffy head could be part of the problem, too.)
I had intended to spend part of today writing up a MacBU-based post, but I’ve been unable to organize my thoughts well enough, which is why you’re getting this fairly random post instead. Maybe tomorrow, if I feel better.

2 replies on “Preschool presents and PHP”

The balance of php and html varies with the purpose of the page: some are mainly php, some mainly html, and many a goodly mix. That’s the power of php – and the code style still reads well. It’s fun watching c-background guys doing
$o .= “some more html code”;
$o .= “yet more html code”;
print ($0);
while web-background people do
Some people like enjoy inlining
php with html more than do.
It’s just style, until, after the first versions have begun to be used online and the site develops, reliability and delegation of content to web-only people requires that code and content will be separated, with a purely or mainly php page callling mostly-html pages to do the display work.
php is still the AppleScript of the web 🙂

There is another coding styles in PHP: Separate PHP from HTML. A good habit is using some template to accelerate your work. One typical example is Smarty. If you are using Smarty, you will see the world looks better:)
Example
demo.php
assign(‘Hello’, $hi’);
$smaty->assign(‘World’, $schwieb);
$smarty->display(‘demo.htm’);
?>
demo.htm
…..
….. {$hi} …
…..{$schwieb}….

Leave a Reply

Your email address will not be published. Required fields are marked *