Jump to content
Larry Ullman's Book Forums

Recommended Posts

In the header.html why is there PHP? What makes the PHP work?

 

The dropdown menus are not working in the header.html on page 69.

 

// Show basic user options:

// Includes references to some bonus material discussed in Part Four!

echo '<li class="dropdown">

<a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a>

<ul class="dropdown-menu">

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

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

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

<li><a href="favorites.php">Favorites</a></li>

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

</ul>

</li>';

 

// Show admin options, if appropriate:

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

echo '<li class="dropdown">

<a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin <b class="caret"></b></a>

<ul class="dropdown-menu">

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

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

<li><a href="#">Something else here</a></li>

</ul>

</li>';

}

 

I read in a forum that html does not recognize html in the server. What should I do? 

Share this post


Link to post
Share on other sites

The header.html file is included in a php file. So the server sees a php file primarily and hence executes it as php.

On page 66, it reads that a person needs to receive the code on template.html. Then continuing on with adding new code in the next few pages. In all that information, It reads nowhere what you just quoted me on this forum.

 

I really appreciate your help Mr. Jonathan.

Share this post


Link to post
Share on other sites

The e-commerce book does assume basic familiarity with PHP and MySQL, and how PHP works with includes would be in that category. In short, the end result of an included file is it's as if the code in the included file were part of the file including it. 

Share this post


Link to post
Share on other sites

The most basic debugging step would be to make sure you're always running the site through a URL, not through a file system. Also, to be clear, you're loading the PHP pages directly (e.g., index.php), not the header file, right?

Share this post


Link to post
Share on other sites

What do you mean by "I go directly to the page that I am working on"? What URL are you viewing in your browser when you're seeing this (the header not creating the menus)?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...