In your PHP you are encoding your < and > to HTML entities. You need
to do the reverse to your "description" variable in JavaScript. They
come from your PHP/XML as entities and if just printed in a web
browser, would show their < and > characters and not be interpreted as
HTML tags. Decode them and you should be good to go.

On a side note, it may be more intuitive to put your description as
the content of your <marker> HERE </marker> tag. You'd still need to
encode and decode it, but it may fit better as content rather than an
attribute. Just a thought.

On Mar 9, 9:39 am, Daniel <[email protected]> wrote:
> Hi,
> My markers are generated via XML with content that contains <a href>
> links. In the InfoWindows the html links are displayed as regular
> text, so instead of a link I get the whole <a href="">link</a>. Is
> there a way to fix this? I've searched around but haven't found a
> clear answer. Would be really grateful if someone could help me with
> this.
>
> Here's a link to the website:
> Map:http://tresuri.com/big-map/
> Javascript-file:http://tresuri.com/wp-map/bigmap.js
> XML-generator:http://tresuri.com/wp-map/generatexml.php
>
> XML-generator code:
>
> <?php
> require("C:/xampp/htdocs/tresuri/wp-map/dbinfo.php");
> require( 'C:/xampp/htdocs/tresuri/wp-load.php' );
>
> function parseToXML($htmlStr)
> {
>    $xmlStr=str_replace('<','&lt;',$htmlStr);
>    $xmlStr=str_replace('>','&gt;',$xmlStr);
>    $xmlStr=str_replace('"','&quot;',$xmlStr);
>    $xmlStr=str_replace("'",'&#39;',$xmlStr);
>    $xmlStr=str_replace("&",'&amp;',$xmlStr);
>    return $xmlStr;
>
> }
>
> // Opens a connection to a MySQL server
> $connection=mysql_connect (localhost, $username, $password);
> if (!$connection) {
>   die('Not connected : ' . mysql_error());
>
> }
>
> // Set the active MySQL database
> $db_selected = mysql_select_db($database, $connection);
> if (!$db_selected) {
>   die ('Can\'t use db : ' . mysql_error());
>
> }
>
> // Select all the rows in the markers table
> $query = "SELECT id,object_id,post_title,post_content,post_name,type
> FROM wp_posts, wp_term_relationships WHERE id=object_id AND
> post_status='publish' AND post_type='post' AND term_taxonomy_id=3";
> $result = mysql_query($query);
> if (!$result) {
>   die('Invalid query: ' . mysql_error());
>
> }
>
> header("Content-type: text/xml");
>
> // Start XML file, echo parent node
> echo '<?xml version="1.0" encoding="UTF-8"?>';
> echo '<markers>';
>
> // Iterate through the rows, printing XML nodes for each
> while ($row = @mysql_fetch_assoc($result)){
>    $post_id = $row['object_id'];
>    $single = true;
>    $lat = get_post_meta($post_id, marker_lat, $single);
>    $lng = get_post_meta($post_id, marker_lng, $single);
>    $type = get_post_meta($post_id, type, $single);
>
>   // ADD TO XML DOCUMENT NODE
>   echo '<marker ';
>   echo 'name="' . parseToXML($row['post_title']) . '" ';
>   echo 'description="' . parseToXML($row['post_content']) . '" ';
>   echo 'permalink="http://tresuri.com/'. $row['object_id'] . '/' .
> parseToXML($row['post_name']) . '" ';
>   echo 'lat="' . $lat . '" ';
>   echo 'lng="' . $lng . '" ';
>   echo 'type="' . $type . '" ';
>   echo '/>';
>
> }
>
> // End XML file
> echo '</markers>';
> ?>
>
> Regards,
> Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to