foxc Posted June 4, 2009 Report Share Posted June 4, 2009 Ka var izveidot savu RSS ? Paldies Quote Link to comment Share on other sites More sharing options...
marcis Posted June 4, 2009 Report Share Posted June 4, 2009 Tik pat labi vari prasīt kā izveidot savu mājalapu aka html'u. RSS tas pats XML vien ir. Quote Link to comment Share on other sites More sharing options...
marrtins Posted June 5, 2009 Report Share Posted June 5, 2009 Aptuveni šādi: <?php header("Content-type: application/rss+xml"); $site_domain = "some.lv"; $xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><rss version="2.0"></rss>'); $channel = $xml->addChild('channel'); $channel->addChild('title', ent('Some title')); $channel->addChild('link', ent("http://$site_domain/")); $channel->addChild('description', ent('Some description')); $image = $channel->addChild('image'); $image->addChild('url', ent("http://$site_domain/img/some-logo.png")); $image->addChild('link', ent("http://$site_domain/")); foreach($items as $id=>$item) { $xmlItem = $channel->addChild('item'); $xmlItem->addChild("title", ent($item['virsraksts'])); $xmlItem->addChild("link", "http://$site_domain/news.html?id=$id"); $xmlItem->addChild("description", ent($item['content'])); } print $xml->asXML(); function ent($data) { return htmlspecialchars($data, ENT_COMPAT, 'utf-8'); } // ent Quote Link to comment Share on other sites More sharing options...
Snaip3Rs Posted June 5, 2009 Report Share Posted June 5, 2009 A šis kods jaliek pie index.php ? vai kā! Quote Link to comment Share on other sites More sharing options...
bubu Posted June 5, 2009 Report Share Posted June 5, 2009 Jāliek tur, kur gribi, lai RSS izvadās ārā. Quote Link to comment Share on other sites More sharing options...
foxc Posted June 5, 2009 Author Report Share Posted June 5, 2009 izmainiiju laikumus, bet neiet.. Quote Link to comment Share on other sites More sharing options...
bubu Posted June 5, 2009 Report Share Posted June 5, 2009 Tad debugo. Quote Link to comment Share on other sites More sharing options...
foxc Posted June 5, 2009 Author Report Share Posted June 5, 2009 debugo?? ko tas nozimee.. Quote Link to comment Share on other sites More sharing options...
bubu Posted June 5, 2009 Report Share Posted June 5, 2009 Tas nozīmē meklē kļūdu. Pārbaudi kas darbojas un kas nē. Kad atradīsi vietu, kas nedarbojas, tad pārbaudi kāpēc - mainīgo vērtības, koda loģiku un tml. Tad kad sapratīsi kāpēc - tad izlabo kļūdu un viss darbosies. Quote Link to comment Share on other sites More sharing options...
foxc Posted June 5, 2009 Author Report Share Posted June 5, 2009 a apaksaa tam kodam nevajag nosleedzoso ?> ??? Quote Link to comment Share on other sites More sharing options...
bubu Posted June 5, 2009 Report Share Posted June 5, 2009 Tas nav obligāti. Parasti kārtīgā kodā liek, bet var arī nelikt: http://www.php.net/manual/en/language.basi...-separation.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.