we have a menu that is using a php include, so we can make changes globally if necessary. the problem that i'm having is; i can't surround the "<?php include("menu.php") ?>" with div tags and use css to style it exclusively. i'm assuming it's because the browser is parsing my external css style sheet first, then moving on to the php included and adding that after the style sheet has been loaded. can anyone tell me if that is why i'm having the styling issue, or is there another reason? also, is there a way around this without having to use inline styles?
You should never have to resort to inline styles. Why can't you put the div tags in menu.php? And shouldn't you be using a folder for includes, named includes? FILE: menu.php <div id="menu"> <ul> <li>foo.</li> </ul> </div> or... <div id="foo"> <?php include(include("menu.php"); ?> </div> The PHP gets parsed first before CSS/Javascript and if you're including the menu, the menu becomes html. Then after all the HTML is done I believe the browser moves on to CSS and later Javascript (depending on how you have event handlers setup ).
thanks soulscratch. i'm actually very new to php, so i don't have it done the way i would like to. but, our company website uses it, so i definitely need to learn.
Hello, I am new to the forum so I am not sure if it is OK to add to this post. Reading the rules I didn't find any mention. I have been looking at many posts on the web and this is the closest thread to my question. I have added the div tags to the include code I use (as you suggested above) but that makes for a separate set of includes I have to update. The content is the same on the includes just the div tags are used to place the extra set of includes in a specific position. Is there anyway to use css on a php page to position the includes? I use this code for the div tag: #header_isearch { position:absolute; top: 5px; left: 5px; width: 840px; } Here is the code I use to call the header: include("../shtml/body_head5_isearch.html"); The shtml include has no body or html code in it just a table set up as a navigation bar. Here is the code: <div id="header_isearch"> <table width="830" border="1" cellpadding="0" cellspacing="0" bordercolor="#006633" height="158"> <tr bgcolor="#99CC99"> <td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#006633" bgcolor="#99CC99" height="124"> <tr bgcolor="#99CC99"> <td width="510" bgcolor="#FFFF99"> <center> <img name="largecottage" src="/Resources/largecottage.gif" width="830" height="100" border="0" usemap="#m_largecottage" alt=""> <map name="m_largecottage"> <area shape="rect" coords="43,63,113,87" href="/cart.php" alt="" > </map> <map name="m_largecottage"> <area shape="rect" coords="35,60,123,86" href="#" alt="" > </map> <map name="m_largecottage"> <area shape="rect" coords="42,61,112,85" href="/cart.php" alt="" > </map> </center> </td> </tr> </table> Much more I have abbreviated this on purpose </div> Thanks for any help you can give. Randal
I'm slightly confused as to what you want to accomplish, however, I think that you should try this: Where the include is, it should look like this: <div id="header_isearch"> <?php include("../shtml/body_head5_isearch.html"); ?> </div> Code (markup): This means the included php page does not need the div tags any longer. Let me know if this helps.
I tried your suggestion and the page goes blank and nothing shows. I even tried it in this manner: <div id="header_isearch"> include("../shtml/body_head5"); </div> But both methods don't work. The index.php page has the beginning php symbol at the top so I thought maybe it couldn't be on the page twice. I am not a php programmer but here is the symbol - <?php and the ending symbol is at the bottom of the page ?> This is exactly what I am trying to do so please continue to help. Randal
The problem with that is that you're including everything else within the PHP code, which is not actual PHP code, and will not parse. That's why your page goes blank. You need to remove the php code from the top and bottom and only display it around the real PHP code. So it needs to look like this: <div id="header_isearch"> <?php include("../shtml/body_head5.html"); ?> </div> Code (markup): Remove the php tags from anywhere else.