Jump to content
Larry Ullman's Book Forums

Hide The Sidebar...


Recommended Posts

  • 2 weeks later...

Hey Abigail,

 

Here is the code out of the book. It lies in the footer.html file. I'm thinking I need to use a different footer so as to hide the sidebar?

 

 

<?php // Show the user info or the login form:

if (isset($_SESSION['user_id'])) {

 

// Show basic user options:

// Includes references to some bonus material discussed in Chapter 5!

echo '<div class="title">

<h4>Manage Your Account</h4>

</div>

<ul>

<li><a href="renew.php" title="Renew Your Account">Renew Account</a></li>

<li><a href="change_password.php" title="Change Your Password">Change Password</a></li>

<li><a href="favorites.php" title="View Your Favorite Pages">Favorites</a></li>

<li><a href="history.php" title="View Your History">History</a></li>

<li><a href="recommendations.php" title="View Your Recommendations">Recommendations</a></li>

<li><a href="logout.php" title="Logout">Logout</a></li>

</ul>

';

 

// Show admin options, if appropriate:

if (isset($_SESSION['user_admin'])) {

echo '<div class="title">

<h4>Administration</h4>

</div>

<ul>

<li><a href="add_page.php" title="Add a Page">Add Page</a></li>

<li><a href="add_pdf.php" title="Add a PDF">Add PDF</a></li>

<li><a href="#" title="Blah">Blah</a></li>

</ul>

';

}

 

} else { // Show the login form:

 

require ('includes/login_form.inc.php');

 

}

?>

Link to comment
Share on other sites

remove this


echo '<div class="title">
<h4>Manage Your Account</h4>
</div>
<ul>
<li><a href="renew.php" title="Renew Your Account">Renew Account</a></li>
<li><a href="change_password.php" title="Change Your Password">Change Password</a></li>
<li><a href="favorites.php" title="View Your Favorite Pages">Favorites</a></li>
<li><a href="history.php" title="View Your History">History</a></li>
<li><a href="recommendations.php" title="View Your Recommendations">Recommendations</a></li>
<li><a href="logout.php" title="Logout">Logout</a></li>
</ul>
';

and replace it with what you want?

  • Upvote 1
Link to comment
Share on other sites

  • 2 weeks later...

You might be able to change the css, if there is width specified, but if that class is used other places then it will change those also.

That's why you have to change the code somehow.

Another idea, maybe your php could identify that page then eliminate that section of code just for that page.

Link to comment
Share on other sites

In your index page, before you include the footer file, do this:

$pag = 'home';

 

The reason I didn't use $page is either in case it is a reserved keyword somewhere or I already use that variable somewhere else.

 

You can give other pages names such as:

$pag = 'register';

 

In your footer file, do this:

if (isset($pag) && ($pag=='home')) {
  ' only do your code when home page
}

 

You need to check if it isset because you might forget to set it in all you pages .

It should be pretty easy to implement. Larry teaches it in one of his other books.

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...