Showing posts with label Classic FTP Blogger. Show all posts
Showing posts with label Classic FTP Blogger. Show all posts

Friday, June 8, 2007

New Custom Search Engine for Blogspot Hacks, Tips & Templates

I am announcing a custom Blogspot Search Engine designed to provide you with the most relevant results for Blogspot tips, hacks, templates, tutorials and much more. The Search Engine folds the contents of 30+ popular hack and template sites in with natural Google results. The outcome produces one of the easiest methods for finding the answers that you need quickly.

Refinement labels are added to drill down into a variety of topics or site types. Pick the results that you want to see, without all of that fluff in the middle.

Try these example queries which are popular in forums and groups right now:

Help me refine this Search Engine by leaving constructive criticism in the comments below. I will entertain any suggestion.

Are you a Blogspot tip, tutorial or template site? Chances are you may already be included in this Search Engine already. If you feel that you are not, leave your sitename and Url below and I will check into it and add if appropriate.

I will add sites that only partially deal with Blogspot as well. If you have something to offer, holler away below.



Technorati Tags: , , , , , , ,

Thursday, June 7, 2007

Clarification of NoFollow Hacks on this blog

A recent discussion in the No To Nofollow community at Bumpzee raised concerns over the hacks presented here on this blog. I hope that this post will clear some of air on what the hacks are capable of -- and what they are not.

1. There are no hacks to effectively remove Nofollow from Classic Blogger templates that are hosted at Blogspot. And there never will be, it is impossible.

2. The hack for removing Nofollow on the newer Blogger Layouts (XML) only affects the commenting Author's link. Nofollow cannot be removed from the body of the comment. There are no hacks that can effectively remove it, nor will there ever be.

3. The hack for Classic FTP (self-hosted)Blogger templates require PHP. The hack removes Nofollow from both the commenting Author's link and any link present in the body of the comment. That hack was first published here

There is also an update in regards to the FTP hack. It has come to my attention that
anyone using a double-quote within the comment will break the code. This is due to
the fact that I captured Blogger's CommentBody variable with double-quotes. The
Author's link is not affected and functions as written.

The portion of the code for stripping Nofollow from the comment body needs to be
revised back to it's original form for the time being. I am working on a fix and will
post it as soon as I can.



[rant]The policy of Blogger to force Nofollow onto it's users and make them jump through hoops to install hacks like this is ludicrous. That also goes for other Blogging Platforms as well.

Numerous hacks and plugins have been written, some so shoddily that they confused even me. It simply amazes me how much time has been wasted on just this one facet of blogging. Then there are the evil-doers who want to make a buck off of it (but I am not going there)

Blogger needs to revise it's policy and allow for a new setting in the Dashboard to allow us to choose for ourselves. They can have it set to Nofollow as a default if they wish. Just give us the choice.[/rant]

Sunday, June 3, 2007

Remove NoFollow from Classic FTP Blogger



Blogger Style:



Working with:





Blogger by default, and other blogging software such as WordPress, automatically adds the "nofollow" microformat extension to all links from user generated content. User generated content is defined as comments or external sources such as linkbacks and trackbacks.

I follow, do follow, no nofollowI support the people of the blogging community who have chosen to remove NoFollow for blog comments and linkbacks/trackbacks. If you are reading this right now, you too are probably thinking about joining us yourself. It would be a good move, read on to find out why.

If you are using the New Blogger Layout style on Blogspot, then you will need to use the Remove Nofollow from Blogger Layouts tutorial instead. This tutorial is for Classic FTP Blogger pages only.

Before We Begin


This removal procedure applies to the Classic FTP Blogger only. It is impossible, at this time, to remove NoFollow from Classic Blogger templates that are hosted at Blogspot. This is due to the fact that those templates use the variable <$BlogCommentAuthor$> which encapsulates the anchor link around linking text. Outside of petitioning Blogger to allow us the option for using "NoFollow", there is nothing that can be done.

This article also assumes that you have enabled your Html pages to process PHP script. If you have not done so already, visit the Parsing Html as PHP article before proceeding.

Nofollow Removal Process


The process to remove NoFollow is two-pronged and involves working with your template at Blogger and FTP access to upload a small PHP script.

