OSdata.com: holistic issues 

OSdata.com

example source code
celebrityinfo.php

    Building a game — open source code This is the actual source code from a new web game. See the game at thissideofsanity.com and read how this was built starting at example code.

    This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.

    Copyright 2013 Milo (for software), Distribution and website handled by Strazbick.com

    Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    This narrative uses anchor links so that you can follow the building of this software in chronological order. Go to software explanation to start reading. Go to thissideofsanity.com to see the working software.

Google

example source code
celebrityinfo.php

JavaScript for celebrity info
first pass example

    Code to generate celebrity information block.

    There is a little arrow button. If the user clicks oon the arrow, the timer stops on the current celebrity and the information block on that celebrity is fetched from the server and inserted into the web page. If the user clicks on the arrow again, then the celebrity info disappears and the timer resumes.

    Notice that this is a design preview rather than working code. This serves as a static placeholder until the real software is written. This allows testing of the functionality of the JavaScript and AJAX in isolation of the building and testing of a real celebrity information block.

<?php ?>

<hr>
<h3 align="center">latest news</h3>

<p align="left">the latest celebrity news goes right here</p>

<hr>

<h3 align="center">comments</h3>

<p align="left">comment 1
<br>comment 2
<br>comment 3</p>

<h3 align="center">photos</h3>

<table align="center" border="0">

<tr align="left"><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="./testpict/blankpicture.png" width="57" height="57"></td></tr>

</table>

<?php   ?>

return to explanation of source code

celebrity information block
second pass

    Have the server provide information on a celebrity.

<?php

// include function files for this application
   require_once('./php/databasefunctions.php');

/******************************/
/* ProcessCelebrity                                      */
/* draw a celebrity information block            */
/******************************/
function ProcessCelebrity($celebrityinfo,$reporteduser,$gamenumber)
{

//Connect To Database
$celebrityconnection = ConnectCelebDataBase(0); /* located in databasefunctions.php */

/* GET CELEBRITY NUMBER */
$currentround = GetRoundNumber($gamenumber);

$celebritytitle = 'rd'.$currentround.'item'.$celebrityinfo;

$gamequery = "SELECT ".$celebritytitle." FROM games WHERE gamenumber=".$gamenumber.";";

$gameresult = mysql_query($gamequery);

$row = mysql_fetch_array($gameresult);

$celebritynumber = $row[$celebritytitle];


/* GATHER CELEBRITY INFO */
$newquery = "SELECT mainname,realname,birthborough,birthcity,birthcounty,birthstate,birthsubnation,birthnation,mainpicture,birthdate,slamcount,lovecount FROM celebrity WHERE celebnum=".$celebritynumber.";";
//echo '<br>query is '.$newquery; /* DEBUG */

$selectresult = mysql_query($newquery);

$row = mysql_fetch_array($selectresult);

$realname = $row["realname"];
$mainname = $row["mainname"];
$birthborough = $row["birthborough"];
$birthcity = $row["birthcity"];
$birthcounty = $row["birthcounty"];
$birthstate = $row["birthstate"];
$birthsubnation = $row["birthsubnation"];
$birthnation = $row["birthnation"];
$mainpicture = $row["mainpicture"];
$birthdate = $row["birthdate"];
$slamcount = $row["slamcount"];
$lovecount = $row["lovecount"];

/* DRAW NAME AND PHOTO */
echo '<p align="center"><img src="./cpict/'.$mainpicture.'" width="220" height="220"></p>';
echo '<h1 align="center">'.$mainname.'</h1>';
echo '<p align="left"><big><b>Real name: </b></big>'.$realname;

/* DRAW NAME AND PHOTO */
echo '<br><br><big><b>Slams: </b></big>'.$slamcount;
echo '<br><big><b>Loves: </b></big>'.$lovecount;

/* BIRTH INFO */
/* FORMAT BIRTH DATE */
$outputstring = '<br><br><big><b>Birth date: </b></big>';

$birthdate = $birthdate.' 00:00+00:00';
$birthday = date( "l, F j, Y", strtotime($birthdate) );
$outputstring = $outputstring.$birthday;

echo $outputstring;

/* FORMAT BIRTH PLACE */
$outputstring = '<br><big><b>Birth place: </b></big>';
if ( $birthborough != '' )
  $outputstring = $outputstring.$birthborough.', ';
if ( $birthcity != '' )
  $outputstring = $outputstring.$birthcity.', ';
if ( $birthcounty != '' )
  $outputstring = $outputstring.$birthcounty.', ';
if ( $birthstate != '' )
  $outputstring = $outputstring.$birthstate.', ';
if ( $birthsubnation != '' )
  $outputstring = $outputstring.$birthsubnation.', ';
if ( $birthnation != '' )
  $outputstring = $outputstring.$birthnation;

echo $outputstring;


?>

<hr>
<h3 align="center">latest news                  </h3>

<p align="left">the latest celebrity news goes right here</p>

<hr>

<h3 align="center">comments                  </h3>

<p align="left">comment 1
<br>comment 2
<br>comment 3</p>

<h3 align="center">photos                  </h3>

<table align="center" border="0">

<tr align="left"><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td></tr>

<tr align="left"><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td><td width="90"><img src="../testpict/blankpicture.png" width="57" height="57"></td></tr>

</table>

<?php

} /* ProcessCelebrity */

?>

return to explanation of source code


OSdata.com is used in more than 300 colleges and universities around the world

Find out how to get similar high web traffic and search engine placement.


OSdata.com is used in more than 300 colleges and universities around the world

Read details here.


    A web site on dozens of operating systems simply can’t be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.

    Click here for our privacy policy.


previous page next page
previous page next page

home page


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2013 Milo

    Last Updated: September 20, 2013

    Created: October 31, 2013

previous page next page
previous page next page