trouble with php, url and hyperlink

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • n8kindt
    New Member
    • Mar 2008
    • 221

    trouble with php, url and hyperlink

    i'm having problems with
    1) putting a url into xml using php
    and once it is in a url
    2) parsing it as a hyperlink...

    i've tried using &amp; and &#61; to parse the url but i keep getting the 'XML Parsing Error: not well-formed' which points to the &amp; and &#61; signs. or if i'm using <!CDATA it will point to the '<!CDATA'...

    if i just try using a simple url (say 'www.google.com ') it parses but it won't display as a hyperlink although by looking at the page source, you would think it would.

    i figure rather than me pulling my hair out over it i'd have u guys look at it and see if there are any obvious suggestions


    Code:
    	private function getItems()
    	{
    		$itemsTable = "store_tranlog";
    		$this->dbConnect($itemsTable);
    		$query = 'SELECT * FROM `store_tranlog` ORDER BY `date` DESC LIMIT 0,30';
    		$result = mysql_db_query (DB_NAME, $query, LINK);
    		$items = '';
                   while($row = mysql_fetch_array($result))
    		{
               $url = 'http://www.xxx.com/admin/index.php?page=orders&action=viewoldorder&cartid='. $row["cartid"];
    			$items .= '<item>
    				<title>'. $row["date"] .'</title>
    
    				<link><html><a href="'.$url.'">'.$row["cartid"].'</a></html></link>
    				//tried cdata... didn't work <![CDATA['.$url.']]>
    				<description></description>
    			</item>';
    		}
    		$items .= '</channel>
    				';
    		return $items;
    	}
    
    }
    also, here's my stylesheet info (dunno if that matters or not)
    Code:
    rss {
    display: block;
    font-family: verdana, arial;
    }
    title {
    display: block;
    margin: 5px;
    padding: 2px;
    color: gray;
    border-bottom: 1px solid silver;
    }
    link {
    display: block;
    font-size: small;
    padding-left: 10px;
    }
    item {
    display: block;
    padding: 2px 30px 2px 30px;
    }
    docs {
    display: block;
    background-color: #ffffe6;
    margin: 20px;
    text-align: center;
    padding: 5px;
    color: #7f7f7f;
    border: 1px solid silver;
    }
    /* all hidden elements */
    language, lastBuildDate, ttl, guid, category, description, pubDate {
    display: none;
    }
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    what about
    Code:
    <link><html><a href="'.htmlspecialchars($url).'">'.$row["cartid"].'</a></html></link>
    ?

    Comment

    • n8kindt
      New Member
      • Mar 2008
      • 221

      #3
      Originally posted by Dormilich
      what about
      Code:
      <link><html><a href="'.htmlspecialchars($url).'">'.$row["cartid"].'</a></html></link>
      ?
      oh wow. i was obviously just learning php when i posted this. i hadn't revisited in this problem a while and if i did, i would have/should have known to use that. thanks for the reply! i'm sure it will work.

      Comment

      Working...