Author |
Message |
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
|
Back to top |
|
|
Brazucs I have no idea what my avatar is.
Super Elite (Last Title)
Joined: 31 Mar 2004 Posts: 3349
|
Posted: 21 Dec 2005 02:51:37 pm Post subject: |
|
|
Very good! Might want to fix some color mismatches, but great otherwise.
Keep on chuggin' |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 21 Dec 2005 02:56:14 pm Post subject: |
|
|
I don't know what to think, I can't see your code. I'll see if I can give some tips if you post it. : ) |
|
Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
Posted: 22 Dec 2005 10:23:30 am Post subject: |
|
|
Thanks, I'll post it if I get a chance |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 22 Dec 2005 12:25:08 pm Post subject: |
|
|
There's that red-on-blue-background thing again. :o
I'll tell you what: I dipped into the source and made some changes. If you like what you see, you can keep it.
Revamped Page
Revisions worth mentioning are as follows:
- Added a background image that suits the theme.
- Changed some of the text colors:
- text="#eed5a8"
- link="#eed5a8"
- vlink="#dac194"
- alink="#dac194"
- Remodeled the borders, you might say.
- Proposed a fixed width to the lower table.
- Got rid of the (notorious) non-breaking space entities.
- Cleaned up the script layout in general.
I used CSS notation most of the time. It's been way too long for me to remember how to write in "HTML 1.0." |
|
Back to top |
|
|
kermmartian Site Admin Kemetech
Calc Guru
Joined: 20 Mar 2004 Posts: 1220
|
Posted: 22 Dec 2005 01:57:10 pm Post subject: |
|
|
Not bad, keep up the learning. |
|
Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
Posted: 22 Dec 2005 04:33:37 pm Post subject: |
|
|
thanks....anyway, here's my soure:
<!---------index.php---->
Code: <html>
<head>
<title>
<?php
print("Jake and Thomas' 19th Century Inventions Page");
define("inInventions", null);
?>
</title>
</head>
<body bgcolor="#97F3FC" text="#FF9093" link="#FF9093" vlink="#FF9093">
<center>
<h1>
Inventions of the 19th Century
</h1>
<h2>
by Thomas Dickerson and Jacob Hobbs
</h2>
</center>
<br>
<?php include("header.php"); ?>
<br>
<table border="2" align="center" valign="center" bgcolor="#000000">
<tr><td>
<font color="#FFFFFF">
<?PHP
$invention = $_GET['invention'];
if ($invention == "cottongin"){
include("cottongin.php");
}
else if ($invention == "mechreaper"){
include("mechreaper.php");
}
else if ($invention == "sodafountain"){
include("sodafountain.php");
}
else if ($invention == "refrigerator"){
include("refrigerator.php");
}
else if ($invention == "bicycle"){
include("bicycle.php");
}
else if ($invention == "morsecode"){
include("morsecode.php");
}
else if($invention == ""){
include("default.php");
}
else{
echo(" We're sorry, the page you requested could not be found.<br> If you are sure the page you requested should be there, please <a href="mailto:elfprince13@gmail.com">contact the Webmaster</a>");
}
?>
</font>
</td></tr></table>
<br>
<?php include("footer.php"); ?>
<br>
</body>
</html>
<!----------sample invention------refrigerator-->
Code: <?php
if(!defined("inInventions")){
header('Location: index.php?invention=refrigerator');
exit;
}
?>
Early Refrigerator
Before mechanical refrigeration systems were introduced, people cooled their food with ice and snow, either found locally or brought down from the mountains.
The first cellars were holes dug into the ground and lined with wood or straw and packed with snow and ice: this was the only means of refrigeration for most of history.
However in 1834, Jacob Perkins invented a mechanically cooled icebox which was the predecessor to our modern refrigerator
<!------------header.php----->
Code: <?php
if(!defined("inInventions")){
header('Location: index.php');
exit;
}
?>
<table bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" border="1" align="center" valign="top">
<tr>
<td><a href="index.php?invention="><b>Main Page</b></a></td>
<td><a href="index.php?invention=cottongin">Cotton Gin</a></td>
<td><a href="index.php?invention=mechreaper">Mechanical Reaper</a></td>
<td><a href="index.php?invention=sodafountain">Soda Fountain</a></td>
<td><a href="index.php?invention=refrigerator">Refrigerator</a></td>
<td><a href="index.php?invention=morsecode">Morse Code</a></td>
<td><a href="index.php?invention=bicycle">The Bicycle</a></td>
</tr>
</table>
<!-----------footer.php---->
Code: <?php
if(!defined("inInventions")){
header('Location: index.php');
exit;
}
?>
<center>
<font size="2">
This is site is hosted by <a href="http://rancidmoose.unitedti.org">StickFigure Graphic Productions</a>
</font>
</center>
|
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 22 Dec 2005 04:56:07 pm Post subject: |
|
|
I see you are trying to seperate areas of the page, you're gonna love toying around with making your own template engine. : )
Basically, what you do, is read a .html (or whatever) file for the layout.
The .html file contains custom tags which your engine replaces with content from variables.
Then it echos the lot.
I can send you my first template engine if you want, very basic but get's the job done.
Last edited by Guest on 22 Dec 2005 04:56:36 pm; edited 1 time in total |
|
Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
Posted: 22 Dec 2005 08:44:27 pm Post subject: |
|
|
please do....the phpbb one is confusing |
|
Back to top |
|
|
AlienCC Creative Receptacle!
Know-It-All
Joined: 24 May 2003 Posts: 1927
|
Posted: 22 Dec 2005 10:08:44 pm Post subject: |
|
|
There is also the version 0.2 of ZeFaux available for download in this thread: http://www.unitedti.org/index.php?showtopic=3862
--AlienCC
Last edited by Guest on 22 Dec 2005 10:08:59 pm; edited 1 time in total |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 23 Dec 2005 12:29:20 pm Post subject: |
|
|
elfprince13 wrote: please do....the phpbb one is confusing
[post="65033"]<{POST_SNAPBACK}>[/post]
index.php
Code: <?php
/* 1. SET UP CONNECTION */
include ( "include/connection.php" ); //creates db object $db
session_start(); //so all pages can use the session
////////////////
/* 2. OPEN TEMPLATE */
include( "content/content.php" ); //default header/index/footer content
include( "content/home.php" ); //default page
include( "include/template_parser.php" ); //template parse engine
$template_filename = "template/template.html"; //template to use
////////////////
/* 3. INCLUDE REQUESTED PAGE */
if ( @fopen ( "content/" . $_GET["page"] . ".php", "r" ) ) //try to open appropriate content file (so only existing pages are included)
include( "content/" . $_GET["page"] . ".php" ); //include content file
////////////////
/* 4. PROCESS TEMPLATE */
echo parseTemplate( $template_filename );
////////////////
?>
connection.php
Code: <?php
$db = mysql_connect( 'host', 'user', 'password' )
or die( 'Could not connect to database: ' . mysql_error() );
mysql_select_db( 'db' ) or die( 'Could not select database ( ' . mysql_error() . ' )' );
?>
template_parser.php
Code: <?php
function parseTemplate( $sTemplateFileName ) {
if ( !$rTemplateFile = fopen( $sTemplateFileName , "r" ) ) {
// echo "<b> Error </b> : Template file could not be read.";
} else {
$sTemplate = fread( $rTemplateFile , filesize( $sTemplateFileName ) ); //read template file
//loop through template elements and replace with the content variable for each one ( {template_element} in html is replaced with contents of $sTemplate_element )
while( ereg( "\{[a-z\_]+\}", $sTemplate ) ) {
preg_match( "/\{[a-z\_]+\}/i", $sTemplate, $array ); //get next template element
$var = $array[0];
$var = substr( $var, 1, strlen( $var ) -2 ); //remove the {}
$var = "s" . strtoupper( substr( $var, 0, 1 ) ) . substr( $var, 1, strlen( $var ) - 1 ); //s + UPPERCASE + rest = "sMain" for example
@$sTemplate = preg_replace ( "/\{[a-z\_]+\}/i", $GLOBALS[$var], $sTemplate, 1 ); //replace it with the content of ${$var}
}
}
return $sTemplate;
}
?>
example template:
Code: <html>
<head>
<title> Titel </title>
<link rel="stylesheet" type="text/css" href="include/css.txt" />
</head>
<body>
<div class="header">
{header}
</div>
<div class="index">
{index}
</div>
<div class="main">
<center> <div class="maintitle"> {pagetitle} </div> </center>
<center> <div class="subindex"> {subindex} </div> </center>
{main}
</div>
<div class="footer">
{footer}
</div>
</body>
</html>
example content file: (home.php)
Code: <?php
$sPagetitle = "News";
$sMain = "Welcome to .. , if you wish to know what this site is all about, check out the about section by clicking the link above. You can read about the latest developments below.. <br />
<br />
{news_area} <br />"; //the parser keeps going untill there are no more elements to process so we can ask for new elements inside content files too..
include( "news.php" ); //$sNews_area is defined in news.php which gets the news from the database
?>
It's nothing fancy, doesn't have a CMS, does nothing but show pages, but I hope it gives you a bit of an idea of how template scripts work. I recommend getting content from a database instead, I should have a template script that does that somewhere but I can't find it at the moment.
Last edited by Guest on 23 Dec 2005 12:35:31 pm; edited 1 time in total |
|
Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
Posted: 23 Dec 2005 09:15:55 pm Post subject: |
|
|
thanks, I'll start playing with this after I get back from Chistmas break :-) which reminds me...look at the calendar for this month :-) |
|
Back to top |
|
|
|