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

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
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

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

Post 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? :?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You could always store the information in a database.
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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. :?
DrTom
Forum Commoner
Posts: 60
Joined: Wed Aug 02, 2006 8:40 am
Location: Las Vegas

Post 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..
Post Reply