Using include files

Discuss all aspects of programming here.

Moderator: The Mod Squad

Postby MoboCop » Tue Dec 14, 2004 8:58 am

Toby B. wrote:The extension is .html


you need to tell php to parse .html files or change the ext to .php

As it stands now it is treating your php code as text. It is not parsing the html file as php code.

so what I would do is save a copy as .php now. Add the quotes to the includes and then run it. See what happens.
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Toby B. » Tue Dec 14, 2004 9:12 am

hmm, as index.html the php code will not show as it is supposed to. But as index.php it works.....

Is there a trick to getting php to work in .html files?
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby MoboCop » Tue Dec 14, 2004 9:51 am

Toby B. wrote:hmm, as index.html the php code will not show as it is supposed to. But as index.php it works.....

Is there a trick to getting php to work in .html files?


yes you have to add a handler in your php.ini file or in an htaccess file.

looks like this.

AddHandler application/x-httpd-php .html
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Toby B. » Tue Dec 14, 2004 6:14 pm

MoboCop wrote:
Toby B. wrote:hmm, as index.html the php code will not show as it is supposed to. But as index.php it works.....

Is there a trick to getting php to work in .html files?


yes you have to add a handler in your php.ini file or in an htaccess file.

looks like this.

AddHandler application/x-httpd-php .html
IIRC the php.ini file is part of the server software which I have no access to (i am on a shared server not a dedicated server.)...

for an htaccess file I would just create a .htaccess file and upload it to main/root directory???
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby MoboCop » Tue Dec 14, 2004 9:05 pm

Toby B. wrote:
MoboCop wrote:
Toby B. wrote:hmm, as index.html the php code will not show as it is supposed to. But as index.php it works.....

Is there a trick to getting php to work in .html files?


yes you have to add a handler in your php.ini file or in an htaccess file.

looks like this.

AddHandler application/x-httpd-php .html
IIRC the php.ini file is part of the server software which I have no access to (i am on a shared server not a dedicated server.)...

for an htaccess file I would just create a .htaccess file and upload it to main/root directory???


I believe so. I dont mess with htaccess files so your best bet is google it real quick for some examples. SHould be plentiful.
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Toby B. » Sat Jan 08, 2005 1:50 am

Well I haven't figured out the issue on my "live" server but I got some headway on my test server. BUT I have run into a slight problem....

Unexpected T_VARIABLE on line 3:

Code: Select all
<?php
include ('includes/header.inc')
$meta_title = "Index";
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%" bgcolor="#000000">
<TR>
<td width="125" align="left" valign="top" bgcolor="#8b0000">
<table border="0" cellpadding="5" cellspacing="0" align="center" valign="top" width="98%"><tr><td>
<center><a href="http://www.qksrv.net/click-1542161-5835141" target="_blank" onmouseover="window.status='http://www.crucial.com/index.asp';return true;" onmouseout="window.status=' ';return true;">
<img src="http://www.qksrv.net/image-1542161-5835141" width="125" height="600" alt="Memory from Crucial.com" border="0"></a></center></td></tr></table>
</td>
<td width="700" align="left" valign="top" bgcolor="#FFFFFF"><table border="0" cellpadding="5" cellspacing="0" width="100%">
   <TR>
<td>

<H1>Index</H1>
<hr/>

<div class="contentheader"><b>Welcome to <i>Ctechinfo</i></b></div>

<table valign="top" style="border: 0px solid black; border-collapse: collapse; margin: 5; background color: transparent; float: left; width: 100%;">
<TR><TD>
      <p align="left">         This site is a colaborative effort between several people from from 3 different countries, and 2 continents. The idea of creating a site devoted to Compaq motherboard and system information was first tossed around approximately 3 years ago. Hardware Junkie started us off with 10 boards and we cotinued on a path that far exceeded any expectations. With the addition of HP info we now have detailed information on roughly 300 motherboards and that number keeps growing on a regular basis. If you cannot find what you need here, feel free to drop by <a href="./forum/index.php">our forum</a>.</p>

       <p align="left">         The ultimate plan for this site is to develop an indepth, detailed support site that provides accurate information. Some of the information we have collected is not even availible at any other site on the net.
       </p><br/>
<br/>
<br/>
       <p align="center"><img src="./images/formfctr.jpg" ALT="Presario PC's"></p>
<br/>
   </TD></TR></table>
</td></tr>
</table>
</td><td valign="top" align="right" width="125" bgcolor="#8b0000"><table border="0" cellpadding="5" cellspacing="0" align="center" valign="top" width="100%"><tr><td><center><a href="http://www.qksrv.net/click-1542161-8286434" target="_blank" onmouseover="window.status='http://www.lunarpages.com';return true;" onmouseout="window.status=' ';return true;">
<img src="http://www.qksrv.net/image-1542161-8286434" width="125" height="600" alt="500MB of storage for $7.95 a month!" border="0"></a></center>


</td>
</tr>
</table>
</body>
</HTML>
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Toby B. » Sat Jan 08, 2005 3:07 am

I got it figured out...

Code: Select all
<?php
$meta_title = "Index";
include ('includes/header.inc')
?>
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby MoboCop » Sat Jan 08, 2005 11:07 am

Toby B. wrote:I got it figured out...

Code: Select all
<?php
$meta_title = "Index";
include ('includes/header.inc')
?>


cool.
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Toby B. » Sat Jan 08, 2005 6:32 pm

Yes very cool! Somehow I managed to reverse the $meta_title and the include... :oops:

Now on to setting up an array for naming the pages.. :wink:
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests