s7mahess
Goto Top

Syntax Problem PHP

Morgen ich habe hier ein kleines PHP Syntax problem zumindest sagt eclipse mir das:

Description Resource Path Location Type
syntax error, unexpected 'F' 020.php /php line 7 DLTK Problem

meiner meinung hat es irgendwas mit den Gänsefüßen zu tun, aber ersetze ich die " durch ' in zeile 5 und 7 bekomme ich stattdessen

Description Resource Path Location Type
syntax error, unexpected ')' 020.php /php line 19 DLTK Problem
syntax error, unexpected 'F' 020.php /php line 7 DLTK Problem

will mich nur eclipse ärgern oder ist wirklich nen fehler hier (btw ich habe es noch nicht geschaft smarty zum laufen zu bringen)

MfG Martin

 
<?php

include ('Smarty.class.php');  

$strSmartyTemplateDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\templates\";  

$strSmartyCompileDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\compile\";  

$smarty = new Smarty();

$smarty->template_dir = $strSmartyTemplateDir;

$smarty->compile_dir = $strSmartyCompileDir;

$smarty->assign('name', 'Max Muster');  

$smarty->assign('address', 'Blumenstraße 12');  

$smarty->display('sdemo1.tpl');  

?>
Kommentar vom Moderator Mitchell am Dec 08, 2009 um 08:06:13 Uhr
Überschrift geändert

Content-Key: 131183

Url: https://administrator.de/contentid/131183

Printed on: April 20, 2024 at 02:04 o'clock

Member: Mitchell
Mitchell Dec 08, 2009 at 07:55:01 (UTC)
Goto Top
Zitat von @s7mahess:
 
> $strSmartyTemplateDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\templates\";  
> 
> $strSmartyCompileDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\compile\";  
> 

Durch den Backslash werden deine Gänsefüßchen escaped (\").

Mfg
Mitchell
Member: Cubic83
Cubic83 Dec 08, 2009 at 07:55:41 (UTC)
Goto Top
Hallo,

probier doch mal:

$strSmartyTemplateDir = "F:\\PortableApps\\eclipse moves jdk\\php5\smarty\\templates\\";   

$strSmartyCompileDir = "F:\\PortableApps\\eclipse moves jdk\\php5\\smarty\\compile\\";   

mfG
Member: s7mahess
s7mahess Dec 08, 2009 at 07:59:19 (UTC)
Goto Top
danke,

nicht an exclude gedacht
Member: nxclass
nxclass Dec 08, 2009 at 07:59:26 (UTC)
Goto Top
die UNIX Schreibweise sollte auch gehen
$strSmartyTemplateDir = 'F:/PortableApps/eclipse moves jdk/php5/smarty/templates/';  

... und bei einfachen Zeichenketten kann man auch ' benutzen - damit wird der String nicht nochmal von PHP nach Ersetzungen durchwühlt und es läuft ein µ schneller.
Member: kekzle
kekzle Dec 08, 2009 at 08:00:06 (UTC)
Goto Top
Hi, so sollte es normal gehen:

$strSmartyTemplateDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\templates";   
$strSmartyCompileDir = "F:\PortableApps\eclipse moves jdk\php5\smarty\compile";   


Grüße kekzle
Member: dog
dog Dec 08, 2009 at 08:24:05 (UTC)
Goto Top
Oder man macht es gleich richtig und benutzt die DIRECTORY_SEPARATOR Konstante.
Natürlich muss man genau drauf achten wo man das grade benutzt. An manchen Stellen wird es immer / bleiben.

Grüße

Max