28 Sep 2004

Bio-Solar-Haus

Filed under: General, Thoughts — mark @ 16:58

This company makes some interesting houses thT I quite like the look of. Really when I have some time I should go and have look, since they are really not that far away.

26 Sep 2004

FeedOnFeedsinWordPress

Filed under: Web — mark @ 21:24

Its late and I am still having a load of problems getting thr text to display hustr as I want it to. Some text is interperated and results in formating while what I want to do is just display the text.
I have tried varipos plugins and it helps a little but I really just want to dispay text with no formating. I have only maged this with “ Any help is appreciated. Real text starts below!

This explains how to modify Feed on Feeds v0.1.7 to intergrate this with Wordpress v1.2. If you want to see the results of this modification have a look at my subscriptions page. Once more many thanks to Carthik who got me started, and who’s article I shameless used as the basis for this article. Find out why I did this in my earlier post.

Summary of what needs to be done.
1. The required FOF files need to be obtained and put in to the right places.
2. FOF must be configured and setup.
3. The “init2.php” file must be created.
4. A second “view.php” must be created.
5. The Wordpress “index.php” must be modified.
6. Secure your system.
7. Modify the “fof.css” to your own needs.

Now in some more detail.
1. The required FOF files need to be obtained and put in to the right places.
a. Download the latest FoF I got version 0.1.7.
b. Extract all the files in to a new folder placed under your wordpress folder. If your wp is in the …/blog directory this should be: …/blog/feedonfeeds-0.1.7

2. FOF must be configured and setup.
a. Edit the config.php file in the feedonfeeds-0.1.7 directory.
You need to change the section:

define(‘FOF_DB_HOST’, “localhost”);
define(‘FOF_DB_USER’, “user”);
define(‘FOF_DB_PASS’, “pass”);
define(‘FOF_DB_DBNAME’, “name”);

to match your WP installation. Look at the file config.php in your WP directory if you can’t remember the details!
Also change the line:

define(‘FOF_TIME_OFFSET’, 0);

to show the difference between your time zone and the time zone of your server. In my case -6 (I am in Germany the server in the USA.)

define(‘FOF_TIME_OFFSET’, -6);

c. point your browser to: …/blog//feedonfeeds-0.1.7/install.php and run though the installation.
Now just point your browser at …/blog//feedonfeeds-0.1.7/ and you have a working version of FOF.

3. The init2.php file must be created.
a. Copy the file …/blog//feedonfeeds-0.1.7/init.php to …/blog/init2.php
b. Edit Line 15 in the init2.php file you have just created:

require_once(“config.php”);

should be changed to :

require_once(“/home/…/blog/feedonfeeds-0.1.7/config.php”);

in place of /home/…/blog/feedonfeeds-0.1.7/ put the path from your server
c. Edit Line 24 in the init2.php file you have just created:

require_once(‘magpierss/rss_fetch.inc’);

should be changed to :

require_once(‘/home/…/blog/feedonfeeds-0.1.7/magpierss/rss_fetch.inc’);

in place of /home/…/blog/feedonfeeds-0.1.7/ put the path from your server
d. Edit Line 25 in the init2.php file you have just created:

require_once(‘magpierss/rss_utils.inc’);

should be changed to :

require_once(‘/home/…/blog/feedonfeeds-0.1.7/magpierss/rss_utils.inc’);

in place of /home/…/blog/feedonfeeds-0.1.7/ put the path from your server

4. A second “view.php” must be created.
a. Copy the file …/blog//feedonfeeds-0.1.7/view.php to …/blog/view.php
b. Edit Line 16 in the “view.php” file you have just created:

include_once(“init.php”);

to:

include_once(“init2.php”);

c. Edit Line 36 in the “view.php” file you have just created:

<link rel="stylesheet" href="fof.css" media="screen" />

to:

<link rel="stylesheet" href="feedonfeeds-0.1.7/fof.css" media="screen" />

d. Edit Line 37 in the “view.php” file you have just created:

<script src="fof.js" type="text/javascript"></script>

to:

<script src="feedonfeeds-0.1.7/fof.js" type="text/javascript"></script>

e. Optional, but I did not want the “flag up to this item” function to show in with the wp implementation, so I /* */ out the section:

if(!$noedit)
{
echo ' <span class="controls">';
print "<a href="javascript:flag_upto('c$item_id')">flag all up to this item</a> ";
print "<input type="checkbox" name="c$item_id" value="checked" />";
echo '</input></span>';
}

to be:

/*
if(!$noedit)
{
echo ' <span class="controls"><a href="javascript:flag_upto('c$item_id')">flag all up to this item</a> ";
print "<input type="checkbox" name="c$item_id" value="checked" />";</input>
echo '
*/

f. Optional, but it helped me with formating and the layout when I modifed the css.
In the line

print "<div class="clearer">m_content</div>";

I removed the to get:

print "<div class="clearer"></div><div class="body">$item_content</div>";

5. The Wordpress “index.php” must be modified.
I have taken this directly from Carthik, with one modification and that was to include formating for the the new text “My subscriptions:” I included a

<h2> </h2>

and removed a

</br>

as this worked well with my WP css.

The portion of “index.php” that serves the entries is what needs to be modified. What we are trying to do is to have the “index.php” file display the subscriptions page when the parameter “subscriptions” is passed to it.
So find the line that says :

< ?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>

include the following piece of code :

$subscriptions = $_GET['subscriptions'];
if ($subscriptions == 1) { echo "<h2>My subscriptions:";
include('view.php');
}
else { ?>
</h2>

then,

find the lines that say :

matched your criteria.
< ?php } ?>
</>

and add :

} ?>

on the line immediately after.

So, here, we did a “if subscriptions, serve the view.php; else serve the index.php as you normally do otherwise”.

6. Secure your system.
Also taken direct from Carthik.
You need to protect your “FOF” folder on the webserver with a .htaccess and .htpasswd file setup.
I have included a “sample.htaccess” and “sample.htpasswd” file , but you need to create your own .htaccess and .htpasswd to protect this directory so only you can update/delete/modify the feeds etc. A lot of resources are available as to how to password protect a directory in Apache.
Once that is done, lets write some ReWrite rules for friendlier urls. I you don’t have the mod_reqrite module installed on the server, or don’t want to use it, then your subscriptions page can be accessed at

“http://yourblog.com/index.php?subscriptions=1?

To add the rewrite rules, open the .htaccess file in your blog root directory and add the following lines to it :

RewriteRule ^subscriptions(.*) /index.php?subscriptions=1 [QSA]
RewriteRule ^view.php(.*) /index.php?m=000000 [QSA]

The first one makes “http://yourblog.com/subscriptions/” the url for your subscriptions page, and the second one prevents nosy people from accessing the view.php page directly, so you can be sure no one can mess around.

7. Modify the “fof.css” to your own needs.
Wow! You got this far. What to do with the css, that is really upto you, as you know doubt want to get the FOF to intergrate with your blog and the layout you want.
The css file you need to edit is: …/blog/feedonfeeds-0.1.7/fof.css
The major sections are:

.header Includes the headline, feed meta and controls.
.headline The title of the feed item.
.feed The source of the feed item.
.meta Shows when the feed was cached.
.controls The text “flag up to this item”.
.body The summary text of the feed.

I have copied my fof.css file in to an other post you can view FofCssFile here, as you will see I am no css guru I just played until I got somthing that worked for me.

Finally that is it.
I don’t think I forgot anything, let me know how you get on with this.

Next Page »