Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Help making a sidebar

    hey,

    how do i create a sidebar i know php a little but i want to make one file sidebar (sidebar.php) include it in my html files so i dont need to open all html files one by one for a new page. please help meh


    this is the sidebar.css

    PHP Code:
    /* Sidebar */

    #sidebar {
        
    floatleft;
        
    width260px;
    }

    #sidebar ul {
        
    margin0;
        
    padding0 0 20px 0;
        list-
    stylenone;
    }

    #sidebar li {
    }

    #sidebar li ul {
        
    padding0px 21px 20px 10px;
    }

    #sidebar li li {
        
    border-bottom1px dotted #363B3F;
        
    backgroundurl(images/img03.gifno-repeat 0px 40%;
        
    padding0 0 10px 15px;
    }

    #sidebar h2 {
        
    margin0;
        
    height35px;
        
    padding8px 0px 10px 13px;
        
    backgroundurl(images/img02.jpgrepeat-x left top;
        
    font-familyGeorgia"Times New Roman"Timesserif;
        
    font-size18px;
        
    color#FFFFFF;
    }

    #sidebar h2 a {
        
    backgroundurl(images/img03.gifno-repeat left 50%;
    }

    #sidebar a {
    }

    #sidebar a:hover {
        
    text-decorationnone;

    this is the sidebar in html

    PHP Code:
        <!-- start sidebar -->
        <
    div id="sidebar">
            <
    ul>
                <
    li>
                    <
    h2>Menu</h2>
                    <
    ul>
                        <
    li><a href="/index.html">Home</a></li>
                      <
    li><a href="/news.html">News</a><a href="#"></a></li>
                      <
    li><a href="/whoarewe.html">Who are we?</a></li>
                      <
    li><a href="/history.html">History</a></li>
                      <
    li><a href="http://www.forum. NO AD :) .eu">Forum</a></li>
                      <
    li><a href="/donating.html">Donating</a></li>
                      <
    li><a href="/poll.html">Poll</a></li>
                      <
    li><a href="/bases.html">Bases</a></li>
                  </
    ul>
              </
    li>
                <
    li><ul>
                  <
    li><a href="/clans.html">Clans</a></li>
                  <
    li><a href="/admins.html">Admins</a></li>
                  <
    li><a href="/credits.html">Credits</a></li>
                  <
    li><a href="/contact.html">Contact us</a></li>
                  </
    ul>
              </
    li>
            </
    ul>
        </
    div>
        <!-- 
    end sidebar --> 
    Last edited by Pandabeer; 03-04-2009 at 08:14 PM. Reason: added some codes

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You would use an include or require call to add it in where you want it to show up. The other option is to convert the sidebar.html into a php script and print out via a function call. Then you can simply include at the top of the script and place a function call to generate you're output data.

    Edit:
    I should mention this as well, any of the files that are including this need to either be a .php file, or have .htm[l] files set up to be parsed as php files. Otherwise a call to include will result in the literal text include('./sidebar.html'); instead of the intended replacement.
    Last edited by Fou-Lu; 03-04-2009 at 08:20 PM.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    You would use an include or require call to add it in where you want it to show up. The other option is to convert the sidebar.html into a php script and print out via a function call. Then you can simply include at the top of the script and place a function call to generate you're output data.
    the sidebar thing i posted came out of index.html, can you create a php script of that, i can learn much by seeing the change ()

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    The only thing that makes a PHP script on a web server is what is stated by its extension. Rename sidebar.html to sidebar.php and it will be a PHP file.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    well i got it working but not 100% so $^@$ the sidebar, do you have a clear / good tut, how to make a full php site (prefers incl. login system to post news) with header, footer, sidebar, content


  •  

    Posting Permissions

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