We will first create an includable PHP script and FTP that to your server. The PHP script will do the actual work of stripping the rel="nofollow" attribute from your links.

In order for your the script to be processed, we will be revising your template to insert a few PHP directives. Also, we will isolate the portion of your code where the <$BlogCommentAuthor$> variable appears in your comments area and capture that variable into one that is recognizable by PHP.

Let's get started.

Creating the PHP Script to Remove NoFollow


I created an includable PHP file named pfblogger_functions.php. Inside of this file is a function named strip_nofollow(). There is another function in the file and more will be added as time progresses. All you need to concern yourself with is just the one function for right now.

Open up the blogger functions script in your browser. Using your favorite Html editor or Notepad, create a new file. Copy and paste the text from your browser screen into the new file, and save it with a name of pfblogger_functions.php

Upload the new PHP file via FTP to your server. I suggest uploading it into your "includes" directory if you have one. If not, then create a new directory on your server with the name of "includes". It keeps things neater this way.

Now that you have your PHP file installed, let's get on to the fun part!

Hacking PHP into your Blogger template


This portion of the tutorial may look a little daunting, but it really isn't. Just take your time and doublecheck your work.

Warning: Before beginning this procedure -- backup your template.

Navigate through your Blogger dashboard to Template > Edit Html

At the very beginning of your template, insert the following code:

<?php 

define('IN_PFBLOGGER', true);

<MainPage>
$site_rootpath = "../";
</MainPage>

<ArchivePage>
$site_rootpath = "../../";
</ArchivePage>

<ItemPage>
$site_rootpath = "../../../";
</ItemPage>

include ( $site_rootpath . "includes/pfblogger_functions.php" );

?>

Everything between the <$php ... $> markers will be run through the PHP interpreter on your server. The define statement at the beginning is for hacking security.

The rest of the code uses Blogger Conditional Tags to establish the actual path to your domain root and stores that in a variable. That variable is used with the path to your include file. If the your path to the function file is different, revise this portion of the code accordingly.

We have now properly included our function file, now let's proceed to the good part.

With your template do the following:
Find:
<$BlogCommentAuthor$>

and replace with:
<?php strip_nofollow( '<$BlogCommentAuthor$>' ) ?>

Find:
<$BlogCommentBody$>

and replace with:
<?php strip_nofollow( "<$BlogCommentBody$>" ) ?>



UPDATE: The code that acted on the comment body worked fine until somebody used a 'double quote' in their comment. This was due to the fact that I enclosed the variable <$BlogCommentBody$> with double quotes and it broke the code. I am working on a fix. If you have installed this hack, then revert this portion of the code back the way it was.

Save Template Changes, but do not replish just yet. We want to test that everything went as planned first.

Navigate to Posting > Create and enter a Test Post. Publish the post and view your blog in your browser.

Enter a comment for the post. Go back to view the post and verify that your Comment Author link is now free of the NoFollow attribute. You can verify this by several means -- one is View > Page Source from your browser menu. If you are using Firefox, there are extensions and other menu options for viewing/identifying links that have Nofollow attributes.

One last step


In order for this change to have any effect, you will have to republish your entire blog. This will rewrite all of the Main, Item and Archive pages with your new code. If your blog is large, a few hundred posts or more, this could take quite a while to process.

If you choose to delay republishing, any new comments made to your posts (existing posts included) will have the NoFollow removed from now on.


Optional NoFollow Recommendations


Now that you are a card carrying member of the Anti-NoFollow community, would you like to hook up with other blogs that share this belief? Then join us over at BUMPzee in the No Nofollow I Follow | DoFollow community.

This NoFollow community is headed up by Andy Beard and is growing everyday. The response has been phenomenol. With hundreds of participating blogs, odds are you will link up with many blogs who share in your particular interests.

Wednesday, May 23, 2007

Processing Classic FTP Blogger pages as PHP



Applies to:
Working with:



As already mentioned, this applies to Blogger owners who publish their pages via FTP to their own website. If your pages are hosted at Blogspot.com for any flavor of Blogger, this will not work.

Why process Html pages as PHP?


PHP is a scripting language that will allow you to do many amazing things to your page that is not possible with standard Html. For example, you could modularize your pages into sections (header, footer, sidebar, etc.) and then instruct the server to include them into your page at the appropriate place.

The advantage of this is that you can make changes to your "localized include file" without having to republish your entire blog. This is known also as server-side includes.

Blogger variable capturing


Another practical use is that you can take a Blogger template variable and output it in a different fashion. Take the following line of Template code and see how Blogger outputs it:

This Blogger template variable:

<$BlogCommentAuthor$>

Gets published as:

<a href="http://webstractions.blogspot.com" rel="nofollow">Ronnie T. Dodger</a>


As you can see, the template variable is translated into a piece of Html code and then published via FTP to your blog page. You have no control over the formatting of the variable. It is, what it is.

With PHP we can capture that variable, perform a pre-written function on it and output it in a different way. Take this code snippet for example:

Our template code:

<?php remove_nofollow( "<$BlogCommentAuthor$>" ) ?>

Gets published as:

<?php remove_nofollow( "<a href="http://webstractions.blogspot.com"
rel="nofollow">Ronnie T. Dodger</a>" ) ?>


And our pre-written PHP function remove_nofollow outputs:

<a href="http://webstractions.blogspot.com" >Ronnie T. Dodger</a>



The basic premise here is that you revise the Blogger template with a line of PHP script that will capture the Blogger variable <$BlogCommentAuthor$>. Once published, the stage is set. When a user (or yourself) views the page, our pre-written PHP function remove_nofollow() will get called by the PHP interpreter and strip the rel="nofollow" from that line of code.

You will notice that our scripts are enclosed inside of <?php   ?> tags. This is what instructs your server to interpret everything between them as PHP script. More on that later. I just want to call your attention to it.

Server-side Includes


There are other things you can do with PHP. I mentioned earlier about server-side include files for your header, sidebar and footer. As an example, you can "cut" the code from your footer area to the end of the page in the template, "paste" it into a seperate file on your server and replace all of that inside your template with one line of code:

<?php include "footer.php"; ?>

Publishing with Blogger is wasteful. The way it is set up, we send the same chunks of code over and over again. By setting up server-side include files and using PHP to insert those chunks, we eliminate that waste. This will save on republishing time and bandwidth.

Another advantage is that you can edit the include file with your favorite software and have no need to republish your entire blog. Insert links into your blogroll, more footer information, maybe add some css coding, etc. As soon as you save your file -- the effects are live and for every page on your site.

Sounds kewl eh?

Processing .html pages as PHP


Your server will not process PHP script inside of web pages with the .html extension. Pages with a .php extension, however, instructs the server to pass the file through the PHP interpreter first. The interpreter acts on the script and returns the output back to the server for normal Html delivery.

The .htaccess File


Fortunately there is directive to instruct the server to process .html files as PHP script, via a file named .htaccess which will hold the instruction.

Copy the following code into a new Notepad file:

AddType application/x-httpd-php .html .htm

Save the file to your computer with the filename .htaccess (note that filename begins with a period). Upload that file via FTP into the directory where your Blogger main page is located. Your blog directory may be at the root domain or in a sub-directory named /blog or something else. You were the one that set it up, so you tell me.

This file will tell the server that from this directory, and every directory below it (sub-directories), whenever it encounters a file with the .html or .htm extension -- then pass it through the PHP interpreter first.

Testing your .htaccess installation


We are going to revise the template to include a short snippet of PHP script to test that everything is hunky-dorey.
Navigate to Dashboard > Template > Edit Html

Copy and Paste, exactly, the following code at the bottom of the template right before the </body> tag. I chose this place because some of you may have some wacky CSS that repositions your page over things (like Blogger navbars and such). Hopefully this part of the page is okay to see if the test works.

<?php echo "PHP is fun!!!"; ?>

Save your template and republish your Index only

If all went well, you should see the words PHP is fun!!! at the bottom of your page. If so, go back to your template and remove that line of code and republish your Index only.

If you do not see the words, drop me a comment and we will figure it out.

What do we do now?


In upcoming articles, we will be removing the NoFollow tag from comments, flipping Page Titles around (topic first, then blogname ... good for SEO), creating easier to edit blogroll blocks, blocks for labels (oh joy), and maybe a widget or two.

Stay tuned, more coming soon!!