Welcome to Geeklog, Anonymous Wednesday, December 11 2024 @ 01:31 pm EST

Geeklog Forums

News block/module


Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
In true portal fashion, and with the inspiration of Chmouel (thanks for the weather block!) I managed to create a news block that pulls content from ABCNews.com. The news block displays links to ABCNews stories and has all the same features, both user and admin as the weather block created by Chmouel. In fact, I reused as much of his code as possible Smile

The news block allows users to customize their default view with one of the following feeds:

  • World News
  • US News
  • Political News
  • Business News
  • Science News
  • ESPN Sports
  • Entertainment News
  • Health and Living News
  • You can view my news block in action at http://www.squatty.com. The source code is located at http://www.squatty.com/news.zip.

    The one major issue with the block that needs some attention is the lack of a caching mechanism. It would be nice to cache both the display and detailed views. If anyone out their has some ideas please let me know?

    Thanks,
    Danny


    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Anonymous

    Anonymous
    "1054: Unknown column 'news' in 'field list' " Thanks for the help.
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    My bad, I included the wrong version of code in the zip file /public_html folder. The contents of /public_html/news should only include the following files:

  • admin.php
  • detailed_news.php
  • display_news.php
  • Where display_news.php is the block view and detailed_news.php is the secondary detailed view. I also neglected to add the sql updates for the Geeklog groups and userprefs tables! Download the zip file again.

    Sorry, it was late when I made the zip archive!


    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    I was able to add caching to the front view. This should speed things up a bit. The updated file (display_news.php) can be found in the news.zip archive.
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Status: offline

    chmouel

    Forum User
    Newbie
    Registered: 02/05/02
    Posts: 13
    Good work, but you may want to cleanup some stuff from your original tarball :

    chmou@giants|e/news| grep -ri weather * public_html/news/admin.php: if (SEC_inGroup('Weather')) { chmou@giants|e/news| file public_html/images/news/Thumbs.db public_html/images/news/Thumbs.db: Microsoft Office Document

    Chmou
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    Fixed it. Thanks.
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Anonymous

    Anonymous
    could an installation instructions file be written up to explain how to install this news php block? It looked straight forward but it is reaking havoc on my geeklog, may be due to caching issues? where is the cache directory and is it supposed to be setup with special permissions?
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    I added a README to the news.zip archive. You can re-download it from http://www.squatty.com/news.zip

    In summary, here's the steps for installing the ABCNews block:

    1) Extract the code to /public_html
    A new directory named news will be created for you.

    2) Run the SQL script: news-sql.sql
    The script will create one new table named abcnews and make updates to userprefs and groups tables. The details are as follows:

    All news feeds are stored in the abcnews table. This look-up table stores the available news feeds.

  • The updates to the group table are required to set permissions for the site administrator. Once the group table is updated be sure add your admin id the News group. The site admin will not be able to set the default news feeds until the id is a member of the News group.
  • userprefs update creates a news column in the userprefs table. The news column is where user personalization is stored.
  • 3) Add the phpblock: news.phpblock
    The first step is to add the contents of newss.phpblock to lib-custom.php. The second step is to simply create the phpblock and reference the phpblock_getnews function.

    NOTES

  • ABCNews has ONLY been tested with Geeklog 1.3.1!
  • I have only tested the block with PHP 4.1
  • The news.zip archive was created in a Windows environment. You may want to extract it to a Windows based system an the FTP to your web server?
  • To enable caching for the front view make sure that the /public_html/news/cache directory is writable by your web server. For example if your web server process is owned by nobody run the following: chown -R nobody cache/
  • Have fun!


    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    Someone pointed out to me the fact that I had no closing "?>" tag at the end of display_news.php. If you are receiving a parse error, adding the "?>" should solve the problem.

    Thanks.


    In a world without walls and fences, who needs Windows and Gates?
     Quote

    erics

    Anonymous
    I also noticed that you need to removed the LAST } from display_news.php. I just downloaded news.zip from you on 2/28/02 so you may want to update the package again.... ----- Man I love this stuff....
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    Thanks for the heads up. I made the update. This was my first attempt at a php block so, as you can see I was a bit sloppy.
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    All times are EST. The time is now 01:31 pm.

    • Normal Topic
    • Sticky Topic
    • Locked Topic
    • New Post
    • Sticky Topic W/ New Post
    • Locked Topic W/ New Post
    •  View Anonymous Posts
    •  Able to post
    •  Filtered HTML Allowed
    •  Censored Content