hello guys how are you, i have an inquire about how can i put the adress if my adress contains php
it is the link which i want to put

 <link>shownews.php?full=news&id_topic=$row->id_topic</link>

here is my code

<?php

header('Content-Type: application/xml');

mysql_connect('localhost','root','root');
mysql_select_db('ahmad');
 echo '<?xml version="1.0" encoding="utf-8"?>'?>
<rss version="2.0">
<channel>




<title>my articles</title>
<description>News,social,media</description>
<link>/</link>




<?php 
$show_data=mysql_query("select * from `topics` limit 10");
while ($fetch_data=mysql_fetch_object($show_data)){
?>
<item>
  <title><?=$fetch_data->topic_title;?></title>
  <link>http://google.com</link>
    <pubDate>Sat, 9 Jan 2010 16:23:41 GMT</pubDate>

</item>';
<?php
}





?>



</channel>
</rss>

Are you asking how you can echo the object property from PHP into the <link> in your markup?

You can put PHP code into the markup at any point, anywhere, by just opening up a <?php tag. So if you want to print something into the middle of a string, you just do

<link>shownews.php?full=news&id_topic=<?php echo $row->id_topic; ?></link>

Also note, though, like in the <title> tag above the <link>, some PHP installations allow the use of a shorter syntax; the so-called "short-tags". That would allow you do write the above line as:

<link>shownews.php?full=news&id_topic=<?= $row->id_topic; ?></link>

Keep in mind though that this is not universally supported, and can cause issues if the code is migrated to a different server, used in a library, or the configuration of the current server is changed. As such, It's generally not recommended to use them. Not unless you yourself have control over the server, and know how to manage it.

yes that what do i mean but it is not work's the link is hidden from the page as you see in this image : http://s9.postimage.org/f7msi4jpr/44444.jpg
i want to put the link like this :
http://mydomain.com/shownews.php?full=news&id_topic=<?php echo $row->id_topic; ?>

but as i mentioned link is hidden from the page

i nothice that : i have stored the link in data base and i select it and its work well put i want to do that by this way

please help

The problem may be the format of the <link> element. I'm not an expert on RSS feeds, but as far as I can tell from a few Google searches, the format of that element should be something more like:

<link rel="alternate" href="http://example.com/path/to/file.html"/>

Perhaps if you alter your code to create that instead of your current format, it will be rendered correctly.

That is not how the 'link' element works in rss. rss is designed to be consumed by an rss reader, and the link element will work properly in that context. If you want to have a clickable 'link' on that page you must put it in the description element of your feed.
(I suppose you could also enclose the title in an <a href> tag but not recommended. rss/xml hates & symbol. You may have to urlencode that symbol with an & or %26
like this: http://mydomain.com/shownews.php?full=news%26id_topic=.... )
For example, create your link element as described in your second post, that is the proper format.

    <link>
    http://mydomain.com/shownews.php?full=news&id_topic=<?php echo $row->id_topic; ?>
    </link>
    // In your description tag:
    <description>
    <a href="http://mydomain.com/shownews.php?full=news&id_topic=<?php echo $row->id_topic; ?>">Text that you would like to be clickable in this feed.</a>
    </description>

thank guys proplem has been solved by using htmlentities

That is not how the 'link' element works in rss.

Ahh, I was confusing RSS and ATOM feeds. What I posted is the proper format for the latter, while the other is RSS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.