Fivestar half star ratings

This is my attempt in making the drupal fivestar module use half star ratings.

At first I tried using the default star set to do this but the stars were 15px wide leaving a 1px shortage on either the left or right side which made it look weird. Because of this I decided to use the oxygen star set that comes with the fivestar module to which left it looking very nice and because it is 16px wide it can be split 8px on the left and 8px on the right.

Regenerate aliases for pathauto module in drupal

Here is another tidbit that I learned today. I setup pathauto to point all of my nodes to http://site/content/title but I wanted to remove the content from the nodes to leave it at just http://site/title

Here are the steps I made to do this
1. Administer->URL Aliases
2. Select tab Delete Aliases
3. Check the content checkbox. Thus removing all aliases for content types and click the Delete aliases now.

Google adsense in drupal 6

After installing drupal 6.4 I was trying to add a block of google ads into my page. The default filters however do not let you add javascript code. To get google adsense to work you must:

1. Goto administrator->site configuration->input formats
2. Create a new input format and do not select any filters.

Then just go and create your new ad block and select your new filter.

Yahoo user interface - Add drag/drop behavior to YUI tree

My mission was to create a tree where nodes can be dragged and dropped from branch to branch.

This is based off of code from sonjayatandon.com which you can find here

I was surprised to find out the the yui library didn't have this by default because most features I have needed was already done for me. I need this for a clients project that I was working on.

Finding a web host- MMHosting Review

My recent quest was to find a web host for a variety of projects that I plan on doing. I am going to talk about the results of my findings and what I ended up going with.

So first my requirements:
1. I need to be able to host a number of domains possibly up to 30. (I plan on doing websites for a variety of businesses and hosting them.)

2. I need to be able to have an equal number of databases or possibly even more for testing or other purposes.

3. I wanted to have a variety of software already available for install with easy setup.

PHP-Coalesce

This little function has proven very useful to me. If you are familiar with the SQL coalesce function you would know that it takes the first non null argument. This can be useful for variable setting and such.

The javascript interpretation would be
var myVar = var1 || var2 || '0';

Which would take the first non null variable. And if var1 and var2 are both null it sets it to 0. Well I need this same functionality in php multiple times and I found a little function which does it very well.

Create Rss feed with all posts from site

I had a problem where I wanted the main syndicate link to provide all content that had been published to this site however the syndicate only lists items that has been published to the front page.

So after a little research I went into the node module and found the node_feed function and found this query.

$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));

Install drupal in a subfolder

Drupal in a subdirectory:

I have recently installed drupal but I wanted an easy way to switch from drupal5 to drupal6 with a clean install so the only way I could think of is installing drupal in a subfolder and having it show up as the root folder.

The first thing to do was to install drupal into a folder called drupal5.
After that I needed to create a new .htaccess file in my root folder to direct everything into my new subfolder.

Here is an example file:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^$ drupal5/index.php [L]

Powered by Drupal, an open source content management system