SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2003
    Location
    Temecula, CA
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A database for links

    Hello,
    I've tried to search for anything like this, but i can't find what I'm looking for. Perhaps I'm using the wrong keywords.

    I would like to know if I can create a db that 'houses' all of the links.

    Example:
    ---------- db1 ----------
    id url
    home home.com/home.htm
    about /aboutus.htm

    so I could have:
    <a link..... get id home>home</a>

    All of my links are changing, I would like to set up a db that kept all of the addresses.

    Thank you for any help you can offer.

  2. #2
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    California
    Posts
    267
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a good idea if you want to be able to dynamically change a link and have all of your pages affected instead of changing each page one by one.

    I'm not sure if a database is the best solution. Instead you could hardcode your links into an array, or something similar.

    PHP Code:
    $links = array( 'home' => 'home.com/home.htm''about' => 'aboutus.htm' );
      
      echo 
    '<a href="' $links['about'] . '">About Us</a>'
    This is just one solution. Your idea of placing them in a database isn't a bad one.

    Hope that helps.
    The Banana Stand - an Arrested Development fansite
    LC-3 Help - tutorials on the LC-3 educational assembly language


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
  •