Jump to content

mrMarcus

Members
  • Posts

    1,903
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by mrMarcus

  1. Do you have images in the database table `markers`? You have added the column `image`? If so, post what an example image URL is that you have in the table.
  2. Just to confirm, the "Logout" text is no clickable at all? It's not something silly like that container <div> has text-decoration:none or something like that, correct?
  3. Yes, you can add pretty much anything you want in there. Only one way to find out... try it. var html = "<img src='" + image + "'/> <span class='mapinfo'>" + name + "</span> <br/><br/>" + address; You must now add 'image' to your XML markup: // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['type'] . '" '; echo 'image"'. $row['image'] .'" '; echo '/>'; } And, of course, have the URL to the image in the db table `markers` for each record. Move/style the image within the createMarker() function to suit your needs. Add width/height and so on.
  4. My mistake. Either replace the double-quotes with single-quotes or escape the double-quotes. And you didn't replace the closing </b>. You know basic HTML, correct? var html = "<span class='mapinfo'>" + name + "</b> <br/><br/>" + address;
  5. In place of the closing </b>. Seems you might be trying to sprint before you've learned to walk. var html = "<span class="my_class_to_do_something">" + name + "</span><br/><br/>" + address;
  6. Right off the bat I can see that you are not closing your </script>. Install Firebug for Firefox and you will be able to catch these kinds of errors right away. And you are not including the jQuery library, unless you're just not posting that part of the script.
  7. Yes, that's it. Do all your styling within there. Have you tried it? Create a class/ID and swap out the <b> for <span class="your_class"> and see what happens. I just noticed this tutorial is for Gmaps V2. Version 2 is dated, and if not already, will soon be deprecated. If you plan on working with Google Maps in the future on other projects, get rid of V2 immediately and do not waste any more time. Move to V3. I strongly, strongly recommend you do so. It's faster, cleaner, and more scalable. The example I provided you in the other thread was V3. Mess around with my example map. You can use the exact same db table, and I believe my code was already setup using the same fields as your example.
  8. The styling does not go in there. As was stated earlier, you cannot put HTML within HTML. That line of code is part of a block of code that is how your map reads the markers to be displayed: // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['type'] . '" '; echo '/>'; } The above outputs like so: <marker name="something" address="something" lat="something" lng="something" type="something"/> And you cannot put styling within. From there, the while() loop will iterate through all available 'markers' in the database, and generate the corresponding number of markers that will then be parsed by further code to be displayed on the map. What exactly are you trying to style? The InfoWindow when you click on a marker? Please be specific and show some code (you should have a [javascript] function that creates the markers, ie. CreateMarker(), or something similar).
  9. Didn't I already give you a working map example in that other thread? It's much less confusing than building the XML yourself.
  10. Multiple sites with the same layout would be best achieved with a database-driven site. Super simple setup, and you just plop in the content throughout the page wherever it needs to go. You can even have your template hosted on one server and use include() to grab the template files for each site. Updating those template files would be reflected across all sites. You would need to ensure that "URL fopen wrappers" are enabled on the server(s) so you could do that, of course. I just think you're over-complicating things your way. That's all I got though. I've never (even thought of doing) done what you're trying to do, so I cannot help you any further regarding that.
  11. Well, this could be due to a million different things. Are you using Firebug for Firefox? It will help you to drill down any formatting errors within javascript and such. The code you initially posted, is that within a 'createMarker()' sort of function? Can you post that function and any related code. Mentioning this was within Google Maps is the kind of info you really need to include at the beginning, and may not be a PHP issue at all.
  12. Yeah, that is pretty much what I am trying to do lol What I would like to accomplish is to have an automated way to create a webpage so that I wouldn't need to go in there myself to change what I would like to lol mainly just trying to eliminate the need for me to do anything. For example I want the same layout that I have, but I want to change the current fields around or add in anything new. instead of manually going in to my html and changing what I would need to, I would like to run some kind of script that I would pass in what fields I would like to see and it would change it for me. Also, yes, I would like for these pages to be dynamic, which this would also help with that. where one page shows this, but then once someone does some kind of action it would change what they see (now I know there are other ways to go about this part of it than what I am asking for) I'm not trying to scrap off some layout to use for myself, I would definitely have my own designs and layout, just the content would need to be changed. Well, there are much simpler ways of creating dynamic layouts than regex. This is actually the first I've ever heard somebody attempt this with your reasoning. The time it would take you to plug in the updated variables into your "system", you could probably have just made the changes to your html page, anyways. Maybe +/- 30 seconds. Thing is, at some point you will have to make the changes manually, unless you have some sort of AI built-in. For a simple dynamic-driven website, I would simply recommend a database-driven setup. However, how large/many pages do you expect this site to be? Anything < 5-10, and it's hardly worth creating anything dynamically driven. Static pages with simple included header/footer files would suffice. And unless your content is changing regularly, I'm sure some updates could be easily managed.
  13. What are you ultimately trying to accomplish? I can't see why you'd want to build a page this way. I think I understand what you're saying... you want to be able to take some bare HTML code and alter it by finding certain <div> tags (or whatever) and injecting more HTML within those tags to create a page? I'm assuming this page will be dynamic and change often based on *something*, whether it be a specific user action, or something along those lines? It also depends on many items you want to change in any single page load. Do I dare ask if this is to be a static page? Or are you scraping an external webpage layout to use on your own site?
  14. I must admit, I didn't read your entire post. As ManiacDan said, use urlencode for URL's. And while htmlspecialchars() will work, it could break URL's in other instances and is not ideal for URL's. Straight text, yes, htmlspecialchars() is the choice (of most).
  15. noo You said you "see" the array on the screen when you enter that file into your browser. That means you are NOT outputting the contents of the file to PHP.
  16. And you're sure the .html file is outputting to PHP? I see you have a &language=php in the URL, but that means nothing to me.
  17. To turn the comma-delimited string into an array for use, use $arr = explode(',', $row['fid']); However, you should not be storing them that way to begin with as they are not scalable and will always require separation before use. It's better to store them in a separate table and JOIN that table to your initial query using an indexable key identifier between the tables.
  18. You say that you "see" the array in plain-text when you enter that URL? That URL is .html, and if you are not rewriting to parse PHP, you would be merely sending a plain-text array to your PHP script, so of course the script wouldn't recognize it as an array. Please correct me if I'm wrong. What is the source of http://localhost:10080/ntop/dumpData.html?language=php&proto
  19. Please add the following to your query: $deletefrom_sizes = mysql_query("DELETE FROM Sizes_List WHERE product_id = '$id_to_delete'") or die(mysql_error()); Edit: off-topic and nothing to do with possible issue at this time, but if your `product_id` is INT based in the table, then wrapping it in single quotes will not allow any index to perform as expected. E.g. 12345 If `product_id` is VARCHAR or something similar, then quotes are needed; and please, sanitize your variables before tossing them into your queries. But I'm sure you were going to
  20. You definitely need to install Firebug for Firefox for starters. Can you post your example here? There is no information I can go off of based on your initial write-up. I would suggest using JSON to populate the map. Much more efficient than XML and works great with jQuery's AJAX class. Can accomplish the same thing as that Google example, but in half the time/lines of code, and a fraction of the confusion. main map page (index.php?) <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>Example Map - mrMarcus</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; var mapCenter = new google.maps.LatLng(48.31048, -95.361328); // change initial centering if necessary var gmarkers = []; function initialize() { var myOptions = { zoom: 13, center: mapCenter, mapTypeId: google.maps.MapTypeId.TERRAIN }; map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); current_zoom = map.getZoom(); } google.maps.event.addDomListener(window, 'load', initialize); var infowindow = new google.maps.InfoWindow(); var bounds = new google.maps.LatLngBounds(); var marker, i; var myLatLng; function CreateMarker (obj, i) { myLatLng = new google.maps.LatLng(obj['lat'], obj['lng']); marker = new google.maps.Marker({ position: myLatLng, map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent('Name: ' + obj['name'] + '; Address: ' + obj['address']); // obj[] will contain elements from your postback array, ie. obj['name'] && obj['address'] && obj['lat'], etc. infowindow.open(map, marker); } })(marker, i)); bounds.extend(myLatLng); gmarkers.push(marker); } </script> </head> <body> <div id="map_canvas"></div> <script type="text/javascript"> $.ajax({ beforeSend: function() { // can have something happen before request is made (ie. "Loading..." message) }, cache: false, // data: params, // if you are sending parameters to the 'url' below, ie. if search capabilities are included on the map; 'params' would be GET style URL dataType: 'json', timeout: 0, type: 'POST', url: '/get_markers.php?_=<?php echo md5(session_id() . time() . mt_rand(1,9999)); ?>', // create additional file and call it get_markers.php; see code for this file below success: function(data) { if (data) { if (data['count'] > 0) { var obj; var results = data['results']; for (r in data['results']) { if (r < (data['count'])) { CreateMarker(results[r]); } } map.fitBounds(bounds); } else { alert('No results from the database.'); } } else { alert('No data received.'); } }, complete: function(data) { // when AJAX call has completed, additional stuff can happen here, but is not necessary } }); </script> </body> </html> get_markers.php <?php $sql = "SELECT * FROM `markers`"; if ($result = @mysql_query($sql)) { $count = @mysql_num_rows($result); if ($count > 0) { while ($res = @mysql_fetch_assoc($result)) { $lat = (int)$res['lat']; $lng = (int)$res['lng']; if (!empty($lat) && !empty($lng)) { // if either lat or lng are enpty, they are useless on the map $listings_results[] = array( 'name' => $res['name'], 'address' => $res['address'], 'lat' => $res['lat'], 'lng' => $res['lng'], 'type' => $res['type'] ); } } // create the variables array; $results['count'] = $count; $results['results'] = $listings_results; // send the encoded results; $json = @json_encode($results); echo $json; exit(0); } } ?>
  21. Good catch. Thank you sir. Solved.
  22. Or am I just going crazy? OK, I've been running a query that uses the snippet below to get the previous month. It's : $sql = "SELECT COUNT(`id`) as `counted` FROM `click_tracking` WHERE `date` LIKE '". date('Y-m', mktime(0, 0, 0, (date('m')-1), date('d'), date('Y'))) ."-%'"; Here's a snippet for people to try: date_default_timezone_set('America/Toronto'); echo date('Y-m', mktime(0, 0, 0, (date('m')-1), date('d'), date('Y'))); //prints 2012-03 (March, which is incorrect; should be February- 2012-02) That should have printed 2012-02, but instead, it prints 2012-03. If I modify the mktime() to (date('m')+1): date_default_timezone_set('America/Toronto'); echo date('Y-m', mktime(0, 0, 0, (date('m')+1), date('d'), date('Y'))); //prints 2012-05 (May, which is incorrect; should be April - 2012-04) It prints 2012-05 which is incorrect for the given timezone. Should be 2012-04 I'm thinking it's a leap year bug and will work itself out tomorrow (per my timezone, anyways). So, when I use the mktime() function, it seems to be thinking we're in April already. A standard date('Y-m') prints the correct YYYY-MM (2012-03) though. Am I tripping out?
  23. When I did that mysql returned incorrect results, ie. records that weren't actually within the boundaries specified (both `lat` and `lng` coordinates). The data is being pulled from a Google Map based on the viewport. For example, when I switched the values as you stated, I would receive records that were waaaay out of the maps viewport. Now this might be another issue altogether. Thank you for your reply as it does make sense logically.
  24. New query works... removed BETWEEN clause for longitude (`lng`) SELECT `listing_id` FROM `coords` WHERE `lat` BETWEEN 34.40786104924253 AND 46.09689044689511 AND NOT `lng` > -77.41293398516848 AND `lng` >= -101.38559023516848 LIMIT 25 Solved... sorta.
×
×
  • 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.