Welcome to Geeklog, Anonymous Thursday, November 14 2024 @ 09:37 am EST

Downloads

Root : Add-ons : Hacks : 
snapshot
Category: Add-ons arrow Hacks
Tags: -
Date: 2018-01-09 15:59
Size: 110.89 KB
Version: alpha
MD5: cf3dffa2157f2985731ab8c74c87cd17
Submitter: masodo
Rating: 0.00
Popularity: 967   POP
Get only the latest post from your favorite blogs. Display in side block or static page.
A great deal of my blogging efforts revolve around promoting others' blogs. For many years I would use the Geeklog Portal Blocks to share their RSS feeds. I soon got the idea to attempt to extract a remote site's latest post and feature it in a static page or block and set about cobbling together this hack. In addition to showing the last post for the blog it also gets the website's logo and link if supplied to their feed (some do, some don't.)

This code includes a nifty tag closer function which is handy when truncating feeds to whatever length you decide.

In order to make the best use of these functions the PHP Block Function input field in the Block Edit template needs to be expanded beyond the default 50 character limit.
I reset to 256 characters but occasionally even find this too short.

In the file:

/public_html/layout/denim/admin/block/blockeditor.thtml

Change @ Line 66 ==>

66 <dl class="form_block">
67 <dt><label for="admin-blockeditor-phpblockfn">{lang_blockfunction}</label></dt>
68 <dd><input type="text" maxlength="50" value="{block_phpblockfn}" name="phpblockfn" id="admin-blockeditor-phpblockfn" class="size5" aria-describedby="desc-admin-blockeditor-phpblockfn"{xhtml}></dd>
69 <dd id="desc-admin-blockeditor-phpblockfn" class="description">{lang_phpblockwarning}</dd>
70 </dl>

To ==>

66 <dl class="form_block">
67 <dt><label for="admin-blockeditor-phpblockfn">{lang_blockfunction}</label></dt>
68 <dd><input type="text" maxlength="256" value="{block_phpblockfn}" name="phpblockfn" id="admin-blockeditor-phpblockfn" class="size5" aria-describedby="desc-admin-blockeditor-phpblockfn"{xhtml}></dd>
69 <dd id="desc-admin-blockeditor-phpblockfn" class="description">{lang_phpblockwarning}</dd>
70 </dl>

This change also requires that the table "gl_blocks", field "phpblockfn" be modified to VARCHAR 128 (I did this in myphpadmin.)


To feature a sites last post in a block:

Create a php block and include the following function...

phpblock_RSSLastPost(Blog Name Here|Blog Slogan Here|http://BlogsAddress.to/rssfeed)
Each argument must be separated by "|" (pipe character) quotes not required. This is actually passing an array to the function to be exploded therein.

To feature a sites last post in a static page:

Create a static page and set PHP option to "execute PHP" and include only the following echo call to the function...

echo phpblock_RSSTail( 'Blog Name Here', 'Blog Slogan Here', 'http://BlogsAddress.to/rssfeed' );
Each argument enclosed in single quotes and comma separated.

Post in HTML formatted mode only.
---

This is truly a hack but is working nicely for me now after many (many) iterations. I am not sure how much help I can be if you attempt to incorporate this into your Geeklog setup, so use with caution and be prepared to customize to suit.
Perhaps I will work this system into plugin someday but wanted to share now and take a break to celebrate success.

File List for the Project: RSS Tail

Title File Version Size Date
RSS Last Post RSSLastPost.zip alpha 113547 2018-01-09 15:59