Jump to content

Endorphin

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by Endorphin

  1. I would like to thank both of you for your help with this. It's very much appreciated.
  2. Thanks for the quick reply requinix, as I said I am new to PHP but I will read through the link. Many Thanks
  3. Hi All, I'm sure there is an easy solution for this but I am unable to find it. I am new to PHP and after a little help... the via data is stored in a database in this format... |51.105166,-1.695971|51.011055,-2.1068|50.945233,-2.617664|||| I'm trying to find a way of loosing the last comma if there are 1 or more entries, any ideas guys. What I'm getting is : var points = [{location: '51.105166,-1.695971'},{location: '51.105166,-1.695971'},]; What I'm after is: var points = [{location: '51.105166,-1.695971'},{location: '51.105166,-1.695971'}]; <?php if($via != null){ echo "var points = ["; foreach($via as $point){ if($point != ""){ echo "{location:"; echo " '".$point."'"; echo "},"; } } echo "];\n"; } ?>
  4. Hi All, I have been looking for hours for a solution but no joy so far. I have a contact page with different names on, each name has its own contact button. I am trying to find a way to produce a standard popup contact form but send it to the required name, address and individual subject line. I don't really want to use the mailto function, I'm sure there must be an easy solution but my skills are very limited. Any help would be appreciated. Neil
  5. Hi All, I have code to generate a route in google maps on my site. The code works great in Firefox but not in IE8. It works in IE8 if you just have just a start and finish only but whe you add a waypoint in the route does not show. Any ideas? <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"> </script> <script type="text/javascript"> var directionDisplay; var geocoder; var directionsService = new google.maps.DirectionsService(); var latlng = new google.maps.LatLng(54.559322587438636, -4.1748046875); function load() { geocoder = new google.maps.Geocoder(); directionsDisplay = new google.maps.DirectionsRenderer(); var myOptions = { zoom: 6, mapTypeId: google.maps.MapTypeId.ROADMAP, center: latlng, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, position: google.maps.ControlPosition.TOP_RIGHT }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN, position: google.maps.ControlPosition.TOP_LEFT} }; var map = new google.maps.Map(document.getElementById('map'), myOptions); directionsDisplay.setMap(map); var directionRendererOptions ={ suppressMarkers: true, polylineOptions:{ strokeColor: "#FF0000", strokeOpacity: 1, strokeWeight: 3 } }; directionsDisplay.setOptions(directionRendererOptions); var start = '<?php echo $start; ?>'; var end = '<?php echo $end; ?>'; <?php if($via != null){ echo "var points = ["; foreach($via as $point){ if($point != ""){ echo "{location:"; echo " '".$point."'"; echo "},"; } } echo "];\n"; } ?> var request = { origin:start, waypoints: points, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); geocoder.geocode( { 'address': start}, function(results, status) { var routeStart = new google.maps.Marker({ map: map, position: results[0].geometry.location, icon: './images/motorcycling.png', shadow: './images/motorcycling.shadow.png' }); }); geocoder.geocode( { 'address': end}, function(results, status) { var routeEnd = new google.maps.Marker({ map: map, position: results[0].geometry.location, icon: './images/motorcyclingend.png', shadow: './images/motorcycling.shadow.png' }); }); <?php $adverts = mysql_query("SELECT * FROM adverts WHERE ad_area = '$county' AND ad_visible='1' "); while($ad_row = mysql_fetch_array($adverts)){ $position = $ad_row[ad_postcode]; $type = $ad_row[ad_type]; echo "var position".$ad_row[ad_id]." = '".$position."'\n"; $ad_id = $ad_row[ad_id]; $pics = mysql_query("SELECT * FROM photos WHERE ad_id = '$ad_id' AND main_pic = '1'"); $pic_row = mysql_fetch_array($pics); $pic_name = $pic_row[photo_name]; $pic_name = str_replace(' ', '%20', $pic_name); ?> geocoder.geocode( { 'address': position<?php echo $ad_row[ad_id]; ?>}, function(results, status) { var marker<?php echo $ad_row[ad_id]; ?> = new google.maps.Marker({ map: map, position: results[0].geometry.location, <?php if ($type == 'accommodation'){ echo "icon: 'images/hotel.png'\n"; }elseif($type == 'fooddrink'){ echo "icon: 'images/bar.png'\n"; }elseif($type == 'essentials'){ echo "icon: 'images/motorcycle.png'\n"; } ?> }); var content = "<p><\a style='color:black;' href='./advert.php?advert=<?php echo $ad_row[ad_id]; ?>'><?php echo $ad_row[ad_company]; ?><\/a></p><img src='./thumbs/<?php echo $pic_name; ?>' />"; var infowindow<?php echo $ad_row[ad_id]; ?> = new google.maps.InfoWindow({ content: content }); google.maps.event.addListener(marker<?php echo $ad_row[ad_id]; ?>, "click", function() { infowindow<?php echo $ad_row[ad_id]; ?>.open(map,marker<?php echo $ad_row[ad_id]; ?>); }); });
  6. Hi Pikachu2000 and thank you for such a quick response. That worked a treat!!! As I said in my initial message im very very new to this. You said that "Associative array indices should be in quotes" otherwise they can cause errors, under what circumstances would this happen as there seems to be quite a few withing the code on the page. Also, what reason would the code write it this way? Neil
  7. Hi All, Im new to this forum but think its going to be a regular location for me for quite a while. Im very very new to php and the guy that was doing code for me is not responding to emails, so i thought id have a go myself...lol at the moment im going through the trial and error phase while learning. I have edited some of the code he has put on the site to create a new look. the original page: http://www.ridersguide.co.uk/county_accommodation.php?county=4; the one im trying:http://www.ridersguide.co.uk/county_accommodation2.php?county=4; The new bit is to add a preview of the text for the page. echo $row[ad_text]; the code above brings up all the text but i only want to show the first 4 or 5 lines. Is this possible in php? Any help appreciated Neil
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.