First, the basics: I'm a newbie working with Dreamweaver on Windows XP and have been working with PHP includes and echo functions. I'm even newer to MySQL, having only created a few tables and learned how to connect Dreamweaver to my database and display a MySQL table on my page.
Now I'm trying to figure out what comes next. I don't know how to manipulate MySQL with PHP and don't understand how database sites work. I've spent hours browsing through tutorials, but I still haven't found anything that answers my questions.
So I'd like to describe my current system and ask for suggestions as to how to change it. The site focuses on the world's nations, states, provinces, etc. Here's a head section from one of my pages:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
$seg = '../../../';
$myname = 'Andorra';
$mycode = 'ad';
$iso3 = 'and';
$ison = '020';
$fips = 'an';
$internet = '' . $mycode . '';
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$mysec = 'World';
$sec = 'world';
$myreg = 'Southern Europe';
$reg = 'eurs';
$nick = '(Recommend a Nickname?)';
$quote = 'I don’t know exactly what democracy is. But we need more of it.';
$sig = 'Anonymous Chinese Student, during protests in Tianamen Square, Beijing, 1989';
include ($seg."a1/inc/head.php")
?>
</head>
And here are some of the most important functions:
$seg = '../../../'; establishes the relative distance from the site's home page, for making links.
$myname = 'Andorra'; is echoed in every page's title metatag and a title div...
<div class="title"><$myname></title>
$mycode = 'ad'; is an abbreviation that's used for several purposes. It can modify elements for CSS:
<div class="title" id="title<$mycode>"> would translate
<div class="title" id="titlead">, while the United State's title would translate
<div class="title" id="titleus">
These are extra codes I included in case I need to link to another international website that uses them for its URL system:
$iso3 = 'and';
$ison = '020';
$fips = 'an';
$internet = '' . $mycode . '';
The following codes indicate the Section (World), Continent, Nation and, where approriate, State or Province, along with their abbreviations:
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$mysec = 'World';
$sec = 'world';
I plug the abbreviations (along with the "segment echo" - ../../) into an included section of code that translates it into sort of a "bread crumbs" type link path at the top of each page, like this:
Home > World > Eurasia > Andorra
The code looks something like this:
<?php
$todayDate = date("m-d-Y");
echo '<div class="toplinks">
<a href="/geosymbols/index.php">GS Home</a> >
' . $seclink . '' . $contlink . '' . $natlink . '' . $statelink . '<span class="navhere">' . $myname . '</span>
</div>'
?>
Most of the head section is currently in the form of a PHP include. It's mostly just metatags and links to style sheets and JavaScripts. But the following excerpt illustrates how I use echo functions that are translated into links based on continents, countries, etc.:
<link href="<?php echo $seg ?>a1/css/<?php echo $cont ?>/<?php echo $reg ?>.css" rel="stylesheet" type="text/css" />
This particular page is automatically linked to a Eurasia style sheet and a Southern Europe style sheet.
So I'm just trying to get a handle on what I need to do next. Should I be reading up on arrays, loops, or something else? I don't yet understand any of these functions, but I don't want to waste my time studying something I don't need.
My first impulse is to start replacing various echo functions in the head section, like this - $myname = 'Andorra'; - with the various recordset snippets I'm able to drag onto a page, like this: <?php echo $row_Recordset1['ID']; ?>
But I imagine there's a more sophisticated system.
A related question: Do I need to replace every echo statement in my head section with a corresponding snippet from my database, or can I set it up so that I only have to insert something that identifies the page as "Andorra," and the related values (abbreviation, continent, capital, etc.) automatically follow?
I'm just trying to visualize exactly where I'm going and what specific steps I need to take to get there. Thanks!