LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2005, 07:14 PM   #1
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
non embedded php script


Hello, could someone please show me an example of the tag to link to an external php script? Been googling for awhile and all I find are embedded scripts.
Thank you in advance.
 
Old 10-10-2005, 07:30 PM   #2
bertlef
Member
 
Registered: Dec 2004
Location: Costa Rica
Distribution: Ubuntu
Posts: 69

Rep: Reputation: 17
In order for you to call a php script you have to parse it trought a *.php file, so it MUST be embedded.
Not sure if I get what you want, you are trying to load an html file and call a php script in another file?

If so, maybe you can just make a .php file with 99% html, and only put
<?php include('scriptfile.php'); ?>

This will call the file with the script.
 
Old 10-10-2005, 07:32 PM   #3
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
yep thats what I needed.Thank you.
 
Old 10-10-2005, 11:33 PM   #4
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
Would someone take a look at this please, what I am trying to do is include this php file a hit counter:

Code:
<?php

$COUNT_FILE = "../data/count_data.txt";
$IMG_DIR_URL = "../images/digits/";
$NB_DIGITS = 8;

if (file_exists($COUNT_FILE)) {
	// Open, read, increment, save and close file.
	$fp = fopen("$COUNT_FILE", "r+");
	flock($fp, 1);
	$count = fgets($fp, 4096);
	$count += 1; 
	fseek($fp,0);
	fputs($fp, $count);
	flock($fp, 3);
	fclose($fp);
} else {
	//Display a error message if file does not exist.
	echo "Can't find file, check '\$file' var...<BR>";
	exit;
}

chop($count);
$nb_digits = max(strlen($count), $NB_DIGITS);
$count = substr("0000000000".$count, -$nb_digits);

$digits = preg_split("//", $count);

for($i = 0; $i <= $nb_digits; $i++) {
	if ($digits[$i] != "") {
		$html_result .=  "<IMG SRC=\"$IMG_DIR_URL$digits[$i].gif\">";
	}
}

echo $html_result;
?>
into this index.html file
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>test</title>
<link type="text/css" rel="stylesheet" href="templ/styles.css"/>
</head>
<body>
<div class="banner">
<img src="images/lordtitle.jpg" class="lordMainImg"/>
</div>
<div class="div1" style="overflow:hidden; height:25px; padding-top:3px;">
<marquee>
<script>
zerosandOnes();
</script>
</marquee>
</div>
<div class="div1">
<p class="intro">some text here<p>
</div>
<div class="div1" style="margin-top:100px;">
<a href="theTemple.html">enter</a><a href="http://www.google.com" style="padding-left:15px;">exit</a>
</div>
<?php include('php/count.php'); ?>
<div class="banner" style="margin-top:60px;">
<img src="images/sub.gif" class="subApache"/>
<img src="images/banner3.gif" class="subBSD"/>
</div>
</body>
</html>
I have tried like you see above and also with renaming the file index.php.Apache does not seem to serve my php page to me as index.php.I have looked through httpd.conf for a way to do this, maybe I missed it..What I would really like is for the php file to be included as I am trying and the hit counter to be displayed.Could someone help me please?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
embedded bash in perl script paul_mat Linux - Software 3 11-21-2005 01:46 PM
javascript calls to embedded echo'd php forms xemous Programming 1 08-21-2005 06:29 AM
issues with mirc script accessing our php script dtra Linux - Software 2 07-02-2005 04:30 PM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM
converting shell script to php script ? ibro Linux - General 6 05-24-2004 05:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration