soycharliente Posted November 4, 2009 Share Posted November 4, 2009 Refer to the title tag and the subsequent h1 tag inside the header. This totally works, but I wanted to see what other people thought/felt when they saw it. Do you think that this is bad structure/coding practice? Obviously I could split it up into two calls. Do you think it's a 6 of 1/half a dozen type of thing? The only reason I did it was because it was faster to type. (But now that I've posted this thread here, I could have just done it with two calls and saved A TON of time, lol.) <?php require_once($_SERVER['DOCUMENT_ROOT']."/include/globals.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ch › <?php echo $page = "colophon"; ?></title> <?php include $_SERVER['DOCUMENT_ROOT']."/include/meta.php"; ?> </head> <body> <div id="wrap"> <div id="navigation"> <?php include $_SERVER['DOCUMENT_ROOT']."/include/navigation.php"; ?> </div><!-- /navigation --> <div id="header"> <h1><?php echo $page; ?></h1> </div><!-- /header --> Quote Link to comment https://forums.phpfreaks.com/topic/180303-solved-echo-and-assign-string-in-same-call/ Share on other sites More sharing options...
lemmin Posted November 4, 2009 Share Posted November 4, 2009 Split what into two calls? I can't figure out what you are asking. Quote Link to comment https://forums.phpfreaks.com/topic/180303-solved-echo-and-assign-string-in-same-call/#findComment-951158 Share on other sites More sharing options...
soycharliente Posted November 4, 2009 Author Share Posted November 4, 2009 Refer to the title tag <?php echo $page = "colophon"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/180303-solved-echo-and-assign-string-in-same-call/#findComment-951159 Share on other sites More sharing options...
cgimusic Posted November 4, 2009 Share Posted November 4, 2009 There is no reason why you shouldn't. It is a useful feature. Quote Link to comment https://forums.phpfreaks.com/topic/180303-solved-echo-and-assign-string-in-same-call/#findComment-951247 Share on other sites More sharing options...
simshaun Posted November 4, 2009 Share Posted November 4, 2009 I've nothing against it, but I do think it will partially hinder flexibility. What if you wanted to assign a page title before including the template? Quote Link to comment https://forums.phpfreaks.com/topic/180303-solved-echo-and-assign-string-in-same-call/#findComment-951248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.