eRott Posted November 17, 2006 Share Posted November 17, 2006 Ok, I have a slight problem that I am wondering if someone could help me out with. Like the title says, I want to include a php file, inside of html code, that is inside of more php code. What I mean by that is that if you look at the code below, you will notice $head = " this is a section of a php file. Now this $head variable is just the header of a template. Anyway, thats not the point. To simplify it, the:Blue = PHP script in the php fileGreen = HTML code inside that PHP codeRed = The php file I want to include but am having trouble doing so[b][color=blue]$head = "[/color][/b][color=green]<html><head><LINK href='../lib/style.css' rel='stylesheet' type='text/css'><title>TITLE</title></head><body><center><div id='wrapper'><div id='topnav'><div class='nav'>[/color][color=red]<? include('../lib/userlogin.php'); ?>[/color][color=green]</div></div><div id='header'><a href='../index.php'><img src='../images/logo.png' border='0' alt='aaa' title='aaa'></a></div><div id='mainnav'><a href='../index.php'><img src='../images/01home.jpg' alt='Home' border='0' height='49' width='191' /></a><a href='../plans.php'><img src='../images/02plans.jpg' alt='Plans' border='0' height='49' width='197' /></a><a href='#'><img src='../images/03forums.jpg' alt='Forums' border='0' height='49' width='201' /></a><a href='#'><img src='../images/04support.jpg' alt='Support' border='0' height='49' width='211' /></a></div><div id='menu'>[/color][color=red]<? include('../admin/lib/nav.php'); ?>[/color][color=green]</div><div id='content'><div class='ads'><p><center>[/color][color=red]<? include('../lib/ads.php'); ?>[/color][color=green]</center></p></div>[/color][b][color=blue]";[/color][/b]Could anyone please help me out with this problem of how to include a php file, that is inside of html code, that is inside of php script (if its no too confusing :P). Thanks.(edit: just replace all of the [b]/url[/b] 's you see with [b]/a[/b] 's because this changes them since I couldnt put it in the code tag since it doesnt allow colors.) Quote Link to comment Share on other sites More sharing options...
taith Posted November 17, 2006 Share Posted November 17, 2006 unfortunatly, this cannot be in side of a variable...[code]<? include('../admin/lib/nav.php'); ?>[/code]what you'd want to do is end the variable, and in that file, have that information there appended to the $head... Quote Link to comment Share on other sites More sharing options...
eRott Posted November 17, 2006 Author Share Posted November 17, 2006 I figured you cannot have that inside of a variable. However, I am not too sure how to do what you are saying. Little bit more help please :D Quote Link to comment Share on other sites More sharing options...
taith Posted November 17, 2006 Share Posted November 17, 2006 ok :-) basically speaking...[code]$head = "<html><head><LINK href='../lib/style.css' rel='stylesheet' type='text/css'><title>TITLE</title></head><body><center><div id='wrapper'> <div id='topnav'> <div class='nav'>";include('../lib/userlogin.php');$head .= "</div> </div> <div id='header'> <a href='../index.php'><img src='../images/logo.png' border='0' alt='aaa' title='aaa'>[/url] </div> <div id='mainnav'> <a href='../index.php'><img src='../images/01home.jpg' alt='Home' border='0' height='49' width='191' />[/url]<a href='../plans.php'><img src='../images/02plans.jpg' alt='Plans' border='0' height='49' width='197' />[/url]<a href='#'><img src='../images/03forums.jpg' alt='Forums' border='0' height='49' width='201' />[/url]<a href='#'><img src='../images/04support.jpg' alt='Support' border='0' height='49' width='211' />[/url] </div> <div id='menu'>";include('../admin/lib/nav.php');$head .= "</div> <div id='content'> <div class='ads'> <p><center><? include('../lib/ads.php'); ?></center></p> </div>";[/code]then in the nav.php etc. have that info also encompased by the "$head .= " Quote Link to comment Share on other sites More sharing options...
eRott Posted November 17, 2006 Author Share Posted November 17, 2006 Ok, well, I tried it and it works. Well, sorta. Its included now, but it's not showing up where it's supposed to. I didnt add the "$head .=" to the files being included, because they are also called in different pages, so editing them is not really an option. Any other ideas? And thank you for the help.(edit: just added it to the other files being included to see what would happen and it does nothing.) Quote Link to comment Share on other sites More sharing options...
taith Posted November 17, 2006 Share Posted November 17, 2006 no... not really any other way of doing it... other then typing it over, or changing the other pages... Quote Link to comment Share on other sites More sharing options...
eRott Posted November 17, 2006 Author Share Posted November 17, 2006 Yea, i think Ill just type it over. Thank you for your help though. Im sure this new knowledge will come in handy for something in the future. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.