|
From: David T. <ju...@ba...> - 2002-07-25 19:27:35
|
Or, we could use my personal favorite, a Document class that has begin("title")
and end() functions.
I'd have to say I'm more in favor of individual PHP files (instead of .inc's)
for each function:
matchresult.php
teams.php
etc
But thats just me.
-D
-- Quidquid latine dictum sit, altum videtur --
On Thu, 25 Jul 2002, Richard Charlton wrote:
> I am of the opinion that the current "put everything into one script" is far too
> cluttered and difficult to read, especially with features being added all the
> time.
>
> I propose two possible solutions:
>
> ____________________________
>
> 1)
>
> Different .php files are used for different pages, with three .inc files
> "paths.inc", "functions.inc" and "common.inc". "paths.inc" will include all the
> paths to various stuff, the connection to mysql etc. etc., "functions.inc" any
> common functions, while "common.inc" will deal solely with the output.
>
> Then the framework for every script would be
> <?php
> include "paths.inc";
> include "functions.inc";
> $mainbody =3D "<p>Welcome to the CTF site</p>";
> $mainbody .=3D "<p>We have had x hits....";
> $title =3D "Welcome";
> /* some other stuff */
> include "common.inc";
> ?>
>
> common.inc will include the template: instead of using "echo" in the scripts
> you will append to a variable $mainbody your text which will be then echoed by
> common.inc at the end, likewise $title, $sidebar, $extrahead (mainly scripts
> that might need to be used) etc etc.
>
> ____________________________
>
> 2)
>
> In keeping with the 1 script idea you could do everything with .incs:
>
> You have index.php as it is now except all the functions at the top are moved
> into "functions.inc" (like in suggestion 1), and each page has its own .inc:
>
> <?php
> /* mysql stuff, topbar etc etc */
> include "functions.inc";
> switch($link){
> case "matchresult":
> include "matchresult.inc";
> break;
> case "teams":
> include "teams.inc";
> break;
>
> /* more stuff..... */
>
> default:
> include "frontpage.inc";
> break;
> }
>
> The stuff for each individual page will be in the corresponding .inc file
> ____________________________
>
> I am in favour of the latter suggestion, though I would welcome any comments or
> refutations of my idea.
>
> Many thanks
>
> ----------------
> Ritchie
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Jabber - The world's fastest growing
> real-time communications platform! Don't just IM. Build it in!
> http://www.jabber.com/osdn/xim
> _______________________________________________
> BZFlag-league mailing list
> BZF...@li...
> https://lists.sourceforge.net/lists/listinfo/bzflag-league
>
|