You are here: Re: Can this be done with PHP? « PHP Programming Language « IT news, forums, messages
Re: Can this be done with PHP?

Posted by Toby A Inkster on 06/21/07 06:45

-1 wrote:

> If after the analysis in part A, data is displayed on the webpage, then it
> would display and part B would not run and the php script would terminate.
> If after the analysis in part A, data is not displayed on the webpage, then
> and only then would part B run.

Output buffering. The code below assumes that when part A fails it
literally outputs nothing -- i.e. not even a blank line or an error
message. With a bit of modification you could cope with error messages
though.

<?php

// Run part A and save contents instead of outputting it.
ob_start();
virtual('/cgi-bin/analysis.pl');
$buf = ob_get_clean();

// Check if there was no output from part A
if ($buf=='')
{
// Part B goes here.
}

// Otherwise, there was some output from part A
else
{
// So send the output to the browser.
print $buf;
}

?>

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 10:18.]

dict, thes & ency
http://tobyinkster.co.uk/blog/2007/06/18/dict-thes-ency/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация