Unexpected T_IF

Résolu
fredodo13 Messages postés 103 Statut Membre -  
fredodo13 Messages postés 103 Statut Membre -
Bonjour,
J'ai un erreur de syntax, sur le code ci dessous, qulqu'un aurait une idée ?

Parse error: syntax error, unexpected T_IF in /homepages/8/d246321979/htdocs/XXXXX/scripts/map_camp.php on line 64


if($WindowContent!='') $WindowContent.=','; //ajoute la virgule de s?ration des points
$WindowContent.='['.'"<div><h5 style=padding:0;margin:0;color:black;>'.$titre.'</h5><h5 style=padding:0;margin:0;margin-bottom:7px;>'

if($type == 'c') echo "cabane";
elseif($type == 'r') echo "rocher";
elseif($type == 't') echo "tente";
elseif($type == 'a') echo "autre";
elseif($type == 'y') echo "yahou";
.'</h5><img src=uploads/'.$photo.' alt='.$photo.' style=height:100px;width:150px><br><a href='.strtolower($title).'.html style=text-decoration:none;float:right;margin-top:5px;color:#f58a00;font-weight:bold;>Voir plus</a></div>"'.']';


Merci !

1 réponse

  1. Thorak83 Messages postés 1140 Statut Membre 156
     
    Bonjour,

    Il me semble qu'il manque déjà un point virgule à la fin de la ligne
    $WindowContent.='['.'"<div><h5 style=padding:0;margin:0;color:black;>'.$titre.'</h5><h5 style=padding:0;margin:0;margin-bottom:7px;>';


    Cordialement
    0
    1. fredodo13 Messages postés 103 Statut Membre 3
       
      Salut Thorax,
      Deja merci pour ton temps.

      nouvelle erreur :

      Parse error: syntax error, unexpected '.' in /homepages/8/d246321979/htdocs/xxxxx/scripts/map_camp.php on line 69
      0
    2. fredodo13 Messages postés 103 Statut Membre 3
       
      ah non j'ai rien dit j 'ai enlevé le point comme demandé mais cela ne fonctionne pas... bizarre
      0
    3. Thorak83 Messages postés 1140 Statut Membre 156
       
      mettre l'ensemble du code map_camp.php ici
      0
    4. fredodo13 Messages postés 103 Statut Membre 3
       
      ok :



      <!-- Include Javascript -->
      <script type="text/javascript" src="js/jquery.min.js"></script>
      <script type="text/javascript" src="js/jquery-ui-1.8.12.custom.min.js"></script>
      <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
      <script src="js/markerwithlabel.js" type="text/javascript"></script>
      <style type="text/css">
      .labels {
      color: #000;
      font-family: "Lucida Grande", "Arial", sans-serif;
      font-size: 10px;
      text-align: center;
      width: 100px;
      white-space: nowrap;
      margin-top: 20px;
      }
      </style>

      <?php

      $item = "";
      $listeDesPoints='';
      $WindowContent='';

      if(isset($_GET['item']) && !empty($_GET['item'])){
      require('config.php');
      $item = mysql_real_escape_string(str_replace("-"," ",$_GET['item']));

      //récupérer id région

      $query = mysql_query("select IdRegion from region where NomRegion LIKE '$item'");

      $IdRegion = mysql_result($query,0,'IdRegion') or die(mysql_error());

      $sql = mysql_query("select * from annonce where etat =1 AND IdRegion= $IdRegion order by id_anc desc ");

      $rows = mysql_num_rows($sql);
      if($rows != 0){
      for($i=0; $i<$rows; $i++){
      $long = mysql_result($sql,$i,'lng');
      $lat = mysql_result($sql,$i,'lat');
      $titre = mysql_result($sql,$i,'titre');
      $user = mysql_result($sql,$i,'user_id');
      $id = mysql_result($sql,$i,'id_anc');
      $title= str_replace(' ','-',$titre);
      $type = mysql_result($sql,0,'type');

      $req = mysql_query("select * from user where id_user = $user AND statut=1");
      $result = mysql_num_rows($req);
      if($result != 0){

      $adresse = mysql_result($req,0,"adresse");
      $mail = mysql_result($req,0,"email");
      }

      $img = @mysql_query("SELECT * FROM `photos` WHERE `id_annonce` = $id AND `default` = 1") or die(mysql_error());
      $photo = @mysql_result($img,0,'lib_ph');

      if($listeDesPoints!='') $listeDesPoints.=','; //ajoute la virgule de s?ration des points
      if($long != "" && $lat != "")$listeDesPoints.='["'.$titre.'",'.$lat.','.$long.']';

      if($WindowContent!='') $WindowContent.=','; //ajoute la virgule de s?ration des points
      $WindowContent.='['.'"<div><h5 style=padding:0;margin:0;color:black;>'.$titre.'</h5><h5 style=padding:0;margin:0;margin-bottom:7px;>';

      if($type == 'c') echo "cabane dans les bois";
      elseif($type == 'r') echo "roulotte";
      elseif($type == 't') echo "tipi";
      elseif($type == 'a') echo "autre";
      elseif($type == 'y') echo "yourte";
      '</h5><img src=uploads/'.$photo.' alt='.$photo.' style=height:100px;width:150px><br><a href='.strtolower($title).'.html style=text-decoration:none;float:right;margin-top:5px;color:#f58a00;font-weight:bold;>Voir plus</a></div>"'.']';
      }
      ?>
      <style type="text/css">
      #bloc-map #map{width:700px;height:240px;margin:auto;}
      </style>
      <div id="map">
      <p>Veuillez patienter pendant le chargement de la carte...</p>
      </div>

      <script type="text/javascript">

      function initialize() {
      var map;
      var bounds = new google.maps.LatLngBounds();
      // Multiple Markers
      var markers = [
      <?php echo $listeDesPoints; ?>
      ];

      // Info Window Content
      var infoWindowContent = [
      <?php echo $WindowContent; ?>
      ];

      var mapOptions = {
      center:new google.maps.LatLng(markers[0][1], markers[0][2]),
      zoom:6,
      mapTypeId: google.maps.MapTypeId.ROADMAP
      };

      // Display a map on the page
      map = new google.maps.Map(document.getElementById("map"), mapOptions);
      map.setTilt(45);



      // Display multiple markers on a map
      var infoWindow = new google.maps.InfoWindow(), marker, i;

      // Loop through our array of markers & place each one on the map
      for( i = 0; i < markers.length; i++ ) {
      var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
      bounds.extend(position);
      marker = new MarkerWithLabel({
      position: position,
      map: map,
      title: markers[i][0],
      icon: "images/Marqueur.png"
      });

      // Allow each marker to have an info window
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
      infoWindow.setContent(infoWindowContent[i][0]);
      infoWindow.open(map, marker);
      }
      })(marker, i));

      // Automatically center the map fitting all markers on the screen
      map.fitBounds(bounds);
      }

      // Override our map zoom level once our fitBounds function runs (Make sure it only runs once)
      var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
      this.setZoom(12);
      google.maps.event.removeListener(boundsListener);
      });

      }
      initialize();
      </script>


      <?php }}

      elseif(isset($_GET['el']) && !empty($_GET['el'])){
      require('config.php');
      $item = $_GET['el'];


      $sql = mysql_query("select * from annonce where etat =1 AND type= '$item' order by id_anc desc ");

      $rows = mysql_num_rows($sql);
      for($i=0; $i<$rows; $i++){
      $long = mysql_result($sql,$i,'lng');
      $lat = mysql_result($sql,$i,'lat');
      $titre = mysql_result($sql,$i,'titre');
      $user = mysql_result($sql,$i,'user_id');
      $id = mysql_result($sql,$i,'id_anc');
      $title= str_replace(' ','-',$titre);
      $req = mysql_query("select * from user where id_user = $user AND statut=1");
      $result = mysql_num_rows($req);
      if($result != 0){
      $annonceur = mysql_result($req,0,"nom");
      $adresse = mysql_result($req,0,"adresse");
      $mail = mysql_result($req,0,"email");
      }

      $img = @mysql_query("SELECT * FROM `photos` WHERE `id_annonce` = $id AND `default` = 1") or die(mysql_error());
      $photo = @mysql_result($img,0,'lib_ph');

      if($listeDesPoints!='') $listeDesPoints.=','; //ajoute la virgule de s?ration des points
      $listeDesPoints.='["'.$titre.'",'.$lat.','.$long.']';

      if($WindowContent!='') $WindowContent.=','; //ajoute la virgule de s?ration des points
      $WindowContent.='['.'"<div><h5 style=padding:0;margin:0;color:black;>'.$titre.'</h5><h5 style=padding:0;margin:0;margin-bottom:7px;>'.$annonceur.'</h5><img src=uploads/'.$photo.' alt='.$photo.' style=height:100px;width:150px><br><a href='.strtolower($title).'.html style=text-decoration:none;float:right;margin-top:5px;color:#f58a00;font-weight:bold;>Voir plus</a></div>"'.']';
      }
      ?>
      <style type="text/css">
      #bloc-map #map{width:700px;height:240px;margin:auto;}
      </style>
      <div id="map">
      <p>Veuillez patienter pendant le chargement de la carte...</p>
      </div>

      <script type="text/javascript">

      function initialize() {
      var map;
      var bounds = new google.maps.LatLngBounds();
      // Multiple Markers
      var markers = [
      <?php echo $listeDesPoints; ?>
      ];

      // Info Window Content
      var infoWindowContent = [
      <?php echo $WindowContent; ?>
      ];

      var mapOptions = {
      center:new google.maps.LatLng(markers[0][1], markers[0][2]),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      maxZoom : 20
      };

      // Display a map on the page
      map = new google.maps.Map(document.getElementById("map"), mapOptions);
      map.setTilt(45);



      // Display multiple markers on a map
      var infoWindow = new google.maps.InfoWindow(), marker, i;

      // Loop through our array of markers & place each one on the map
      for( i = 0; i < markers.length; i++ ) {
      var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
      bounds.extend(position);
      marker = new google.maps.Marker({
      position: position,
      map: map,
      title: markers[i][0],
      icon: "images/Marqueur.png"
      });

      // Allow each marker to have an info window
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
      infoWindow.setContent(infoWindowContent[i][0]);
      infoWindow.open(map, marker);
      }
      })(marker, i));

      // Automatically center the map fitting all markers on the screen
      map.fitBounds(bounds);
      }

      // Override our map zoom level once our fitBounds function runs (Make sure it only runs once)
      var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
      this.setZoom(10);
      google.maps.event.removeListener(boundsListener);
      });

      }
      initialize();
      </script>


      <?php }?>
      0
    5. Thorak83 Messages postés 1140 Statut Membre 156
       
      vous avez un message d'erreur ?
      0