[RESOLVED] Defining headers, body and footers

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LuiePL
Forum Commoner
Posts: 40
Joined: Fri Aug 04, 2006 11:38 pm

[RESOLVED] Defining headers, body and footers

Post by LuiePL »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Yes, I'm a noob, let me get that out of the way first. I just starting using php Tuesday, and found it to be simililar to what I've used in the past as far as accessing databases. But I was never really one for programming.

Now, onto my question. I was checking out [url=http://www.zend.com/zend/tut/feedback.php]this tutourial[/url], and figured I'd try it out on a website I'm working on transitioning to php. Now from what I've read in order for me to set cookies properly, I need to set them before any HTML, which is why I want to use this technique.  However when I upload it to my server, it doesn't work, and shows the "$head = <<" tag everywhere. I would like to create a quick login at the top left of the page so members can sign in any time as well as the main login page. Does anyone have any experience using this technique? Or am I better off just putting the php code throught the page?

My server has php version 4.4.2 if it makes a difference.

This is the website as it looks now:
[url]http://www.dvmrs.org/MembersNew/index.php[/url]

Code: Select all

<?php
$head = <<<ENDH
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>Feedback form</title>
  </head>

  <body bgcolor="white">
    <h1 align=center>Feedback form</h1>
ENDH;

$tail = <<<ENDT
    <hr>
  </body>
</html>
ENDT;
?>
Thanks for the help!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by LuiePL on Sat Aug 05, 2006 3:13 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sounds like your server isn't set up to run the files as php.
LuiePL
Forum Commoner
Posts: 40
Joined: Fri Aug 04, 2006 11:38 pm

Post by LuiePL »

Just a quick reply... I tried putting \ before every singe solitary " within the $head = <<<ENDH , body and tail, and it did nothing to help it out, even though the code all became the same color (in my editor), which was what I thought I was going for, and thought maybe I forgot to do. But that didnt make a difference, and it seemed like it actually made things worse.

Now everything is back where I want it on the page so you can see what I'm going for, but I just need to figure out how to get it to work so I can seperate the php code from the HTML code for better editing. Thanks again.
LuiePL
Forum Commoner
Posts: 40
Joined: Fri Aug 04, 2006 11:38 pm

Post by LuiePL »

feyd wrote:sounds like your server isn't set up to run the files as php.
Well it works fine when running other php stuff. I've setup the basic members only section. I have it setup so administrators can add and delete users, and also so people can change there passwords. But for some reason this stuff isnt working.

This is my version info page. I don't know if it's something in there that needs to be changed or what...
http://www.dvmrs.org/MembersNew/phpversion.php
LuiePL
Forum Commoner
Posts: 40
Joined: Fri Aug 04, 2006 11:38 pm

Post by LuiePL »

I was looking through some other php files and saw "require ____.php" I think this might do what I want. I would have my header, body and tail code in seperate files and jus call them as needed. This would reduce my overall file size too, I'll have to look into it a little more...
LuiePL
Forum Commoner
Posts: 40
Joined: Fri Aug 04, 2006 11:38 pm

Post by LuiePL »

Got it working using "require header/body/tail.php"...
Post Reply