SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Accredited Master scotty2260's Avatar
    Join Date
    Apr 2004
    Location
    California
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adjust Placement on a page

    I am making a 'About Us' page on a site. When the admin puts in a new section on the about us page, through php forms, I want him to select where it will appear on the page. Maybe have a drop-down menu, and whatever is selected the new entry will go just above that?

    I am assuming this would be done by telling mySQL where to insert the record, but I don't know (hence the post hehe)

    Thanks guys!
    Cheers
    Scott

  2. #2
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could if have table in the database called placement or something and have a drop down menu on a php page with the values of your placement. i.e centre! etc.

    You might also want to have a placement activation row! Where 1 = active and 2 = unactive! All the placement you wish to use could then be set to 1.

    That way you can add a WHERE clause to the SQL rather than leaving it pretty insecure.

    Then use something like this:

    placement.php

    PHP Code:
     
    $sql 
    "SELECT * FROM placement WHERE placement_activation='1'";
     
    $result mysql_query($sql)
     
    while (
    $row mysql_fetch_array($result)) {
     
    $placementValue $row['placement_value'];
     
    if (
    $placementValue == 'center') {
     
    // do the html for the placemenet
     
    }
     
    if (
    $placementValue == 'right') {
     
    // do the html for the placement
     
    } else {
     
    echo 
    ' You have not added a valid placement to the database ';
     
    }


  3. #3
    SitePoint Enthusiast SlayMan's Avatar
    Join Date
    Oct 2004
    Location
    Germany/ Hamburg
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by scotty2260
    I am making a 'About Us' page on a site. When the admin puts in a new section on the about us page, through php forms, I want him to select where it will appear on the page. Maybe have a drop-down menu, and whatever is selected the new entry will go just above that?

    I am assuming this would be done by telling mySQL where to insert the record, but I don't know (hence the post hehe)

    Thanks guys!
    Cheers
    ok this is not that much of a problem, u can use a form
    maybe
    <select name="placement" size="1">
    <option>bottom</option>
    <option>center</option>
    <option>top</option>
    <option>left</option>
    <option>right</option>
    </select>
    <input type="submit" name="submit" value="Do Placement"></input>
    (u may of course vary this to ur needs)
    this u have to simply send to $PHP_SELF and check the values
    PHP Code:
    if (isset($_GET['placement']))
    {
      switch (
    $_GET['placement'])
        {
          case 
    "top":
             <
    table align="top" (i dunno if this works)>
                
    INSERT CONTENT HERE
             
    </table>
          break;
        }

    i hope u got the idea, on how it's meant.
    SlayMan,
    Your friendly neighbourhood trainee and webmaster
    go, see for yourself @ http://www.alpupp.de

  4. #4
    Accredited Master scotty2260's Avatar
    Join Date
    Apr 2004
    Location
    California
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    errr. What I mean is, when you select something from a drop down box, it puts that content in front of the content selected.

    Here is an example: Already existing in the DB are 'Paragraph 1, P.2, and P.3" Now, you want to add a new paragraph to it with a new title. So you write 'paragraph 4', but you want ti to appear just before 'paragraph 2'. Because the paragraphs are being displayed in the order they are entered into the db... there is no 'ORDER BY' clause.

    Does that make sense? Sorry for the misleading post...
    Scott


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
  •