1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Display Recent Blog Posts on Directory Sidebar

Discussion in 'Directories' started by aditya_sfs, Feb 21, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Some people asked me how do i display my recent blog posts on directory sidebar. Well there are two methods, first is using javascript but we wont talk about it. Why because, it is executed on client side and doesnt come from server side, so it is like not SE friendly and so people like me and you hate it.


    Second method is to use a PHP script to read RSS and convert it to HTML. For this you need two files named rss2html.php and template.html. [ Download them here ]. Then follow these steps.


    1. Upload both of them to your directory root folder.


    2. Edit your directory’s init.php file and somewhere in middle spot out the following


    $tpl->assign(’MetaRobots’ , trim ($MetaRobots) );
    $tpl->assign(’MetaKeywords’ , trim ($MetaKeywords) );
    $tpl->assign(’MetaDescription’, trim ($MetaDescription) );
    $tpl->assign(’MetaAuthor’ , trim ($MetaAuthor) );
    $tpl->assign(’MetaCopyright’ , trim ($MetaCopyright) );



    3. Immediately after that insert the following code


    $rssurl=”http://www.web1directory.com/rss2html.php”;
    $blogfeedurl=”http://www.web1directory.com/blog/feed/”;
    $templateurl=”http://www.web1directory.com/template.html”;
    $url=$rssurl.”?XMLFILE=”.$blogfeedurl.”&TEMPLATE=”.$templateurl;
    $html = implode(”, file($url));
    $tpl->assign(’latestposts’,$html);



    4. Remember to edit the top three lines. $rssurl (first one) is the path to your rss2html.php file, second one is your Blog feed url and third one is template.html file URL. (DONT USE MINE PLEASE) :p :p


    5. Save the init.php file


    6. Open your template and whereever you want the recent posts to appear, put {$latestposts}. You can edit the template.html to control the looks of your directory


    7. You are done.


    regards
    aditya
    SEMrush
     
    aditya_sfs, Feb 21, 2007 IP
    iceberg, wwws, deluxdon and 12 others like this.
    SEMrush
  2. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,177
    Best Answers:
    0
    Trophy Points:
    430
    #2
    I was the first person to ask this :eek:
    thanks for the code will try it now and update in this thread with the results.
    Amit
     
    amitpatel_3001, Feb 21, 2007 IP
    aditya_sfs likes this.
  3. wwws

    wwws Notable Member

    Messages:
    3,385
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    225
    #3
    Green Rep given, not like you need anymore:D but I find this to be very usefull and thank you!
     
    wwws, Feb 21, 2007 IP
    aditya_sfs likes this.
  4. smub

    smub Notable Member

    Messages:
    3,443
    Likes Received:
    375
    Best Answers:
    0
    Trophy Points:
    230
    #4
    very nice info aditya ... i'll surely try this .. thanks alot.

    also if you know how to add all the alexa icons and stuff let me kno as well :)
     
    smub, Feb 21, 2007 IP
    aditya_sfs likes this.
  5. iceberg

    iceberg Notable Member

    Messages:
    1,752
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    200
    #5
    so nice of you Aditya, thanks for sharing the code. :)
     
    iceberg, Feb 21, 2007 IP
    aditya_sfs likes this.
  6. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,727
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #6
    Cool!
    Thanks for sharing!
     
    Richie_Ni, Feb 21, 2007 IP
    aditya_sfs likes this.
  7. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,470
    Likes Received:
    1,941
    Best Answers:
    32
    Trophy Points:
    480
    #7
    Thanks for sharing this useful things with us aditya.

    I can find this code here too ;) at your directory's Blog.
     
    deluxdon, Feb 21, 2007 IP
  8. MeetHere

    MeetHere Prominent Member

    Messages:
    15,412
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #8
    Can I see a demo of what are you talking about :rolleyes:
     
    MeetHere, Feb 21, 2007 IP
  9. aditya_sfs

    aditya_sfs Peon

    Messages:
    2,272
    Likes Received:
    389
    Best Answers:
    0
    Trophy Points:
    0
    #9
    yeah goto my directory and see sidebar, you will see 5 recent posts from the blog there.
     
    aditya_sfs, Feb 22, 2007 IP
  10. casperl

    casperl Peon

    Messages:
    1,560
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I was just planning to implement it. It seems that you saved some of my time. Thanks.
     
    casperl, Feb 22, 2007 IP
    aditya_sfs likes this.
  11. giggler

    giggler Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    This is a great method. I wanted to be able to put the post anywhere on the directory and wasn't sure if this did that or if it was a set template with the blogs on the side, so I had to do it differently.

    I've posted the how to here and added a link to this method as well since I think both methods can be used. The hard part for most people isn't really getting the code and the nice seo friendly url, it'll probably be getting the templates to mirror. PHPLD to wordpress isn't that that. Just take the source from the page output and copy the header and such over. Since Wordpress uses CSS, it might help to know some of it.

    http://www.linkwebdirectory.com/web/2007/04/11/integrating-wordpress-with-phpld/
     
    giggler, Apr 11, 2007 IP
  12. jg123

    jg123 Notable Member

    Messages:
    6,006
    Likes Received:
    387
    Best Answers:
    0
    Trophy Points:
    295
    #12
    jg123, Jun 18, 2007 IP
  13. indyguidedotinfo

    indyguidedotinfo Notable Member

    Messages:
    3,254
    Likes Received:
    202
    Best Answers:
    0
    Trophy Points:
    245
    #13
    I tried this last night using phpld 2.1 and received error messages. Does this require 3.* ?
     
    indyguidedotinfo, Jul 14, 2007 IP
  14. sizzler_chetan

    sizzler_chetan Prominent Member

    Messages:
    7,839
    Likes Received:
    664
    Best Answers:
    0
    Trophy Points:
    390
    #14
    As the directory in which Aditya installed is 3.x i think it would need 3x version for the feature to come.
     
    sizzler_chetan, Jul 14, 2007 IP
  15. sabian1982

    sabian1982 Notable Member

    Messages:
    2,028
    Likes Received:
    161
    Best Answers:
    0
    Trophy Points:
    210
    #15
    sabian1982, Jul 14, 2007 IP
  16. kyoku2

    kyoku2 Peon

    Messages:
    322
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #16
    hello. i'm getting an error for this code.

    Parse error: syntax error, unexpected ':' in /home/blah/public_html/mysite/init.php on line 138
     
    kyoku2, Aug 9, 2007 IP
  17. indyguidedotinfo

    indyguidedotinfo Notable Member

    Messages:
    3,254
    Likes Received:
    202
    Best Answers:
    0
    Trophy Points:
    245
    #17
    what version of phpld are you using ? i am pretty sure i had that same error with 2.1 ' the free version '
     
    indyguidedotinfo, Aug 10, 2007 IP
  18. kyoku2

    kyoku2 Peon

    Messages:
    322
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #18
    im using v3.2 :)
     
    kyoku2, Aug 10, 2007 IP
  19. mann3r

    mann3r Peon

    Messages:
    1,416
    Likes Received:
    100
    Best Answers:
    0
    Trophy Points:
    0
    #19
    I am also looking for this one, and thanks for sharing, deserves a lot of greens:D
     
    mann3r, Aug 10, 2007 IP
  20. LeopardAt1

    LeopardAt1 Well-Known Member

    Messages:
    880
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #20
    Nice work aditya :D, sent you a green as well.
     
    LeopardAt1, Aug 11, 2007 IP
Thread Status:
Not open for further replies.