Page 1 of 1

show a text inner a html page through php, php link inner ht

Posted: Fri Feb 02, 2007 3:46 pm
by visonardo
hello, i have this file

Code: Select all

<?
function vts(){
	$fp = fopen("visitas.txt","r"); //no olvidar crear al archivo visitantes.txt y poner el path correcto
	while($ip2 = fgets($fp)){ 
	    $ips=$ip2; 
	} 
	fclose($fp);
	$ips=intval($ips);
	$ips++; 
	$fp = fopen("visitas.txt","w+"); //no olvidar crear al archivo visitantes.txt y poner el path correcto
	fwrite($fp, $ips); 
	    fclose($fp); 
	return $ips;
} 
?>
and i want show the value returned by vts. i have so much pages, i would like to do something that i add in each html page like thus

"http://page.com/views.php", well, i dont know how explain, but i want domething like webstatus4u, that you add a single link and done, (others) shown the views amount.

thus

<img src="mysite.com/views.php" border=0>

but reall that dont show an image just a text (if is an image no problem, but i guess that is more work to). I can solve that including this php file in all html pages that will be not more html pages, then php pages :s, i dont want change their extentions and dont include in the page like if apache read html pages because doesnt.


who can i do that? :?

Posted: Fri Feb 02, 2007 6:52 pm
by RobertGonzalez
You could always store the information in a database.

Posted: Fri Feb 02, 2007 8:30 pm
by visonardo
yes, i knew that, but the problem is that are sooo much html file and i dotn want rename all to php and add php code just to show this numer, just i want something like it:

<img src="phpfile.php?show=on" border=0>

i guess that to do what i want is generating a dinamic image with php and i would show that. :?

Posted: Fri Feb 02, 2007 8:38 pm
by DrTom
You can't really 'include' another html file(or a php file that outputs html) from an html file.
You can either
A) Make them PHP files and use include
or
B) Resort to using iframe

Anyway, those are the ideas I have..