Subject: News block/module

Posted on: 19/02/02 11:08am
By: squatty

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 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 The source code is located at

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?


I keep getting this when I add that block...

Posted on: 19/02/02 11:56am
By: Anonymous

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

I keep getting this when I add that block...

Posted on: 19/02/02 02:02pm
By: squatty

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!

Just added caching

Posted on: 19/02/02 02:45pm
By: squatty

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 archive.

Good Work

Posted on: 20/02/02 02:47am
By: chmouel

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

Good Work

Posted on: 20/02/02 05:56am
By: squatty

Fixed it. Thanks.


Posted on: 27/02/02 12:29am
By: 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?


Posted on: 27/02/02 06:08am
By: squatty

I added a README to the archive. You can re-download it from

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.


ABCNews has ONLY been tested with Geeklog 1.3.1! I have only tested the block with PHP 4.1 The 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!

Parse Error

Posted on: 01/03/02 06:05am
By: squatty

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.


Parse Error

Posted on: 02/03/02 09:33am
By: Anonymous

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

Parse Error

Posted on: 02/03/02 01:44pm
By: squatty

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.

Geeklog - Forum