Jump to content

[SOLVED] Echoing a file content?


shag

Recommended Posts

Basically I have an admin area in /admin.  Once going there it will check to see if you are logged in, and if not show the login page.  Once you provide valid login details it shows the main admin area.  I have no problem simply doing echo "Admin area"; etc... But I want it to be styled to look like the rest of my website.

 

My index.php is

<? 

session_start(); 
include("database.php");
include("login.php");

?>

<html>
<link media="screen" href="style.css" type="text/css" rel="stylesheet">
<title>Admin Are</title>
<body>

<? displayLogin(); ?>

</body>
</html>

 

I saved the whole html layout of how i want the site to look as "style.txt" in login.php I have:

 

$template = file_get_contents("style.txt");

 

Then further down after it decides whether the user is logged in and if they are logged in i have:

 

function displayLogin(){
   global $logged_in;
   if($logged_in){
  echo $template;
   }
   else{ display login form again...

 

Any advice on how I can style the admin area? Or see an area where i mixed something up?  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/74020-solved-echoing-a-file-content/
Share on other sites

I understand what you are saying... I have the .css file and can

<link media="screen" href="style.css" type="text/css" rel="stylesheet">

 

But what my question is to how to get the .html in there without going through every single line... Maybe provide an example?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.