INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How do I make postal addresses, from SQL output accessible to map applications?

How do I make postal addresses, from SQL output accessible to map applications?

How do I make postal addresses, from SQL output accessible to map applications?

(OP)
I have the following code that works and looks really nice according to my CSS rules.

CODE

<div class="col-lg-4">
 <!-- Workshop Schedule -->
 <h4>Workshop Schedule</h4>
 <?php 
      while($row = mysql_fetch_array($result))
     {      
 ?>
 <dl>
    <dt><?php echo date('m/d/Y', strtotime($row['wDate']))?> - <?php echo date('g:i A', strtotime($row['wTime']))?></dt>
      <dd><?php echo $row['Location']?></dd>
      <dd><?php echo $row['Address']?></dd>
      <dd><?php echo $row['City']?>, <?php echo $row['State']?>  <?php echo $row['Zip']?></dd>
      <dd><?php echo $row['Presenter']?></dd>
 </dl>
 <?php 
  }
  mysql_close($con);
 ?> 
</div> 

I would like users to be able to get the workshop location on their smart phone map application for directions.

Thank you.

RE: How do I make postal addresses, from SQL output accessible to map applications?

(OP)
Thanks!

I changed my code to:

CODE

<?php 
  while($row = mysql_fetch_array($result))
  {      
?>
<dl itemscope itemtype='schema.org/PostalAddress'>
  <dt><?php echo date('m/d/Y', strtotime($row['wDate']))?> - <?php echo date('g:i A', strtotime($row['wTime']))?></dt>
    <dd><?php echo $row['Location']?></dd>
    <dd><span itemprop='streetAddress'><?php echo $row['Address']?></span></dd>
    <dd><span itemprop='addressLocality'><?php echo $row['City']?></span>, <span itemprop='addressRegion'><?php echo $row['State']?></span>  <span itemprop='postalCode'><?php echo $row['Zip']?></span></dd>
    <dd><?php echo $row['Presenter']?></dd>
</dl>
  <?php 
  }
  mysql_close($con);
  ?> 

I also added the file linkSchemaData.js to my file list.

Is this: $("[itemtype='schema.org/PostalAddress']").linkSchemaData();
Is it the script line and where does it go, because just adding plugin and the markup didn't change anything.

Thanks again.

RE: How do I make postal addresses, from SQL output accessible to map applications?

You need to ensure the plugin has loaded and JQuery is installed.

Then this line does the magic

CODE

$("[itemtype='schema.org/PostalAddress']").linkSchemaData(); 

I assume you have a JS file attached to the GUI mark-up?

Simply put that line at the end of the usual $( document ).ready()

CODE

$(document).ready(function() {

// your other JS initialization onready code...

$("[itemtype='schema.org/PostalAddress']").linkSchemaData();
}); 

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: How do I make postal addresses, from SQL output accessible to map applications?

(OP)
Thanks 1DMF. I didn't see your reply until just now, but it seems to be working. As I said I added the page linkSchemaData.js to my files. With the appropriate lines tagged correctly (man I have a lot of div and span tags...) I added <script src="js/linkSchemaData.js"></script> to the very bottom of my page and it works great.

I do have one question maybe you can answer. I can only test on an iPhone right now, but every tap opens the map app to the directions function rather than just dropping a pin. Is that programmed in the js or is that just iOS? Not an issue so much as a need to know it works.

Thanks again you were most helpful!

RE: How do I make postal addresses, from SQL output accessible to map applications?

TBH I don't know. I don't have a mobile phone! surprise

It looks like this code does the map functionality

CODE

'urlTemplates': {
    "default": "http://maps.google.com?q={streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
    "ios": "http://maps.google.com?saddr=Current Location&daddr={streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
    "android": "geo:{streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
    "wp7": "maps:{streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
    "blackberry": "javascript:blackberry.launch.newMap({'address':{'address1':'{streetAddress}','city':'{addressLocality}','country':'{addressCountry}','stateProvince':'{addressRegion}','zipPostal':'{postalCode}'}});"
} 

So you will need to find out how to achieve your desired functionality for each phone's OS and amend the template accordingly.

The plugin page has a comments section, perhaps you could ask the author or use the contact page and pop them a polite enquiry.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: How do I make postal addresses, from SQL output accessible to map applications?

(OP)
Very interesting. I'll take a closer look at the code over the weekend. For now it serves my purposes and I'm very grateful for all your help. I have to go and markup the rest of my pages now. bigsmile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close