Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can !
Moderator: General Moderators
serfczar_
Forum Commoner
Posts: 34 Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:
Post
by serfczar_ » Sun Mar 25, 2007 12:55 pm
I know my php code is right, and I just recently installed php5 and apache2 on my localhost. i moved some scripts over and the include doesn't seem to want to parse my template.class.php file! and when I click view source it has that file there in text version, what should I do?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Mar 25, 2007 1:22 pm
Did you write the file with short open tags?
serfczar_
Forum Commoner
Posts: 34 Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:
Post
by serfczar_ » Sun Mar 25, 2007 3:41 pm
feyd wrote: Did you write the file with short open tags?
no i didn't here is the two files...
Code: Select all
<?php include'include/config.php'; include'include/class/template.class.php'; ?>
the first include seems to be fine i think....
This is the included file, returning to the browser full text of the file.
Code: Select all
<?
class Template {
public $template;
function load($filepath) {
$this->template = file_get_contents($filepath);
}
function replace($var, $content) {
$this->template = str_replace("#$var#", $content, $this->template);
}
function amend($var, $content) {
if($_POST['amend'] != ""){
$temp0 = $_POST['amend'];
$temp1 = $_POST['amend'];
$temp1 .= $content;
$this->template = str_replace($temp0, $temp1, $this->template);
}
else{
$_POST['amend'] = $content;
$this->template = str_replace("#$var#", $content, $this->template);
}
}
function loopit($var, $content, $counter, $num) {
$num--;
if($_POST['data'] != ""){
$all = $_POST['data'];
$all .= "$content";
$_POST['data'] = $all;
}
else{
$all = $content;
$_POST['data'] = $all;
}
if($counter==$num){
$this->replace($var, $all);
return $var;
return $all;
}
}
function publish() {
eval("?>".$this->template."<?");
}
}
?>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 26, 2007 8:59 am
The included file has short tags. Your server has that feature off (as it should.)
serfczar_
Forum Commoner
Posts: 34 Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:
Post
by serfczar_ » Mon Mar 26, 2007 4:00 pm
feyd wrote: The included file has short tags. Your server has that feature off (as it should.)
Ahh thx, I didn't notice i used short tags, that was an accident, thanks for spotting that for me!
So short tags off in an included file is a security feature?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 26, 2007 4:03 pm
It's not a security detail. It's related to the setting being optional in PHP 5 and lower builds and it not existing in PHP 6 at all. Normal tags keeps your code more portable.
serfczar_
Forum Commoner
Posts: 34 Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:
Post
by serfczar_ » Mon Mar 26, 2007 4:21 pm
feyd wrote: It's not a security detail. It's related to the setting being optional in PHP 5 and lower builds and it not existing in PHP 6 at all. Normal tags keeps your code more portable.
Cool, php6, i'm going to have to go check on that. I didn't realize they had perfected version 5 yet ?_?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 26, 2007 7:57 pm
They haven't finished working on 5. They haven't finished working on 4 either.
serfczar_
Forum Commoner
Posts: 34 Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:
Post
by serfczar_ » Tue Mar 27, 2007 5:09 pm
feyd wrote: They haven't finished working on 5. They haven't finished working on 4 either.
ha, they need to get things together. Although it is my favorite language. I do guess though you can never really be finished with a release, to many possibilities.