As you may have read we migrated this blog to a wordpress one. Yeahyeah, we are not officially wordpressified.
If i was not convinced wordpress is a serious project with a great future, i wouldn’t have chosen it, so let’s not start the “code quality” discussion.
Getting the information of a tag, author of category is very easy. There are some built in functions like get_category, and get_category_feed_link that will give you this information. The downside is, this information is basically only available inside “the loop“.
Then I created a custom method that returns the most related feed based on the page request. The method will check what type of page the visitor is accessing (category, tag, author or main page) and return the appropriate rss feed.
Enjoy
My impression of the core
The default wordpress core holds alot of use’eable functions, but it took me a while to figure out how the thing worked. You need to know that wordpress is not really written very object oriented, so basically its a collection of functions although some “under the hood” core functionality is object oriented.If i was not convinced wordpress is a serious project with a great future, i wouldn’t have chosen it, so let’s not start the “code quality” discussion.
The problem
Something i was missing after the default drupal installation was an easy way to retrieve the related rss feed based on the page the visitor was accessing. If a visitor was on the “all posts by author X” page, the linked rss feed should only hold those posts. Same for category pages and tag pages.Getting the information of a tag, author of category is very easy. There are some built in functions like get_category, and get_category_feed_link that will give you this information. The downside is, this information is basically only available inside “the loop“.
The solution
To get the information about the selected category, author or tag i had to jump a few hoops. It’s a combination of core functions and some minor custom code where i had to retrieve the current tag from the queried variables.Then I created a custom method that returns the most related feed based on the page request. The method will check what type of page the visitor is accessing (category, tag, author or main page) and return the appropriate rss feed.
/** * This method will give you the most related rss feed based on the current page request * * @param $type * @return string (feed url) */ function get_feed_url($type = "rss2_url") { if (is_category()) { $current = get_the_category(); $current = $current[0]->cat_ID; return $url_rss = get_category_feed_link($current,$type); } if (is_author()) { $current = get_query_var('author_name'); $current = get_userdatabylogin($current); $current = $current->ID; return get_author_feed_link($current,$type); } if (is_tag()) { $current = get_query_var('tag'); $formaturl = "/feed/"; switch ($type) { case "rss_url": $formaturl = "/rss/"; break; case "atom_url": $formaturl = "/atom/"; break; } return get_bloginfo("url") . "/tag/" . $current . $formaturl; } return get_bloginfo($type); }
Examples
get_feed_url("rss2_url"); // on page /blog/ //returns : http://www.digitalbase.eu/blog/feed/ get_feed_url("atom_url"); // on page /blog/category/digitalbase/ //returns : http://www.digitalbase.eu/blog/category/digitalbase/feed/atom_url/ get_feed_url("rss_url"); // on page /blog/tag/symfony //returns : http://www.digitalbase.eu/blog/tag/symfony/rss/
Dec
5
Installing Eclipse + Latest Php Development Tools (PDT 2.0)
Posted by Gijs Nelissen in Programming
Following up on my previous post on “installing 3.4 + PDT 2.x” i wanted to let you know there is a much easier way. As we are coming close to a stable version of pdt 2.x (launch on 29th of December) :
2.0 M1 – November 03
2.0 M2 – November 24
2.0 RC1 – December 08
2.0 RC2 – December 14
2.0 RC3 – December 23
2.0 Release – December 29
The PDT core team decided to setup an “update site” so you can easily fetch the latest version from within eclipse.
A list of the ones you need to add :


Expand the DLTK site and select the Dynamic Languages Toolkit – Core Frameworks or Dynamic Languages Toolkit – Core Frameworks SDK Feature.
Then check the PDT SDK feature (PDT SDK 2.0.0 ….). Click install & restart eclipse.
Installation
Getting & Running Eclipse
Get the latest version of Eclipse from the download site. I went for “Eclipse Classic 3.4.1 (151 MB)“. Extract it and double eclipse the eclipse executable.Adding the PDT 2.x
When you selected a workspace and fired up eclipse add the different update sites (Help > Software Updates… > Available Software > Manage Sites)A list of the ones you need to add :
- download.eclipse.org/technology/dltk/updates-dev/1.0/ DLTK 1.0
- download.eclipse.org/tools/pdt/updates/2.0/interim/ : PDT 2.0 updates


Expand the DLTK site and select the Dynamic Languages Toolkit – Core Frameworks or Dynamic Languages Toolkit – Core Frameworks SDK Feature.
Then check the PDT SDK feature (PDT SDK 2.0.0 ….). Click install & restart eclipse.

No comments:
Post a Comment