Jump to content

Displaying content inside a table sourced via readfile


Kolusion

Recommended Posts

I am wanting HTML to render within a table and sourcing the data from another file. In an attempt to do this, I tried:

<TABLE class="main">
                <TR>
                        <TD>
                                <?php
                                        readfile('./1/index.html');
                                ?>
                        </TD>
                </TR>
        </TABLE>

 

This does not work and I am wondering if anyone knows how it can be done - or even if it can be done?

That link is 404.

 

I tried:

        <TABLE class="main">
                <TR>
                        <TD>
                                <?php
                                        include('./1/index.html');
                                ?>
                        </TD>
                </TR>
        </TABLE>

.. but it didn't work.

Try this...

 

<TABLE class="main">
                <TR>
                        <TD>
                                <?php
                                        include($_SERVER['DOCUMENT_ROOT'].'/1/index.html');
                                ?>
                        </TD>
                </TR>
        </TABLE>

 

You need to specify exactly where the file is located.

Sure,

 

The root path is:

/var/www/test1.com/

 

The include\readfile path (the file I want being rendered into the table:

/var/www/test1.com/products/1/index.html

 

The HTML file in reference that holds the table called "main" we are talking about is:

/var/www/test1.com/products/index.html

Okay, Try this:

 

<TABLE class="main">
                <TR>
                        <TD>
                                <?php
                                        include($_SERVER['DOCUMENT_ROOT'].'/products/1/index.html');
                                ?>
                        </TD>
                </TR>
        </TABLE>

Here is something that enforces my original thought.

 

<?php
include('./1/index.html');
?>

When I put this code into its own .php file an run it, it works. So the code is valid. Now to the question, why won't it work inside a table?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

        "http://www.w3.org/TR/html4/strict.dtd">

<TITLE>X</TITLE>

<META content="charset=windows-1252;text/html" http-equiv="content-type">

<STYLE type="text/css">

BODY

	{

		background-attachment:fixed;

		background-image:url("/bodybackground.png");

		background-position:center;

		background-repeat:no-repeat;

		font-family:verdana

	}

IMG.logo

	{

		left:50%;

		margin-left:-635px;

		margin-top:-355px;

		position:absolute;

		top:50%

	}

SPAN.accountmenu

	{

		left:50%;

		margin-left:589px;

		margin-top:-352px;

		position:absolute;

		top:50%

	}

SPAN.mainmenu

	{

		left:50%;

		margin-left:374px;

		margin-top:-331px;

		position:absolute;

		top:50%

	}

A.silver

	{

		color:silver;

	}

TABLE.main

	{

		background-color:gold;

		height:636px;

		left:50%;

		margin-left:-635px;

		margin-top:-307px;

		position:absolute;

		top:50%;

		width:1270px

	}

A.legal

	{

		color:silver;

		left:50%;

		margin-left:-90px;

		margin-top:334px;

		position:absolute;

		top:50%

	}

</STYLE>

<DIV>

<IMG alt="" class="logo" src="../../../logo.png">

<SPAN class="accountmenu">

	<A class="silver" href="/login">Login</A>

</SPAN>

<SPAN class="mainmenu">

	<A class="silver" href="/contact">Contact</A> |

	<A class="silver" href="/information">Information</A> |

	<A class="silver" href="/products">Products</A>

</SPAN>

<TABLE class="main">

	<TR>

		<TD>

			<?php

				include('./1/index.html');

			?>

		</TD>

	</TR>

</TABLE>

<A class="legal" href="/legal">© X 2012</A>

</DIV>

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.