Hey,

I solved one problem and can't get rid of another. I have used spry menus before with no problem. Now that I want to use the efficiency of an include statement for my navigation it won't style correctly. Here is the site I'm working on. The problem shows on the first page if viewed from a PC and on every page on tablet (I have a Samsung and assume the same results apply to tablets period).

Thanks a bunch for the help. This is getting fruatrating. I'm done with the site except for this one stubborn problem.

Member Avatar for LastMitch

The problem shows on the first page if viewed from a PC and on every page on tablet (I have a Samsung and assume the same results apply to tablets period).

You have to post the code. Not sure if it's CSS or PHP code.

It's impossible to see the PHP code and not sure what you are talking about?

Here is the div with the include inside:

<div id="main">
<img src="images/bigpic.jpg"  alt="register to study abroad">
<?php include 'menu.html';?>
</div>

Here is the html that is included:

<script type="text/javascript" src="SpryMenuBar.js"></script>

<ul id="MenuBar1" class="MenuBarHorizontal" style="margin-top:-6px">
  <li><a href="index.php" title="home">Home</a>  </li>
  <li><a href="inec-about-us.php" title="about us">About Us</a></li>
  <li><a href="inec-mildred-fennal.php" title="dr. fennal">Our Founder</a>  </li>
  <li><a href="inec-current-projects.php" class="MenuBarItemSubmenu">Current
      Projects</a>
    <ul>
      <li><a href="inec-study-abroad.php" title="study abroad with INEC">Study
          Abroad</a></li>
    </ul>
  </li>
  <li><a href="inec-partners-and-members.php" title="partners and members">Partners &amp; Members</a></li>
  <li><a href="inec-volunteer.php" title="volunteer with INEC">Volunteer</a></li>
  <li><a href="inec-contact.php" title="Get in touch with us">Contact Us</a></li>
</ul>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryMenuBarDownHover.gif", imgRight:"SpryMenuBarRightHover.gif"});
//-->
</script>

Here's the CSS for "main":

#main {
    width:67%;
    margin-left:16.5%;
    margin-right:16.5%;
    margin-top:1.25em;
}

I appreciate your time

Member Avatar for LastMitch

When you used the include function in PHP you have to used php file not html

The file should be called menu.php not menu.html

Instead of this:

<?php include 'menu.html';?>

it should be this:

<?php include 'menu.php'; ?>

The problem shows on the first page if viewed from a PC and on every page on tablet (I have a Samsung and assume the same results apply to tablets period).

What is the issue?

You code doesn't contain any HTML5 or CSS3 code that can affect the browsers.

The Spry code doesn't affect any browsers either.

When you used the include function in PHP you have to used php file not html

Are you sure?
It is not mandatory to have php extension.You can include html page

When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags.

Manual just says the whole page is included and if there is php script then it must contain php start and end tag.
Click Here

The problem shows on the first page if viewed from a PC and on every page on tablet (I have a Samsung and assume the same results apply to tablets period).

@Reliable: can you tell what exactly the problem is?

I have also used the spry menu that work well but as per the your problem concern i like to say that you have to use the menu.php file that might be useful to you. The code described on this post which is really good but some mistakes found that is regarding HTML or CSS code.

When you used the include function in PHP you have to used php file not html

Incorrect. Quoted from the documentation: "When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags."

Also see example #3. It includes a text file.

Assuming all of you are responding after clickign the link provided and knowing the problem, I will try renaming the .html file with .php to see if that helps. I also have nother idea: to simply remove the navigation from the "main" div. Once it it its own entity perhaps I can simply set a maring or a float to give it proper alignment. I'll post which I use/works.

Problem solved. Replacing the .html with .php didn't help. I gave it its own div with a left margin. All is well now. With such a simple solution I feel like I had an "uh duh" moment. If the container something is in is too small just give it a bigger container (if possible). THAT's not rocket science. lol

Thanks for the suggestion though. I apprecaite all of you taking the time to try and help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.