...

View Full Version : Help making a sidebar



Pandabeer
03-04-2009, 08:11 PM
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


/* Sidebar */

#sidebar {
float: left;
width: 260px;
}

#sidebar ul {
margin: 0;
padding: 0 0 20px 0;
list-style: none;
}

#sidebar li {
}

#sidebar li ul {
padding: 0px 21px 20px 10px;
}

#sidebar li li {
border-bottom: 1px dotted #363B3F;
background: url(images/img03.gif) no-repeat 0px 40%;
padding: 0 0 10px 15px;
}

#sidebar h2 {
margin: 0;
height: 35px;
padding: 8px 0px 10px 13px;
background: url(images/img02.jpg) repeat-x left top;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 18px;
color: #FFFFFF;
}

#sidebar h2 a {
background: url(images/img03.gif) no-repeat left 50%;
}

#sidebar a {
}

#sidebar a:hover {
text-decoration: none;
}

this is the sidebar in html


<!-- 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 -->

Fou-Lu
03-04-2009, 08:17 PM
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.


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.

Pandabeer
03-04-2009, 08:19 PM
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 (:p)

Fou-Lu
03-04-2009, 08:34 PM
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.

Pandabeer
03-04-2009, 09:00 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum