תשתיות תוכן קהילתיות: ייעוץ ,הדרכה ובניית אתרים ואפליקציות בדרופל

Linnovate provides advanced drupal based solutions for online communities, non-profits and startups. If you have a vision? We will help you translate it to reality.

We are committed to the advancement of innovation and development by the use of free and open-source technologies and we believe in simple and elegant solutions to complex problems.
We believe in the empowerment of our clients, simplifying technology and help integrating it so they can gain independence in the way they use the internet.

Linnovate Blogs

Using FeedAPI's API

FeedAPI is a great module, and easy to use if you want it to parse your RSS/RDF/ATOM feeds into nodes or lightweight items. There are quite a few posts that review that, but developer documentation for using FeedAPI's hook's can still be better. This post will be a walk-through of the code.

For leveraging it's capabilities, FeedAPI gives us two hooks: hook_feedapi_feed for creating a parser, and hook_feedapi_item for creating a processor. If you used FeedAPI before then these concepts are familiar to you- parser-common-syndication and simplepie are examples of parsers implementing these hooks, and feedapi_node and aggregator are examples of parsers.

When you wish to extend FeedAPI using the hooks, It is more likely that you'll want to implement a parser- say if your client wants to get data from a custom XML feed still unsupported by FeedAPI.
So first, let's look at a simplified (removed caching bits) implementation of hook_feedapi_feed, courtesy of parser_common_syndication (PCS for brevity here on forward). I've bolded items you would change:

<?php
function parser_common_syndication_feedapi_feed($op) {
 
$args = func_get_args();
  switch (
$op) {
    case
'type':
      return array(
"XML feed");
    case
'compatible':
      if (!
function_exists('simplexml_load_string')) {
        return
FALSE;
      }
     
$url = $args[1]->url;
     
$downloaded_string = _parser_common_syndication_download($url, $op);
      if (
is_object($downloaded_string)) {
        return
$downloaded_string->type;
      }
      if (!
defined('LIBXML_VERSION') || (version_compare(phpversion(), '5.1.0', '<'))) {
        @
$xml = simplexml_load_string($downloaded_string, NULL);
      }
      else {
        @
$xml = simplexml_load_string($downloaded_string, NULL, LIBXML_NOERROR | LIBXML_NOWARNING);
      }
      if (
_parser_common_syndication_feed_format_detect($xml) != FALSE) {
        return
array_shift(parser_common_syndication_feedapi_feed('type'));
      }
      return
FALSE;
    case
'parse':
     
$feed = is_object($args[1]) ? $args[1] : FALSE;
     
$parsed_feed = _parser_common_syndication_feedapi_parse($feed);
      return
$parsed_feed;
  }
}
?>

The three main changes that you will want to do here are _parser_common_syndication_feed_format_detect, _parser_common_syndication_feedapi_parse, and the hook itself.

FeedAPI calls this hook after it instantiated a $feed object. When the hook is called, it is called with a number of arguments which we map through func_get_args. In the 'compatible' $op, we download the feed and inspect it to make sure that our parser recognizes it. PCS utilizes PHP's simplexml function to parse the feed, therefore the matching function calls. If all is well, we'll call the hook again with the 'type' $op that will return "XML feed". I guess the 'parse' op is self explanatory... here you'll fill in your version of feedapi_parse- let's call it myparser_parse().

so to start implementing your version, you'll use the hook (module_name_feedapi_feed), and change the call to _parser_common_syndication_feedapi_parse to myparser_parse(). You can decide for yourself if you want to implement the feed_detect function or not.

There are a couple of functions involved in the feed creation in PCS, here's a rundown- "_parser_common_syndication_feedapi_parse" (our main parser) calls "_parser_common_syndication_download" (makes some preliminary tests on the data) which calls "_parser_common_syndication_feedapi_get" (checks whether the feed exists in DB and changed from its copy in cache and if not- fetches the feed and checks it). This is all done in order to not waste time on parsing existing items or feed. You don't have to use them or implement your version of them to parse the data, but they make the process more efficient. if PCS is enabled, you can use calls to _parser_common_syndication_download() since they are still valid (this function is a helper function, not necessarily tied to a format!) instead of implementing it yourself. In essence- you can utilize PCS and just change the call to "feedapi_parse" and "feed_format_detect" which we will get to in a minute.
now, take a look at:

<?php
function _myparser_parse($feed) {
  if (
is_a($feed, 'SimpleXMLElement')) {
   
$xml = $feed;
  }
  else {
   
$downloaded_string = _parser_common_syndication_download($feed->url, 'parse');
    if (
$downloaded_string === FALSE || is_object($downloaded_string)) {
      return
$downloaded_string;
    }

    if (!defined('LIBXML_VERSION') || (version_compare(phpversion(), '5.1.0', '<'))) {
      @
$xml = simplexml_load_string($downloaded_string, NULL);
    }
    else {
      @
$xml = simplexml_load_string($downloaded_string, NULL, LIBXML_NOERROR | LIBXML_NOWARNING);
    }

    // We got a malformed XML
   
if ($xml === FALSE || $xml == NULL) {
      return
FALSE;
    }
  }
 
$feed_type = _parser_common_syndication_feed_format_detect($xml);
  if (
$feed_type ==  "atom1.0") {
    return
_parser_common_syndication_atom10_parse($xml);
  }
  if (
$feed_type == "RSS2.0" || $feed_type == "RSS0.91" || $feed_type == "RSS0.92") {
    return
_parser_common_syndication_RSS20_parse($xml);
  }
  if (
$feed_type == "RDF") {
    return
_parser_common_syndication_RDF10_parse($xml);
  }
  return
FALSE;
}
?>

On your implementation of the preliminary parser function (myparser_parse, in this example, please note that this is not a hook!), make sure you load the xml file- that can be done via simplexml_load_string (if you already have the file through PCS_download() or similar method) or simplexml_load_file. SimpleXML will create an object of the xml. Now comes in your implementation of feed recognition. You might use php's simplexml getName to recognize the first tag.

Once recognized, you can accordingly direct the feed to the "real" parser function if you have a number of them, or do the actual organization of data right here. In general, I guess most of the time you'll resort to leaving it like the original only with minor changes. If you look at _parser_common_syndication_feedapi_parse, you'll see that the main part you'll need to change is the calls for appropriate parsers. If you are implementing a call to just one, you can do the processing here as well.

The question is, how to parse the data. Remember that simpleXML created an object, so you'll be able to traverse it with foreach(), or by using PHP's simplexml_element->xpath() .
note that some type casting might be in order here. You can take one of PCS's own parsers as a reference.

another note- If you pass the data to node_processor, and it doesn't recognize either a 'guid' or an 'original_url' field, it will ignore the data. So fill those in.

Well, that's about it! enjoy....
oh, and of course, thanks Aron.

Keywords:

Free Beer! Get your Free Drupalager here!

I'm off to Szeged, carrying an unusual cargo: a dozen bottles of home brewed, 100% open source, Drupalager!

My hope is that the customs, both in Israel and Hungary, will let me pass with this precious lager, and that we can all benefit from it's wonderful taste in Szeged.

See some great photos from our Drupalager party, on the beach, last week.

Click the images below for larger versions:
Keywords:

Drupalager - Open Source beer.

In our effort to grow drupal in the local foss and commercial scene, we decided to spice up one of the bigger opensource conferences in israel - August Penguin.

One of our developers makes a really cool homemade beer and we decided that we should take these two passions (alcohol + drupal) and brew them into one...
So we present you with DRUPALAGER!

Drupalager comes in two flavors - drupalager lite - based on wheat with coriander and orange peels and our darker (which I prefer) one made from barley with burnt caramel in it.

We were the buzz of the crowd bringing several beer bottles and passing them through the crowd at the breaks. Microsoft actually showcased in the event presenting their take regarding open source and we gave their representative a shirt and a beer (that will quiet them up! :) ).

I gave a theming lecture addressing the misunderstanding that drupal looks like garland - it was named "Breaking the three column jail" and although it was a bit too short it was fun and effective.

We truely love drupal and we truely love beer and we hope customs won't give us a hard time passing them in so hopefully Zohar will be able to bring some bottles to Szeged.

We hope to track down all of our heros (dries, earl, eaton etc..) and give em a beer, We also want the drupamao guys to taste the real thing!

Click the images below for larger versions:

It takes three years for a tree to give fruits

Linnovate is not three years old YET. But even so, looking two and a half years back, at all we achieved, brings satisfaction and warms the heart.

We've worked quite hard these past years, and only (or should I say 'already') now, we see the signs of first sprouts, that will hopefully turn into healthy fruits.

In the last few months, the Drupal community in Israel has grown and we see more and more web-professionals, testing and choosing Drupal, as their framework. Many of them come to us for consulting, some choose some of the other Drupal service providers in Israel.

We were (still are) also busy with two big scale projects, which faced us with some hard nuts to crack (with which we dealt quite well). These projects will be released soon and will demonstrate the great powers of the Mighty Drupal, and particularly some wonderful creativity of Flash-Services-JQuery combinations.

As a tree who is not giving fruits in his first years, but still - you water it and take care of it, because you believe it will be fruitful one day (no one really KNOWS if it will ever happen...), so did we at Linnovate.
We always aspired to do a better work, and we enjoy learning, and we enjoy teaching.

Some of finest Drupal people in Israel work with us, and us with them, creating a flourishing Drupal community, very friendly, very supportive. We don't seek competitors, and we gain colleagues, and partners too.

We've succeeded to supply work for quite a few developers over the time, and we hope we can continue with that trend.
Drupal is being seriously recognized in Israel, as a good thing, so we expect this market to grow. Big organizations and enterprises use Drupal for their killer solution, whether it's for Intranet, web application, a "simple" website, and even just as a wonderful back-office system, that propagates content outside (think Flash, think ERP, think embedded!).

We don't have core developers YET, but with time, that will come too. For the moment, we try to send as many good patches as possible... The great team here is composed of fine people, ones with whom it's fun to learn. Linnovate is a good company to grow in, an to work with.

I hope to see Linnovate continuing to be a viable Drupal company, who contributes back to the community, and becoming an important actor in the global community. Our new approaches with Flash and Services will allow us to give our customers another added value, and will enrich our Drupal everyday work!

Is Registration pace to Szeged Drupalcon lower than before?

No!

I had a weird feeling that the registration to Szeged Drupalcon is lower than before.
At the time of writing these lines, we're about 7 weeks away from the conference, and with high expectations, left by the successful Drupalcon in Boston (864 registered and paid attendees), the number of registered attendees to Szeged, is 352.

Having set the high threshold of +1000 attendees, this number seems a bit low.

I wanted to see where registration to Boston was, about the same time before the conference. It appears that actually the registration pace to Szeged is much higher than to both Drupalcons before!

At the end of January 2008, just a month before Boston Drupalcon, Jeff Whatcott announced that ~225 registered to Boston. This puts the registration to Szeged in an even better place, with higher registration, longer before Drupalcon.

But let us not count on statistics. Drupalcon should be marketed more than it is now. You can place some banners in your websites, blog about it, and convince others that Drupalcon is good for them. Propose interesting sessions, and experience the cool registration process.

If the Drupalcon in Szeged will be as good as it's wonderful website, then it will, without doubt, be an amazing event to attend in.

Ever heard: All I wanted was to update my modules - why did my site crash?!

One of our clients mailed me with an urgent problem: His site crashed!

Quoting (bolded made by myself):

The amount of testing we need to do with each update makes it almost impossible to keep updating risk free. We would have to test for so long, that by the time we're done, the next module will be ready. It's just too complex a site with too many contrib modules. Maybe if we had a full time person just on that.

Despite what the "community" says, my tendency is to only update security changes.

Looking at the error message, it took me less than a minute to tell him the writing was on the wall... Well, maybe this is a too obvious case, but let's admin it - maintaining a Drupal site and keeping it up to date, is not always that easy. We all have other things to do, and keeping the site with the latest versions of module X, is not always a top priority.

How should one do, to keep his site safe, and his soul sane?

There's no one good answer, but for most of site owners, who are not full time Drupal developers, here's a bunch of advices:

  • Don't install modules you don't need - stick with the minimum. Every additional module obviously adds some more tasks and maintenance to the overall.
  • Don't update immediately - verify the update contains the fixes you need, and the features you were missing. If there are new features - test them first. Updating only when a security update is available is not necessarily wrong.
  • Read the release messages - they contain valuable information about changes that might affect your website
  • When in doubt - search for more information about the module, and about it's maintainer.
  • When still in doubt - read the module's code, and face it with your suspicions
  • Sometime in the future - let some 3rd party solution, such as Carbon, or Spokes manage the updates for you. Deal with your site's content and strategy, and not with it's platform.
Drupal 5 Modules Chart, By Kent Bye

One other point worth mentioning, is that testing is becoming an integral part of coding for Drupal core, and will hopefully drill down to contrib as well. This will make releases of modules less bugful (or more bugless).

So have no fears! Your platform is mature, and so does it's community. It is not free from bugs and mistakes, but it deals with them properly. Nothing is being swept under the carpet, and the improvements are being proposed and put into action not only for modules, but also for their development and the discussions around them (man, we have 2(!) annual meetings!).

Keywords:

The future is here: Presenting Drupal and FOSS to Computer Science students

While universities usually gain their prestige with break-through researches and discoveries, smaller institutes do so by showing how their graduates integrate in the industry, in key positions.

In order to succeed, they have to:

  1. Identify the dominating technologies of the near future
  2. Teach them to the students, and teach them well

not an easy task...

Last week we participated in a conference about Open Source frameworks in Shenkar, an academic institution for Design and Engineering. Shenkar is a school that is much more industry oriented than the normal universities, and that is what makes this conference so important.

The conference had two parts: the first part presented Open Source in general, and in the second part, Drupal was presented, as an example of a successful, sustainable and profitable open source project.

We were amazed by how little the students knew open source. It seems that Microsoft's technologies are (still) very popular, as there is (still) a big demand for developers in these areas. Why is it (still) like that?

Well, apearantly there are much more .NET developers than PHP developers. This can make hiring them cheaper, and for sure - easier.
Now, this is not something to be overlooked. While open source has the great potential of reducing TCO, when it comes to web, employers are still claiming that there are simply not enough PHP developers, to maintain and develop websites. It's well known that people have a tendancy to work with "something they can trust" (while they really mean - "someone we can blame"...). Plus, many developers feel much more comfortable in a known, common environment, well inside the mainstream.

What can we do to change the situation?

Educate, qualify and certify students to work with Drupal

One of the wonderful outcomes of the conference we participated in, was the acknowledgement that PHP, and Drupal, have a place in academic institutes, as a tool - something the students aquire, and out of which they can start make their living, soon after graduating.
This should (and will) be done in two parallel ways:

  1. Continue the joint development of Drupal courseware, and get it into curicullums of academic institutes for Computer Sciences and Design (I'd say design schools are even a better taget audience)
  2. Help students do their graduating projects with Drupal (something like local Google SOCs)

Creating a communication pipeline between the Drupal industry and classic Training facilities (AKA universities, colleges and design schools) is a key point.

Make Drupal a mainstream solution

Mainstream does not necessarily mean mediocracy. Mainstream is, after all, just a state of mind of many people.
With more and more sites, using Drupal for it's basic content management capabilities, and not only for it's amazing capability of expanssion and innovation, Drupal is gaining more and more recognition, as a swiss army knife solution, which can be used for simple tasks as well (yes - Drupal CAN be used for a blog! 1 2 3 4 5).
In the past, I used to tell people with simple demands, to choose another solution. As I know Drupal today, I can't see why I'd recommend such a thing again. Well... maybe there are things Drupal (still) can't do.
The question is - Do we want mainstream developers doing mainstream sites with Drupal? YES. More Drupal developers mean more Drupal clients, which mean more money. More money leads to more developers, and there you go.

Keywords:

Creating the Drupal work and business markets in a country

Two years ago, we founded Linnovate.net, the first Drupal shop is Israel (a small, unknown province of the Middle-East). Linnovate chose Drupal as it's almost unique tool of work, as we've recognized that a business can be built upon this wonderful CMS.
Being one the firsts to identify Drupal in Israel, and the first to actually use it as a strategy of a company, we've grown to be the biggest, and the most knowledgeable Drupal shop in Israel.
But, being so open-source freaks, we knew that in order to have a bigger share of the market, we'd better enlarge it, and not just maintain our position in it. We then decided to create the Drupal market in Israel.

First thing we did was to set up The Israeli Drupal community (though we're not it's owners) which was very successful in getting more and more people to know about Drupal, and allowed people to ask questions. We also launched a new website in Drupal, for a students association. The inauguration of the site well celebrated with a big party, which was good for public relations. It was the first time we saw people (~200) actually standing and cheering a website :-)
The next thing we did was to establish a training program for Drupal (also see in groups.drupal.org), with the understanding that in order to expand the market, we need to have more service providers. We never feared competition, and in some way we can also say that we created it, and encouraged it. This is a truly open source business approach.

Since then, the Drupal service providers list has grown from 1 to 12, most of them from the last 6 months: some of them have worked for us, some of them still do, some have made their first steps with us, and have now opened their own businesses. They are now our potential competitors, but we are still happy to see that we have succeeded in our first mission - to create a Drupal market in a country!


(pardon my partner who kept the ad in his back pocket for the whole weekend...)

Now, this post could have been written without any special event. However, I'm happy that there is one:
On the weekend edition of the biggest newspaper in Israel, which is read by almost half of the country's population, there was a job ad, of Bar-Ilan University (one of the biggest in Israel), looking for a (not-freelance) Drupal developer. This was probably the first time Drupal is entering the prime-time bulletin (and not only in dedicates sites and forums).
If you only look at numbers, this won't impress you too much, since Israel has less habitants than NYC, but this is not obvious for us as it may be for some of you, living in Belgium or the U.S.
We made Drupal hit a much larger public, and I'm proud at doing that.

Keywords:

What's in a name (Drupal Trademark awareness)

Towards the last drupalcon we at linnovate decided to create a new brand for our international activity: drupal.fm.
We wanted something that would be catchy and when we suddenly discovered a domain that was free which had drupal in it and with a whole marketing theme built in...
"Welcome to drupal.fm - You station for drupal", "Tune In" etc..
I felt really lucky to have found such a great domain and printed new business cards with my green linnovate tree and "drupal blue" leafs...
But as I was talking to different people in drupalcon (noticeably Robert Scales, Gabor, Michael Meyers, Gregles and ... Dries) they all pointed out that drupal association and dries might have a problem with us using the trademark for commercial use.
From that point I understood that drupal.fm might live on as something else but it will not be the name of our commercial essence.
So...
Even if you're a technical geek and never quite connected to the whole copyright (or left) thing.
Think again before you start brand yourself using drupal in the name...
Checkout similar dynamics here...
http://drupal.org/node/217731#comment-716909
So there goes 300 business cards (but hey I like my green linnovate tree better).

Keywords:

Theming blocks by type, not by region or by module name

Often we need to theme blocks by type (for example blue block, red block, green block), regardless of their position (e.g. their region) or the module supplying them (e.g. module & delta).
Phptemplate lets you theme a block using a template file (hereafter mentioned as simply "tpl"), following a defined naming convention. When theming a block, phptemplate will look for the right tpl in the theme directory. The possible names are nicely described in the handbook.

But what if we want to theme few blocks in the same manner and those blocks have nothing in common? They don't reside in the same region, they are not supplied by the same module, and they shouldn't have the same structure as the default block.
The only out-of-the-box solution I'm aware of, is to have a dedicated tpl for each of these blocks, which is a copy of the rest of the special blocks.
This solution however, is out of the question.

So how do you group blocks which have nothing in common, except for the need to theme them all in the same way?

Symlinks

The fastest solution is to create the needed tpl, and then link to it with symbolic links, which have the same names a for a dedicated tpl. For example, if we wanted to theme the RSS block, and the "who's online" block in the same way, we'd create the necessary tpl:
green-block.tpl.php and then link to it with two symbolic links:
block-node-0.tpl.php and
block-user-3.tpl.php
Both blocks will get the theme of green-block.tpl.php

This method is easy to maintain - you just symlink files together, and you get the right design.

_phptemplate_variables

_phptemplate_variables is a function which lets us add or modify variables which become available for our tpl files. We usually use this function in template.php.
We can use it to add a template file, which will be added to the list of suggestions, when phptemplate is looking for the right tpl:

<?php
 
if ($hook == 'block') {
   
$identifier = $vars['block']->module . '-' . $vars['block']->delta;
    switch (
$identifier) {
      case
'node-0':
      case
'user-3':
       
$vars['template_file'] = 'green-block';
        break;
    }
    return
$vars;
  }
?>

This way opens the road for programatically assign tpl files to non related blocks.

... Are there any other evident methods I am not aware of?

Keywords:
Drupal association member logo

Introducing Linnovate

A brief overview about Linnovate spcialities and drupal connection.
Contact us to learn more...


Read this document on Scribd: linnovate-overview

מתיק העבודות

דרופל ישראל

באפריל 2006 הקמנו את דרופל ישראל כמיזם משותף עם אמנון לבב.
דרופל ישראל הפך לכתובת המרכזית לדיון, קבלת עזרה ושירותים מטובי מומחי הדרופל בארץ.
האתר מחזיק פורומים פעילים במגוון נושאים הקשורים לדרופל ויש לו כ500 חברים רשומים.