Re: Way to output HTML on professional websites

From: Date: Tue, 27 Dec 2011 04:39:06 +0000
Subject: Re: Way to output HTML on professional websites
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-316109@lists.php.net to get a copy of this message
On Tue, Dec 27, 2011 at 12:46:29AM +0100, Florian Müller wrote: > > Hi guys > Just a little question: I've programmed some nice little websites up to 25'000 lines > of code. > Now if I see some bigger websites just as facebook and so on, how are they printing their > website out? > Does it work like > <?php echo "<html><head>..."; ?> > or do they output it like > <?php if (true) { ?> <body> > </body> <?php } else { ?> <head> > </head> <?php } ?> > Or is the code even generated or gotten from a database and evaluated? > How does the website itself gets printet on really professional websites? > Thanks for answer! You're asking for an opinion. In mine, if you have to call fifty files before printing a byte to screen, you've introduced too much complexity. I just finished up five weeks at a company where they were calling probably upwards of 100 files before printing anything on screen. It ought to be like this: <body> <?php if ($condition): ?> <h1>Some text</h1> Other stuff<br/> Much other stuff.<br/> <?php endif; ?> </body> </html> That said, a lot of CMS-based sites use some sort of templating engine. Those go like this: <body> {{if condition}} ((h1:Some text}} Other stuff<br/> Much other stuff.<br/> {{endif}} </body> </html> ... with PHP or some other language decoding the "pseudo-HTML" above and displaying it. Kind of a waste, in my opinion, though a lot of people swear by templating systems. Again, my opinion, they're lazy typists. In any case, I think you'll find that most CMS based site presentations are based on templating engines, though I could be wrong. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com

« previous php.general (#316109) next »