Syntax error, unexpected end of file
Résolu
Jordan31
-
astuces72 Messages postés 8349 Statut Membre -
astuces72 Messages postés 8349 Statut Membre -
Bonjour à tous,
J'ai l'erreur suivante qui s'affiche dans mon navigateur : Parse error: syntax error, unexpected end of file in C:\wamp\www\adaclive\wp-content\plugins\mon-widget-essai\mon-widget-essai.php on line 148
Voici mon code :
Une idée d'où cela peut venir ?
Merci :)
J'ai l'erreur suivante qui s'affiche dans mon navigateur : Parse error: syntax error, unexpected end of file in C:\wamp\www\adaclive\wp-content\plugins\mon-widget-essai\mon-widget-essai.php on line 148
Voici mon code :
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Mon widget</title>
</head>
<body>
<?php
/*
Plugin Name: Mon widget
Plugin URI: localhost/adaclive
Description: Widget test
Version: 1.0
Author: Jordan
Author URI: localhost/adaclive
License: GPL2+
*/
class MonWidget extends WP_Widget
{
function MonWidget()
{
// Constructeur
parent::WP_Widget(false, $name = 'MonWidget', array("description" => 'Afficher texte'));
}
function widget($args, $instance)
{
echo $args['before_title'];
echo "<div style='color: red; font-weight: 700; text-align: center; font-family: verdana; text-shadow: 1px 1px 1px black; '>";
echo apply_filters('widget_title', $instance['title']);
echo "</div>";
echo $args['after_title'];
echo "<div style='border: 2px solid black; border-radius: 15px; padding: 5px; width: 300px; '>";
$commune = isset($_POST['commune']) ? $_POST['commune'] : 0;
$hebergement = isset($_POST['hebergement']) ? $_POST['hebergement'] : 0;
/* tableau à deux dimensions:
lignes: communes
colonnes: dscriptions
*/
$descriptions =
array(
1 => array(1 => "Hôtel Esparros", 2=> "Camping Esparros", 3 => "Gîte Esparros"),
2 => array(1 => "Hôtel Capvern", 2 => "Camping Capvern", 3 =>"Gîte Capvern"),
3 => array(1 => "Hôtel Heches", 2 => "Camping Heches", 3 => "Gîte Heches"),
4 => array(1 => "Hôtel Tibiran", 2 => "Camping Tibiran", 3 => "Gîte Tibiran"),
) ;
/* tableaux servant à montrer ce qui a été choisi*/
$commune_selected = array_fill(0,5, "");
$commune_selected [$commune] = "selected ='selected'";
$heberg_selected = array_fill(0,3, "");
$heberg_selected [$hebergement] = "selected ='selected'";
/*pour que ton truc fonctionne, il faut créer un formulaire; un formulaire sans action recharge la même page en envoyant les choix faits*/
print"
<form method = 'post'>
<Label for 'communes'>Communes </label>
<select name='commune'>
<option value='1' $commune_selected[1]> Esparros </option>
<option value='2' $commune_selected[2]> Capvern </option>
<option value='3' $commune_selected[3]> Heches </option>
<option value='4' $commune_selected[4]> Tibiran-Jaunac </option>
</select>
<Label for 'hebergement'>Hébergement </label>
<select name='hebergement'>
<option value='1' $heberg_selected[1]> Hôtels </option>
<option value='2' $heberg_selected[2]> Campings </option>
</select>
<!-- un bouton pour valider -->
<input type='submit' value='Valider' name='OK'>
</form>";
/*Si un choix a été fait*/
if (($commune != 0) and ($hebergement != 0))
{
$descro = $descriptions[$commune][$hebergement];
print "$descro";
}
}
function update($new_instance, $old_instance)
{
$instance = array();
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['description'] = strip_tags( $new_instance['description'] );
return $instance;
}
function form($instance)
{
if ( isset( $instance['title'] ) ) {
$title = $instance['title'];
}
else {
$title = "mon titre";
}
$description = $instance['description'];
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">
Titre :
</label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
name="<?php echo $this->get_field_name('title'); ?>" type="text"
value="<?php echo esc_attr($title); ?>" />
<label for="<?php echo $this->get_field_id( 'description' ); ?>">
Description :
</label>
<input class="widefat" id="<?php echo $this->get_field_id('description'); ?>"
name="<?php echo $this->get_field_name('description'); ?>" type="text"
value="<?php echo esc_attr($description); ?>" />
</p>
}
}
<?php
add_action('widgets_init', create_function('', 'return register_widget("MonWidget");'));
?>
</body>
</html>
Une idée d'où cela peut venir ?
Merci :)
A voir également:
- Syntax error, unexpected end of file
- .Dat file - Guide
- .Bin file - Guide
- Host file - Guide
- Iso file - Guide
- File renamer - Télécharger - Gestion de fichiers