azumone
Forum Replies Created
-
Forum: Plugins
In reply to: Google Maps APIThis is where I’m having trouble posting to the forum again. I apologize for these re-edits. But the combination of PHP, javascript, and HTML is not being displayed correctly between backticks (or I’m not being carful enough:
After this
‘<?php
$postdata = $wpdb->get_row(“SELECT post_excerpt FROM wp_posts WHERE id = $id”);
?><script type=”text/javascript”>’
comes this,
‘var point = new GPoint(<?php echo $lon; ?>,<?php echo $lat; ?>);’
followed by the ‘var post_html =’ which builds your html displayed in the overlay callout. This code doesn’t display well between backticks:
‘var post_html = “<small><b>Date: ” + ‘<?php echo $postdate; ?>’+ “</b></small><br><b>”+
‘”<a href=”’+'<?php echo $link; ?>’ + “‘> ” +
‘<?php echo $title; ?>’+
“</closing the a href with an a ></b><br>”+ ‘<?php echo $postdata->post_excerpt; ?>’;And then finally:
var marker = createMarker(point, post_html);
map.addOverlay(marker);
</script>
<?php } ?> <!– Close the if statement. –>’This has been the real kicker; trying to display post data in display windows. Hopefully someone out there comes up with some cleaner code….?
Forum: Plugins
In reply to: Google Maps APISorry, the statement in the above code:
is unneccessary and wasn’t pasting through correctly.
The basic idea is to pass the PHP variables to the API java script that posts to the Google Map.
In the above code the first snippet of java just needs to be before The Loop:
‘<?php if ( !(in_category(’22’)) ) { ?>
<?php $lon = get_lon(); ?>
<?php $lat = get_lat(); ?>
<?php $link = get_permalink() ?>
<?php $title = the_title(”,”,false); ?>
<?php $postdate = get_the_time(‘m/j/y’) ?>
<?php
$postdata = $wpdb->get_row(“SELECT post_excerpt FROM wp_posts WHERE id = $id”);
?>’