PHP Script output to an HTML table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wknit
Forum Newbie
Posts: 6
Joined: Thu Sep 19, 2002 11:32 am

PHP Script output to an HTML table

Post 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.
Last edited by wknit on Sat May 31, 2003 11:57 am, edited 1 time in total.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post 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
Last edited by Jade on Sun May 25, 2003 2:05 pm, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
wknit
Forum Newbie
Posts: 6
Joined: Thu Sep 19, 2002 11:32 am

Post 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!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What is the error that you get?

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and what does

Code: Select all

<?php phpinfo(); ?>
tell you about the version of php?
wknit
Forum Newbie
Posts: 6
Joined: Thu Sep 19, 2002 11:32 am

What I am running..

Post 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!
User avatar
discobean
Forum Commoner
Posts: 49
Joined: Sun May 18, 2003 9:06 pm
Location: Sydney, Australia
Contact:

Post 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.
wknit
Forum Newbie
Posts: 6
Joined: Thu Sep 19, 2002 11:32 am

!!!

Post by wknit »

Thanks a million, that did the trick... beer for you!
User avatar
webweever
Forum Newbie
Posts: 7
Joined: Sun May 16, 2004 9:56 pm

Post by webweever »

wknit


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