Wordpress question

Reply

Join Date: May 2004
Posts: 102
Reputation: kained is an unknown quantity at this point 
Solved Threads: 0
kained kained is offline Offline
Junior Poster

Wordpress question

 
0
  #1
Jun 3rd, 2009
I am designing a website for someone at the moment and they want a preview of thier wordpress blog on thier home page(not blog home page)

Is there a good way to do this automatically so that it updates itself whenever a new blog is posted or will it be a lot easier to just do it manually?

I have a completly free reign over what languages and how the home page will be coded.

Any help greatly appreciated.
Last edited by kained; Jun 3rd, 2009 at 11:11 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 3
Reputation: worldthreat is an unknown quantity at this point 
Solved Threads: 0
worldthreat worldthreat is offline Offline
Newbie Poster

Re: Wordpress question

 
0
  #2
Jun 3rd, 2009
just parse the xml from the rss feed...

  1. <?PHP
  2.  
  3. /******************************************************************************************************************
  4. RSS PARSING FUNCTION
  5. ******************************************************************************************************************/
  6.  
  7. //FUNCTION TO PARSE RSS IN PHP 4 OR PHP 4
  8. function parseRSS($url) {
  9.  
  10. //PARSE RSS FEED
  11. $feedeed = implode('', file($url));
  12. $parser = xml_parser_create();
  13. xml_parse_into_struct($parser, $feedeed, $valueals, $index);
  14. xml_parser_free($parser);
  15.  
  16. //CONSTRUCT ARRAY
  17. foreach($valueals as $keyey => $valueal){
  18. if($valueal['type'] != 'cdata') {
  19. $item[$keyey] = $valueal;
  20. }
  21. }
  22.  
  23. $i = 0;
  24.  
  25. foreach($item as $key => $value){
  26.  
  27. if($value['type'] == 'open') {
  28.  
  29. $i++;
  30. $itemame[$i] = $value['tag'];
  31.  
  32. } elseif($value['type'] == 'close') {
  33.  
  34. $feed = $values[$i];
  35. $item = $itemame[$i];
  36. $i--;
  37.  
  38. if(count($values[$i])>1){
  39. $values[$i][$item][] = $feed;
  40. } else {
  41. $values[$i][$item] = $feed;
  42. }
  43.  
  44. } else {
  45. $values[$i][$value['tag']] = $value['value'];
  46. }
  47. }
  48.  
  49. //RETURN ARRAY VALUES
  50. return $values[0];
  51. }
  52.  
  53.  
  54. /******************************************************************************************************************
  55. SAMPLE USAGE OF FUNCTION
  56. ******************************************************************************************************************/
  57.  
  58. //PARSE THE RSS FEED INTO ARRAY
  59. $xml = parseRSS("http://worldthreat.net/?feed=rss2");
  60.  
  61. //SAMPLE USAGE OF
  62. foreach($xml['RSS']['CHANNEL']['ITEM'] as $item) {
  63. echo("<p class=\"indexBoxNews\"><a href=\"{$item['LINK']}\" target=\"_blank\" class=\"indexBoxNews\">{$item['TITLE']}{$link}</a></p>");
  64. }
  65.  
  66. ?>
Last edited by peter_budo; Jun 3rd, 2009 at 1:35 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,352
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Wordpress question

 
0
  #3
Jun 3rd, 2009
Wordpress preview lugins at wordpress.com
Wordpress latest posts plugins at wordpress.com
a bunch of other plugins from various other providers
hav no experience as which ones work best,
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 102
Reputation: kained is an unknown quantity at this point 
Solved Threads: 0
kained kained is offline Offline
Junior Poster

Re: Wordpress question

 
0
  #4
Jun 3rd, 2009
thats amazing work world threat.

With that php script its literlly dump the whoe thing in the div i want i to appear in and change

  1. //PARSE THE RSS FEED INTO ARRAY
  2. $xml = parseRSS("http://worldthreat.net/?feed=rss2");

to reflect the actually addres of the rss feed in the blog?

Or do

  1. 'RSS']['CHANNEL']['ITEM']

all need defining somehow as well.
Last edited by kained; Jun 3rd, 2009 at 1:49 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC