Jump to content


Photo

PHP Includes and Notepad


  • Please log in to reply
14 replies to this topic

#1 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 08:40 PM

I've never bothered to use PHP before, but now.. I am? Anyway, I coded everything in notepad, but when I went to save it, it was still a notepad document. It wasn't a PHP page.

When I saved the file, I typed in "header.php" and it didn't work. But when I type in "header.html" it becomes an html file, so how come it isn't working for the PHP file?

Does it just not work for notepad? Do I need to use a different program? I don't think it would be the case, but you never know. Help anyone?

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 08:49 PM

Notepad usually adds ".txt" extensions to file names. To prevent this add quotes around the file name when saving, i.e.,  "header.php".

P.S. Take a look at Notepad++.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 26 July 2006 - 08:50 PM

it's probably because notepad recognizes the HTML extension.  try specifying "All Files" as the file type, and using .php as the extension.  when it doesn't recognize the extension and is set to a ".txt Text File" (or something similar), it will just append the .txt.  you'll find that the file is named header.php.txt for that exact reason.

EDIT:  you and your speedy typing, effigy.

#4 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 26 July 2006 - 09:00 PM

Sorry if you have done this,
It's also possible that you haven't installed Apache/PHP etc. so that your files aren't doing anything at all. If you'd like an easy set-up to get you started try: http://easyphp.org/?lang=en
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#5 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 09:06 PM

Thank you very much, I got the php page exttension worked out. ^^ One more question though.

I added the includes, but now I've received a message on the page saying "Parse error: parse error, unexpected ':' in /home/www/ghopen8.freehostia.com/blog.php on line 1"
The link is http://ghopen8.freehostia.com/blog.php ...if that helps any? I don't understand what I did wrong.

#6 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 09:07 PM

What does the code look like? Did you mean ; instead?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#7 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 09:13 PM

<?php include(’http://ghopen8.freehostia.com/header.php’);?>

All work and no play makes for a very dull Ghostie. All work and no play makes for a very dull Ghostie. All work and no play makes for a very dull Ghostie. 

<?php include(’http://ghopen8.freehostia.com/footer.php’);?>

That's the blog page coding.

#8 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 09:17 PM

The funky quotes may be an issue--did you copy this from Word? Fix these. If that doesn't solve the problem, there could be something incorrect in header.php.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#9 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 09:39 PM

I got it from peachie.nu and then from another site. Various sites have had the same code. I looked at header.php, but I can't see the problem.

This is the header...
<html><head><title>a thousand paper cranes | desiree</title><LINK 

REL=stylesheet HREF="http://ghopen8.freehostia.com/css.css" 

TYPE="text/css"></head>

<body><div style="position: absolute; top:0; left:0;"><TABLE BORDER="0" 

CELLPADDING="0" CELLSPACING="0" WIDTH="800" HEIGHT="600">

<TR>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree0" SRC="desiree_1x1.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="5" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree1" SRC="desiree_1x2.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree2" SRC="desiree_1x3.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree3" SRC="desiree_1x4.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree4" SRC="desiree_2x1.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="5" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree5" SRC="desiree_2x2.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree6" SRC="desiree_2x3.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree7" SRC="desiree_2x4.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree8" SRC="desiree_3x1.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="5" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree9" SRC="desiree_3x2.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree10" SRC="desiree_3x3.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="200" HEIGHT="111">
	<IMG NAME="desiree11" SRC="desiree_3x4.jpg" WIDTH="200" 

HEIGHT="111" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="112">
	<IMG NAME="desiree12" SRC="desiree_4x1.jpg" WIDTH="200" 

HEIGHT="112" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="5" WIDTH="200" HEIGHT="112">
	<IMG NAME="desiree13" SRC="desiree_4x2.jpg" WIDTH="200" 

HEIGHT="112" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="3" WIDTH="200" HEIGHT="112">
	<IMG NAME="desiree14" SRC="desiree_4x3.jpg" WIDTH="200" 

HEIGHT="112" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="200" HEIGHT="112">
	<IMG NAME="desiree15" SRC="desiree_4x4.jpg" WIDTH="200" 

HEIGHT="112" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="108" HEIGHT="16">
	<IMG NAME="desiree16" SRC="desiree_5x1.jpg" WIDTH="108" 

HEIGHT="16" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="60" HEIGHT="16">
	<A HREF="GHOSTIE"><IMG NAME="desiree17" SRC="desiree_5x2.jpg" 

WIDTH="60" HEIGHT="16" BORDER="0" ALT="Self-proclaimed Queen"></A></TD>
<TD ROWSPAN="1" COLSPAN="2" WIDTH="58" HEIGHT="16">
	<A HREF="VISITOR"><IMG NAME="desiree18" SRC="desiree_5x3.jpg" 

WIDTH="58" HEIGHT="16" BORDER="0" ALT="Content for well... the visitor. 

A.K.A. you"></A></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="74" HEIGHT="16">
	<A HREF="TUTORIALS"><IMG NAME="desiree19" 

SRC="desiree_5x4.jpg" WIDTH="74" HEIGHT="16" BORDER="0" ALT="Learn 

something!"></A></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="53" HEIGHT="16">
	<A HREF="SITE"><IMG NAME="desiree20" SRC="desiree_5x5.jpg" 

WIDTH="53" HEIGHT="16" BORDER="0"></A></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="38" HEIGHT="16">
	<A HREF="EXITS"><IMG NAME="desiree21" SRC="desiree_5x6.jpg" 

WIDTH="38" HEIGHT="16" BORDER="0" ALT="Ready to leave 1000 Paper 

Cranes?"></A></TD>
<TD ROWSPAN="1" COLSPAN="2" WIDTH="67" HEIGHT="16">
	<A HREF="CONTACT"><IMG NAME="desiree22" SRC="desiree_5x7.jpg" 

WIDTH="67" HEIGHT="16" BORDER="0" ALT="Something to say?"></A></TD>
<TD ROWSPAN="1" COLSPAN="1" WIDTH="41" HEIGHT="16">
	<A HREF="CLEAR"><IMG NAME="desiree23" SRC="desiree_5x8.jpg" 

WIDTH="41" HEIGHT="16" BORDER="0" ALT="Back to the homepage, 

dearie."></A></TD>
<TD ROWSPAN="1" COLSPAN="2" WIDTH="301" HEIGHT="16">
	<IMG NAME="desiree24" SRC="desiree_5x9.jpg" WIDTH="301" 

HEIGHT="16" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="8" WIDTH="400" HEIGHT="69">
	<IMG NAME="desiree25" SRC="desiree_6x1.jpg" WIDTH="400" 

HEIGHT="69" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="4" WIDTH="400" HEIGHT="69">
	<IMG NAME="desiree26" SRC="desiree_6x2.jpg" WIDTH="400" 

HEIGHT="69" BORDER="0"></TD>
</TR>

<TR>
<TD ROWSPAN="1" COLSPAN="8" WIDTH="400" HEIGHT="70">
	<IMG NAME="desiree27" SRC="desiree_7x1.jpg" WIDTH="400" 

HEIGHT="70" BORDER="0"></TD>
<TD ROWSPAN="1" COLSPAN="4" WIDTH="400" HEIGHT="70">
	<IMG NAME="desiree28" SRC="desiree_7x2.jpg" WIDTH="400" 

HEIGHT="70" BORDER="0"></TD>
</TR>

<TR>
<TD WIDTH="108" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="108" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="60" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="60" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="32" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="32" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="26" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="26" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="74" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="74" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="53" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="53" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="38" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="38" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="9" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="9" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="58" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="58" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="41" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="41" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="101" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="101" HEIGHT="1" 

BORDER="0"></TD>
<TD WIDTH="200" HEIGHT="1">
	<IMG NAME="blank" SRC="blank.gif" WIDTH="200" HEIGHT="1" 

BORDER="0"></TD>
</TR>
</TABLE></div>

<div id="blog" style="position:absolute; top: 483; left: 68 width: 435; padding: 

0px; background-color=96BE92">

If you don't feel like looking at that, I understand.

#10 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 09:46 PM

Try deleting the funky quotes and replacing them with normal apostrophes/single quotes (').
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#11 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 26 July 2006 - 09:47 PM

I think effigy's right, PHP uses single ' and double " quotes, not the backticks as far as I know.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#12 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 09:50 PM

Which files are you referring to, in header.php or blog.php? Or both. And in every single part of the code?

It's just that I've always used quotes in codes and it always worked. But I don't recall using backticks.



#13 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 09:52 PM

Backticks are valid in PHP; they run system commands. Your quotes are not single, double, or even backticks--without getting too technical, they're odd. Replace the quotes that are in your include statements from ’ to '.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#14 time turn fragile

time turn fragile
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 July 2006 - 10:04 PM

Problem was solved. Thanks for your help everyone. ^^ Now I just need to figure out why my div layer isn't working. Sheesh. But it works! Thanks again.

By the way, effigy, I like the quote underneath your avatar.

#15 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 26 July 2006 - 10:58 PM

Thanks :) In case you don't know, it's accredited to this guy--a favorite of mine.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users