Page 1 of 1

PHP Script output to an HTML table

Posted: Sun May 25, 2003 10:03 am
by wknit
I am very new at this, and I want to know first of all if this can even be done...

I have a standard HTML page, I know that I can just put PHP tags in it, save it as a .php and it will display the same as if it were the original HTML page.

This page has a table with 3 columns, in the left column/cell I would like to invoke a PHP file that has an output.

The PHP script I have is a RSS parser, formatter, it works just fine when I invoke it stand alone and produces it's link to the browser. I just simply want to direct that same output to the confines of my table/cell.

Is this possible?

I don't expect anyone to write any code for me, but if it is possible... please point me in the right direction and I will try to figure it out. I have seen functionality like this on Nuke, but only desire this content in a simple page, don't need an entire CMS site.

There is no MySQL data here, just link/HTML output from a cached file on the server.

Posted: Sun May 25, 2003 2:01 pm
by Jade
Thats really easy...

Just put your script inside the table cell you want your link to show up.

<table>
<tr>
<td> <?php //script here ?></td>
<td></td>
<td></td>
</tr>

The script will now show up right in the table cell...
Jade

Posted: Sun May 25, 2003 2:02 pm
by volka
I'm not sure I got the point but....

Code: Select all

<html>
	<body>
		<table>
			<tr>
				<td style="background-color: red;">
					&nbsp;
				</td>
				<td style="background-color: green;">
					&nbsp;
				</td>
				<td>
					<fieldset><legend><?php echo $_SERVER['SCRIPT_FILENAME']; ?></legend>
						<pre><?php highlight_file($_SERVER['SCRIPT_FILENAME']); ?></pre>
					</fieldset>
				</td>
			</tr>
		</table>
	</body>
</html>
as an example of how to embed php-code into a table cell

Posted: Wed May 28, 2003 11:45 pm
by wknit
I think you understood perfectly, what I want to do is call a php script on disk to run within the context and display it's output in a table cell.

I tried your example but it didn't work, I am assuming that 'SCRIPT_FILENAME' is the same file name in both instances. I get an error when the server attempts to parse the "highlight_file" line.

Any suggestions?
volka wrote:I'm not sure I got the point but....

Code: Select all

<html>
	<body>
		<table>
			<tr>
				<td style="background-color: red;">
					&nbsp;
				</td>
				<td style="background-color: green;">
					&nbsp;
				</td>
				<td>
					<fieldset><legend><?php echo $_SERVER['SCRIPT_FILENAME']; ?></legend>
						<pre><?php highlight_file($_SERVER['SCRIPT_FILENAME']); ?></pre>
					</fieldset>
				</td>
			</tr>
		</table>
	</body>
</html>
as an example of how to embed php-code into a table cell
Thanks!

Posted: Thu May 29, 2003 2:57 am
by twigletmac
What is the error that you get?

Mac

Posted: Thu May 29, 2003 6:18 am
by volka
and what does

Code: Select all

<?php phpinfo(); ?>
tell you about the version of php?

What I am running..

Posted: Sun Jun 01, 2003 9:28 am
by wknit
Apache/1.3.26 (Unix) (Red-Hat/Linux) mod_ssl/2.8.9 OpenSSL/0.9.6 PHP/4.1.1 mod_perl/1.24_01 FrontPage/5.0.2.2510 on Linux.

Thanks for all your help so far!

Posted: Mon Jun 02, 2003 12:00 am
by discobean
wknit wrote:what I want to do is call a php script on disk to run within the context and display it's output in a table cell.
if you want to just run a script from another file try this:

Code: Select all

<table>
  <tr>
   <td><?php require_once('phpfilename.php'); ?></td>
  </tr>
</table>
Instead of require_once(), you could use require() and include() also

Marz.

!!!

Posted: Wed Jun 04, 2003 6:38 pm
by wknit
Thanks a million, that did the trick... beer for you!

Posted: Sun May 16, 2004 10:08 pm
by webweever
wknit


I'm looking for a simple script to parse rss, can you give me any hint as to how yours looks?