On Wed, Jul 03, 2002 at 05:44:28PM -0800, Chris Lott wrote: > > I have a function that writes meta tags... if a tag (or tags) is not > specified, then it gets a default value... is there a cleaner way to > do this?
Not that I can think of. I do have some thoughts, though... > if ($type["description"]) { if ( !empty($type['description']) ) { Would be a better way to do this check, because that key may not be set and if your error reporting level ever gets elevated, you'll be getting lots of warnings. > if ($type["keywords"]) { > print '<meta name="keywords" content="' . $type["keywords"] . '" > />'; > } > else { > print '<meta name="keywords" content="generic keyword list" />'; > } I'd also tweak the process a bit to have just the different parts in the if statement: print '<meta name="keywords" content="'; if ( empty($type['keywords']) ) { echo 'generic keyword list'; } else { echo $type['keywords']; } echo '" />'; Note use of single quotes around the array key names, as well. Enjoy, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php