showhits.php shouldn't output on screen when called from PHP

Moderators: Moderator Team, Development Team

showhits.php shouldn't output on screen when called from PHP

Postby V@no on Tue Dec 23, 2003 1:07 am

IMHO I think that when showhits.php being called from PHP it should return needed value in a variable instead of print it on screen.
Here are few reasons:

1. Some scripts using templates witch means that the page being printed only after compilining by the script. So if u do include showhits.php it will output the result on screen before the entire page showed on screen.
2. In some cases current showhits.php might produse a "Header already sent..." error.
3. Sometimes u might want do something else with the date from showhits.php (store in the database, or maybe include the result in a file)
Image
User avatar
V@no
 
Posts: 161
Joined: Sat Nov 15, 2003 2:57 pm

Postby sdjl on Tue Dec 23, 2003 2:53 am

I can see what you mean by this.
Would be far nicer to be able to request which data showhits.php outputs to the browser, if any at all :)

David
User avatar
sdjl
Moderator
 
Posts: 1282
Joined: Mon Nov 17, 2003 1:13 am
Location: London, UK

Postby V@no on Tue Dec 23, 2003 6:33 am

yeah, that would be a good feature too...(feels some discrimination towards PHP, by showing only text and not as images :))

Currently my feature request (get the result in a variable and not on screen) could be done only by something like this:
Code: Select all
<?php
  $id = "name";
  $st = "php";
  $type = "hits";
  ob_start();
  include (PPHL_SCRIPT_PATH."showhits.php");
  $pphresult = ob_get_contents();
  ob_end_clean();
?>

$pphresult variable would have the number of hits...
Image
User avatar
V@no
 
Posts: 161
Joined: Sat Nov 15, 2003 2:57 pm

Postby sdjl on Tue Dec 23, 2003 12:33 pm

Oh, there's no discrimination between image and PHP.
You can still output as an image with showhits.php:

<img src="showhits.php?id=[username]&type=[type]&st=img">

David
User avatar
sdjl
Moderator
 
Posts: 1282
Joined: Mon Nov 17, 2003 1:13 am
Location: London, UK


Return to Phlogger3 feature requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron