Exploding Garrmondo Weiner Interactive Swiss Army Penis

Exploding Garrmondo Weiner Interactive Swiss Army Penis (http://www.gamingforce.org/forums/index.php)
-   Help Desk (http://www.gamingforce.org/forums/forumdisplay.php?f=36)
-   -   Page development how-to (http://www.gamingforce.org/forums/showthread.php?t=20008)

Cal Mar 13, 2007 06:31 AM

Page development how-to
 
Found a copy of GoLive (CS2 8). Need to make a catalogue page that's able to relist a collection of info (DVDs, CDs, etc) by certain attributes. Descending order by artist, by release date, by label, etc.

I figure I'm looking at forms plus something else but I don't know what. Any help? Or noob sites out there for GoLive? Or better options altogether? (I only nicked GL because it was small.) Only web development I've ever done was a handcoded html ArrDev fansite.

Arainach Mar 13, 2007 09:55 AM

You have two options:

(1) Hardcoded HTML. You have to update every page anything happens, which is ugly.

(2) Use a Database and PHP (or ASP.NET if you find that simpler). The code isn't tough at all, but you'd have to have a webserver with PHP and a Database.

A slightly more detailed version:

I'm using PHP since I know it and don't know ASP.

I'm using a sample table I call "discs" with the following rows:

title (string), artist (string), label (string), date (int)

Obviously your version could include more. A quick-and-dirty page (you could format it much nicer) that you could write would be something more like:
Code:

<? // config.php - Config Variables
$mysql_server = "www.myserver.com";
$mysql_username = "username";
$mysql_password = "password";
?>

Code:

<? // filename.php - Simple Album Browser
// Brian Beck, 2007

include('config.php');

// Get the passed variable of what to sort by.  Default to title.
if(!isset($_GET['sort_by'])) $sortby = 'title';
else $sortby = $_GET['sort_by'];
// Get the passed sorting order.
if(isset($_GET['order_by']) && ($_GET['order_by'] == 'desc')) $order = 'desc';
else $order = 'asc';

// use pconnect (persistent connect) to prevent server stress of reconnecting
// every time we reload the page
$dbConn = mysql_pconnect($mysql_server, $mysql_username, $mysql_password);

$query = 'SELECT title, label, artist, date FROM discs WHERE 1=1';
// use manual checks for values of passed variables to prevent exploits
if ($sortby == 'title') $query .= ' ORDER BY title';
else if ($sortby == 'label') $query .= ' ORDER BY label';
else if ($sortby == 'artist') $query .= ' ORDER BY artist';
else if ($sortby == 'date') $query .= ' ORDER BY date';

// if we need to be descending, do so

if ($order == 'desc') $query .= ' DESC';

// Perform the Query
$results = mysql_query($query);
?>
<table>
<tr> <td>Title</td> <td>Artist</td> <td>Label</td> <td>Date</td> </tr>
<?
// Display the results
while( $result = mysql_fetch_assoc($results) ) {
  echo '<tr><td>'.$result['title'].'</td><td>'.$result['artist'].'</td><td>'.$result['label'].'</td><td>'.$result['date'].'</td></tr>';
}
?>
</table>

<a href="<?=$PHP_SELF?>?sort_by=date&order_by=desc">A Sample Link</a>
<? // That's the general format for links in the rest of the (HTML) portions
// of the page.  sort_by can be any of the fields (date, artist, title, label)
// and order_by can be asc or desc ?>


Cal Mar 14, 2007 05:37 AM

Cheeeeaz.

Also I should specify that I'm using my alloted 10mb webspace my ISP (Hellstra) provided me, simply because it's free.

Arainach Mar 14, 2007 05:10 PM

Most free webservers have no scripting languages and pretty much none have databases. So you're pretty much screwed. Have fun maintaining that hardcoded stuff.


All times are GMT -5. The time now is 01:46 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.