By vkr11 on
Hi,
Is anyone looking at integrating Linkedin Widgets onto their site? Linked has recently launched linkedin widgets which will display a small "in" logo next to the name of the company. Details are here http://www.linkedin.com/static?key=developers_widget_companyinsider , it is also being used at Crunchbase (from techcrunch) http://www.techcrunch.com/2008/05/23/crunchbase-now-integrated-with-link... .
I have a content type with one of the fields being the name of the company (using cck field). I would like to enable the linkedin widget for this field. What would be the best way to achieve this? Anyone would like to take a stab on creating such a module for a bounty?
Thanks,
Victor
Comments
Looks interesting, I'll take
Looks interesting, I'll take a deeper look at this tonight and see if I can throw together a module for it.
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
Yuriy, Any luck on
Yuriy,
Any luck on this?
Thanks,
Victor
Hi Victor, Sorry, haven't
Hi Victor,
Sorry, haven't had much spare time lately and haven't even gotten started on this. However it does still sound like a small, interesting project to tackle. Maybe sometime in the next couple weeks...
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
I look forward to hearing
I look forward to hearing from you on this. I would wait for this.
Cheers,
Victor
While a linked-in module
While a linked-in module would be interesting, and doesn't look too hard, you can do what you need either
a) within your theming layer
b) in Views theming, if that's how you're displaying the node
That is what I plan to do if
That is what I plan to do if I can't get the module going. However it would be really clean to have a module for this.
Also if I am using garland, any idea on how this could be implemented using the theming layer?
-Victor
You'd need to create+use a
You'd need to create+use a custom theme, or perhaps something like contemplate (module), to fiddle with the theming of particular node types.
Bumbing it up
Anyone hearing anything on this?
- Victor
Search Drupal.org | Lamingo | Tax India
I wrote down some ideas for a
I wrote down some ideas for a module that could do this in a more generic way (i.e. not only for linkedin, but for all "social applications" in a CCK field). Check it out here: http://groups.drupal.org/node/26157
Used views_customfield module
I have a few situations where I wanted to display the LinkedIn icon next to a company name. In my case I wanted it to appear in a company directory listing (see Directory sample below), and in an Event listing (see Event below).
On the surface it would appear to be an easy implementation in Drupal, simply use the rewrite output option on the view for the field. However, even using a Full HTML filter or including the "< script >" as an option it will not work. I believe a security fix was applied and it prevents "< script >" from being used in a rewrite output for the Views.
Background.
I have two content types being used, e.g., company that contains the company name. I have another content type, Event that references company. Events might be shareholder meetings, beer bash, etc., so in the case of Events I might have several events for a company in a view.
In my case I solved the problem using the Views Customfield module. It allowed me to define a field in a view and execute MarkUp or PHP code. Using PHPCode I have access to the many variables. And using Customfield I didn't need to delve into themes/themeing. To obtain the variable names I had access to I used this:
And then built up to the eventual code. I recommend reading this http://drupal.org/node/467190?destination=node%2F467190%3Fmode%3D2%26sor...
The module can be found at http://drupal.org/project/views_customfield
Directory Sample:
This is the simplest implementation. I have a view that filters by the type (company), sorted however. I add a CustomField on the view where I want the icon to appear. In the PHP (Value) box I have this code:
As shown in the documentation for the View CustomField module I have access to the data variable. Using the var_export I can determine variable names. In my case the node_title field contains my company name. I store the title in a variable called company. The spanid variable will contain the command e.g., < span id="IBM" >< /span >. This is output into the HTML. script type is output. Another variable LinkedInCommand is used to assemble the script that is called, e.g., new LinkedIn.CompanyInsiderPop("IBM", "IBM")< /script >. This is output to the HTML.
Why use variable names? I was getting PHP errors if I tried to use the $data->node_title structure inside the LinkedIn command. Probably my error with string handling. But the above code works for me.
Event Sample:
A slightly more complicated example. In this case Event is the primary content type, and it references the Company Name in the company content type (using Relationships). A company might have multiple events and therefore appear several times in the View. If I used a company name as the span id I would have several icons appear in the same place (i.e., first location). So, span id should be unique for each row. An attempt is made to do this by including the node id (nid) as part of the spand id name.
Add a new field of the type CustomField. Chose PHP code. Decide where you want the icon to appear in the table.
The complication? When I use var_export I could not find a variable that had the company name. Only variables that contained the node id of the company. I think this is because the company name is referenced i.e., not in the primary content type. To obtain the name I had to read the database (In a separate message I will ask the developer of the module if this is best approach).
In the code above, first extract the nid of the company entry (NOTE. You will likely have a different variable name than mine!). This is stored in variable $comp_nid. I then read the database to obtain the node entry for this nid and obtain the $result. Using db_fetch I obtain the company name that is stored in the title field in database, and store in variable $comp_name.
The next lines of code assembles the HTML that includes the span id (appending the nid).
I hope this helps someone. The reference to the src has to appear in the < head > of the HTML. How you do this might depend on the theme. Some themes allow the scripts to be specified in the .info file. (see here:
http://drupal.org/node/171205?no_cache=1257871456). Alternatively you may have to modify the page.tpl.php file in the themes directory.
I am not a drupal or php expert. So I suspect there are better ways to do this, but this solved my need for now. Thanks to casey for the CustomField module.
LinkedIn
LinkedIn has an API now: http://developer.linkedin.com