8796 sujets

Développement web côté serveur, CMS

Bonjour,

Comme le nom de mon post l'indique j'ai un petit soucis de syntaxe sur un thème. Je travail avec wordpress 3.1.2, installé chez free. J'ai envoyé sur mon ftp le thème suivant: Nano 1.0.0 de YOOTheme et c'est maintenant que le problème fait surface. Je ne vois pas ou est l'erreur, donc un petit coup de main de serai vraiment pas de refus..

Merci d'avance



Message d'erreur:

Parse error: syntax error, unexpected '"', expecting ')' on line 512


Voici la ligne en question:

protected static $xpath = array('id' => "@id = '%s'", 'class' => "contains(concat(' ', normalize-space(@class), ' '), ' %s ')", 'attr' => "@%s", 'contains' => "contains(string(.), '%s')", 'not' => 'not(%s)', 'operators' => array("=" => "@%1 = '%3'", "!=" => "not(@%1) or @%1 != '%3'", "^=" => "starts-with(@%1, '%3')", "$=" => "substring(@%1, (string-length(@%1) - string-length('%3') + 1)) = '%3'", "*=" => "contains(@%1, '%3')", "~=" => "contains(concat(' ', normalize-space(@%1), ' '), ' %3 ')", "|=" => "@%1 = '%3' or starts-with(@%1, '%3-')"), 'pseudos' => array('first-child' => 'not(preceding-sibling::*)', 'last-child' => 'not(following-sibling::*)', 'only-child' => 'not(preceding-sibling::* or following-sibling::*)', 'enabled' => "not(@disabled) and (@type!='hidden')", 'disabled' => "(@disabled) and (@type!='hidden')", 'first' => 'position() = 1', 'last' => 'last()', 'empty' => 'count(*) = 0 and (count(text()) = 0)', 'checked' => '@checked'), 'combinators' => array('>' => 'child', '~' => 'general-sibling', '+' => 'adjacent-sibling'));
J'ai mis le code au propre mais je n'y vois aucune erreur de syntaxe.

protected static $xpath = array(
	'id' => "@id = '%s'", 
	'class' => "contains(concat(' ', normalize-space(@class), ' '), ' %s ')", 
	'attr' => "@%s", 
	'contains' => "contains(string(.), '%s')", 
	'not' => 'not(%s)', 
	'operators' => array(
		"=" => "@%1 = '%3'", 
		"!=" => "not(@%1) or @%1 != '%3'", 
		"^=" => "starts-with(@%1, '%3')", 
		"$=" => "substring(@%1, (string-length(@%1) - string-length('%3') + 1)) = '%3'", 
		"*=" => "contains(@%1, '%3')", 
		"~=" => "contains(concat(' ', normalize-space(@%1), ' '), ' %3 ')", 
		"|=" => "@%1 = '%3' or starts-with(@%1, '%3-')"
	), 
	'pseudos' => array(
		'first-child' => 'not(preceding-sibling::*)', 
		'last-child' => 'not(following-sibling::*)', 
		'only-child' => 'not(preceding-sibling::* or following-sibling::*)', 
		'enabled' => "not(@disabled) and (@type!='hidden')", 
		'disabled' => "(@disabled) and (@type!='hidden')", 
		'first' => 'position() = 1', 
		'last' => 'last()', 
		'empty' => 'count(*) = 0 and (count(text()) = 0)', 
		'checked' => '@checked'
	), 
	'combinators' => array(
		'>' => 'child', 
		'~' => 'general-sibling', 
		'+' => 'adjacent-sibling'
	)
);

Qu'y a t'il à la ligne suivante ?
Merci de ta réactivité !! voici une partie de la suite

protected static $cache = array();

public static function cssToXpath($selector, $prefix = 'descendant-or-self::') {

if (!isset(self::$cache[$prefix][$selector])) {

$xpath = array();

foreach (explode(',', $selector) as $sel) {
if ($sel = trim($sel)) {
$xpath[] = self::convertSelector($sel, $prefix);
}
}

if ($xpath = implode(' | ', $xpath)) {
self::$cache[$prefix][$selector] = $xpath;
} else {
return null;
}
}

return self::$cache[$prefix][$selector];
}
Je ne vois pas d'erreur de syntaxe non plus.

Par contre tu dis être sur un serveur Free. Il faudrait que tu vérifies si PHP est exécuté dans sa version 5.x et non 4.x pour pouvoir supporter la programmation objet comme c'est le cas dans le code que tu donne.
Le cas contraire, PHP ressort des erreurs de syntaxe là où il n'y en a pas.
ah oui c'est surement ça. J'ai eu des soucis avec la version php lors de l'installation de wordpress. J'ai du installer une version antérieur du CMS. Je viens de regarder dans phpMyAdmin et la version est 3.1.5 Smiley ohwell Quelle serai la solution?
j'ai du me tromper dans la version, j'ai donné la version de phpMyAdmin et non celle du php utilisé !!
3.1.5 ce doit être la version de phpMyAdmin, pas de PHP.
Pour connaitre la version de PHP tu peux passer par la fonction phpinfo() dans un fichier PHP indépendant que tu supprimeras une fois que tu n'en a plus besoin.

Si PHP n'est pas exécuté en version 4 il te faut te renseigner au près de l'hébergeur pour savoir si PHP 5 est installé ou non. Chez OVH par exemple, PHP 4 et 5 sont tous deux installés mais PHP est exécuté en version 4 par défaut. Il faut alors ajouter une ligne dans le fichier htaccess pour exécuter PHP en version 5.
Modifié par moust (21 Jul 2011 - 15:11)
Voici la version: PHP Version 5.1.3RC4-dev

Je suis bien en version 5. J'ai d'ailleurs le fichier .htaccess a la racine de mon ftp, comportant le code suivant:

php 1
# BEGIN WordPress

# END WordPress
Modifié par otra (21 Jul 2011 - 15:30)