SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Will you make my site for me?

    Just joking; I'm not asking you to build an entire website for me - just a couple pages. More precisely, I wondered if I might ask if anyone would be willing to post the code for a very simple webpage and a hypothetical corresponding database.

    I've been working with PHP includes, and I've made MySQL databases. But I haven't learned how to use databases to manipulate pages, nor have I figured out how to navigate the username/password maze and get them online.

    This is what I'm trying to do:

    I'm working on a series of websites focusing on the world's nations.

    PHP Code:
    <!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 'Arizona';
    $mycode 'az';
    $iso3 '';
    $ison '';
    $fips '';
    $internet '' $mycode '';
    $mynat 'United States';
    $nat 'us';
    $mycont 'North America';
    $cont 'na';
    $mysec 'World';
    $sec 'world';
    $seclink '<a href="../../index.php">' $mysec '</a> &gt; ';
    $url '' . ((!empty($sec)) ? ($sec '/') : '') . ((!empty($cont)) ? ($cont '/') : '') . ((!empty($nat)) ? ($nat '/') : '') . ((!empty($state)) ? ($state '/') : '');
    $urlworld '' . ((!empty($cont)) ? ($cont '/') : '') . ((!empty($nat)) ? ($nat '/') : '') . ((!empty($state)) ? ($state '/') : '');
    $myreg 'Southwest';
    $reg 'sw';
    $nick 'The Grand Canyon State';
    include (
    $seg."a1/inc/head.php")
    ?>
    </head>
    Here are some of the more important elements:

    $seg = '../../../'; simply establishes the relative link distance from the site's home page.

    The title of every page is $myname, which, of course, is automatically translated to Arizona, in this case.

    $mysec, $mycont, $mynat and $mystate identify the section (e.g. World), continent, nation and state, while $sec, $cont, $nat and $state are matching codes for linking purposes.

    $myname = 'Arizona';
    $mycode = 'az';
    $mynat = 'United States';
    $nat = 'us';
    $mycont = 'North America';
    $cont = 'na';
    $mysec = 'World';
    $sec = 'world';

    Thus, the items below are strung together to form world/na/us/az

    $sec = 'world';
    $cont = 'na';
    $nat = 'us';
    $mycode = 'az';

    This string is then converted to <a href="">../../../../world/na/us/az/index.php</a>

    when matched to another include:

    PHP Code:
    <?php
    $todayDate 
    date("m-d-Y");
    echo 
    '<div class="toplinks">
    <a href="/geosymbols/index.php">GS Home</a> &gt; 
    $seclink '' $contlink '' $natlink '' $statelink '<span class="navhere">' $myname '</span>
    </div>'
    ?>
    To cut to the chase, when I ask questions about includes, I invariably get feedback suggesting I use loops, functions, databases, etc. I've browsed some of the documentation and looked at some tutorials, but it's far too complex.

    So I was wondering if someone would make a working model for me - greatly simplifed.

    For example, let's strip the head section down to just a few elements, primarily Section (World), Continent, Nation and State.

    PHP Code:
    <!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 'Arizona';
    $mycode 'az';
    $mynat 'United States';
    $nat 'us';
    $mycont 'North America';
    $cont 'na';
    $mysec 'World';
    $sec 'world';
    include (
    $seg."a1/inc/head.php")
    ?>
    </head>
    Let's also say this website focuses only on the continents and on countries in North America. Can you help me visualize what a corresponding database would look like?

    Obviously, there's just one world, divided into six continents. Let's say North America is the first continent. So we could give North America a value of 1 in the database. Or can we use an alphabetical identifier, like na?

    So let's call North America 1 and/or na, South America 2 and/or sa.

    Let's say the U.S. is one of three North American nations and give it a value of 2 and/or us.

    Then let's call Arizona the third state (alphabetically) and give it 3 and/or az.

    Can someone recommend numerical and/or alphabetical values, then show me what the head section above might look like if it was plugged into such a database, rather than PHP includes?

    I THINK I'm dealing with just two elements here - the target page (including the head section I posted above) and a matching database that drives it. I just can't visualize exactly what it looks like or how it works.

    Let's say the database features only the following:

    The six continents
    Three nations (Canada, U.S. Mexico)
    Four states (Alabama, Alaska, Arizona & Arkansas)

    If I could see a working model of a head section matched to this imaginary database, it might help me get a grip. Then I'll go back to square one, make the database (with all the nations and states), figure out how to connect it to Dreamweaver and get it online, etc.

    Sorry for the lengthy post. Thanks!

  2. #2
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or here's an even better idea - is it possible to copy databases and pages driven by them to other websites? If so, I'd love to get a copy of a working system, no matter how simple.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •