Note that there are some explanatory texts on larger screens.

plurals
  1. POMake slug for RSS Feed
    primarykey
    data
    text
    <p>I want to create links to RSS posts, but I need a 'slug'. I want to replace the whitespaces with a "-", so I can redirect the links to my posts on my wordpress site. My RSS: </p> <pre><code>&lt;?php include("connect.inc.php"); $items = mysql_query("select * from dailynewsitems where actief = '1' and pubDate &lt;= NOW() order by id DESC limit 15"); echo "&lt;?xml version=\"1.0\" encoding=\"iso-8859-1\" ?&gt; &lt;rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\"&gt; &lt;channel&gt; &lt;title&gt;Nieuwsfeed WebGiants Financieel&lt;/title&gt; &lt;description&gt;Nieuwsfeed WebGiants&lt;/description&gt; &lt;link&gt;http://modules.publiceer.net/nieuwsfeed_webgiants2012.php&lt;/link&gt; &lt;language&gt;nl&lt;/language&gt;"; while ($item = mysql_fetch_object($items)) { $id = $item-&gt;id; $title = $item-&gt;title; $description = $item-&gt;description; $longdesc = $item-&gt;longdesc; list($d, $m, $y) = explode("-", $item-&gt;pubDate); echo '&lt;item&gt;'; echo '&lt;guid&gt;' . $item-&gt;id . '&lt;/guid&gt;'; echo '&lt;title&gt;' . htmlspecialchars($title) . '&lt;/title&gt;'; echo 'DATUM&lt;pubDate&gt;' . date("D", mktime(0, 0, 0, $m, $d, $y)) . ', ' . $d . ' ' . date("M", strtotime($item-&gt;pubDate)) . ' ' . $y . ' 00:00:00 CST&lt;/pubDate&gt;'; echo '&lt;description&gt;' . htmlspecialchars($description) . '&lt;/description&gt;'; echo '&lt;longdesc&gt;' . htmlspecialchars($longdesc) . '&lt;/longdesc&gt;'; echo "&lt;link&gt;http://www.webgiants.nl/geen-categorie/".$item-&gt;title."&lt;/link&gt;"; echo '&lt;/item&gt;'; } echo "&lt;/channel&gt;"; echo "&lt;/rss&gt;"; </code></pre> <p>I did some research and know you can do it with something like this: $title = preg_replace("/[\s-]+/", "-", $title);</p> <p>So I want to create a title with '-' in stead of whitespaces.</p> <p>But I dont know how to implement this in my code.</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload