marcis Posted June 4, 2009 Report 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
marrtins Posted June 5, 2009 Report 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
Snaip3Rs Posted June 5, 2009 Report Posted June 5, 2009 A šis kods jaliek pie index.php ? vai kā! Quote
bubu Posted June 5, 2009 Report Posted June 5, 2009 Jāliek tur, kur gribi, lai RSS izvadās ārā. Quote
bubu Posted June 5, 2009 Report 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
foxc Posted June 5, 2009 Author Report Posted June 5, 2009 a apaksaa tam kodam nevajag nosleedzoso ?> ??? Quote
bubu Posted June 5, 2009 Report 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
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.