View previous topic :: View next topic |
Author |
Message |
egoo -
Joined: 22 Jan 2008 Posts: 16
|
Posted: Sat Mar 15, 2008 2:08 pm Post subject: template |
|
|
I have a problem with compilation. It gives me an error. I 've got Php Designer 2007 ver. 5.4.
template.tpl :
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="TEAM ViRiLiTY">
<title><?php echo $tpl['title'];?></title>
</head>
<body>
<h1><?php $echo $tpl['title'];?></h1>
<p>
<?php echo $tpl['description']; ?>
</p>
<?php echo $tpl['content'];?>
</body>
</html>
list_parts.tpl.php:
<?php
/**
* @author TEAM ViRiLiTY
* @copyright 2008
*/
$header = <<<END
<table>
<tr> <th> Name<th><th>City</th></tr>
END;
$footer = <<<END
</table>
END;
$item = "<tr><td>{name}</td><td>{city}</th>";
?>
show_names.php:
<?php
/**default :
* @author TEAM ViRiLiTY
* @copyright 2008
*/
include 'list_parts.tpl.php';// here is the error
$list = array('Andy'=>'Tel Aviv','Derick'=>'London','Stig'=>'Trodheim');
$items ='';
foreach ($list as $name =>$city) {
$items .= str_replace(
array('{name}','{city}'),
array($name,$city),$item);
}
$tpl = array();
$tpl['title']= "List wiith names";
$tpl['Description']= "This list shows names and the cities.";
$tpl['content']= $header.$items.$footer;
include 'template.tpl';
?>
When there are compilation an error is appeared: Parse error:syntax error,Unexpected T_SL in C:\Users\owner\Documents\Architecture\list_parts.tpl.php
Last edited by egoo on Tue Mar 18, 2008 9:37 pm; edited 2 times in total |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Sun Mar 16, 2008 7:25 pm Post subject: |
|
|
Quote: | include 'list_parts.tpl.php';// here is the error |
try this:
Code: | include('list_parts.tpl.php'); |
and make sure list_parts.tpl.php is in the same dir as the script that's calling it.
Or you could try Code: | include("./list_parts.tpl.php"); |
If you could include your error, that would certainly help more. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Sun Mar 16, 2008 9:54 pm Post subject: |
|
|
It isn't necessary to use parenthesis with include. It's a language construct, kind of like echo. Either your file doesn't exist or you're having include path issues. Can you give us the error you get? _________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
|
fiasco -
Joined: 12 Aug 2008 Posts: 8
|
Posted: Tue Aug 12, 2008 6:52 am Post subject: |
|
|
please explain me briefly I can't palpable your problem. |
|
Back to top |
|
|
fiasco -
Joined: 12 Aug 2008 Posts: 8
|
|
Back to top |
|
|
|