Page 1 of 1

[RESOLVED] Defining headers, body and footers

Posted: Sat Aug 05, 2006 12:23 am
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]

Posted: Sat Aug 05, 2006 12:26 am
by feyd
sounds like your server isn't set up to run the files as php.

Posted: Sat Aug 05, 2006 12:31 am
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.

Posted: Sat Aug 05, 2006 12:36 am
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

Posted: Sat Aug 05, 2006 12:31 pm
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...

Posted: Sat Aug 05, 2006 3:12 pm
by LuiePL
Got it working using "require header/body/tail.php"...