perl vs php round 1

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Oct 25 23:19:53 PDT 2004


On 2004-10-26 08:02, Gert Cuykens <gert.cuykens at gmail.com> wrote:
> i want to learn something that is capable to run applications on the
> web but is totally separated from the html meaning i HATE doing this
>
> hello.php
>
> code
> 110101110101010111101010
> code
> html
> he look at me
> html
> code
> 1010101011010101010101
> code
> html
> he look at me
> html
>
> i want to do this
>
> hello.class
> code
> 10101010101111001110101111111
> code
>
> hello.html
> html
> look at me
> html
>
> And i would defenatly want something with classes

This can be done just as easily with mod_perl as with php.  It all depends on
the level of abstraction that you choose to write your HTML pages in.

You can write PHP code like this:

	<html>
	  <head>
	  <title><?php connect_to_database; grab title; print title; ?></title>
	  </head>
	  <body <?php grab body style; print style; ?>>
	    <?php ugly long loop that prints some data
		  mixed with a lot of HTML code and php escapes; ?>
	  </body>
	</html>

or use your own templates for the pages you want created, and write one-liners
like the ones below:

	<?php titlepage(params); ?>
	<?php articlepage(params); ?>
	<?php feedbackpage(params); ?>

and encapsulate things in larger, logical units within the xxxpage()
collection of functions, possibly using classes if you like doing so ;-)

It's all a matter of programming style and spending the time necessary to
design your sites infrastructure, if you ask me.  I've used php for the
samples above, but mod_perl can be used too.



More information about the freebsd-questions mailing list