Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aaron Paxson
Adding a new social network bookmark in 6.1 - not working
February 11, 2012 6:43 PM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

I'm loving the social bookmarks in 6.1. I had to strip out my current hooks that did them, to allow Liferay to do it. I'm trying to add another social bookmark, LinkedIn, but it doesn't look like it's loading. I don't see any messages in the log, so I'm not sure what I'm doing wrong. Can someone give me some pointers?

I added the following to html/taglib/ui/social_bookmark:

 1
 2linkedin.jsp
 3
 4<%@ include file="/html/taglib/ui/social_bookmark/init.jsp" %>
 5
 6<%
 7String linkedInDisplayStyle = displayStyle;
 8
 9if (displayStyle.equals("simple")) {
10    linkedInDisplayStyle = "none";
11}
12if (displayStyle.equals("vertical")) {
13    linkedInDisplayStyle = "top";
14}
15if (displayStyle.equals("horizontal")) {
16    linkedInDisplayStyle = "right";
17}   
18%>
19
20<script src="http://platform.linkedin.com/in.js" type="text/javascript">
21<div class="linkedin-button"> <script type="IN/Share" data-url="<%= url %>" data-counter="<%= linkedInDisplayStyle %>"><liferay-ui:message key="Share on LinkedIn" /></div>


I then added the following to my portal-ext.properties file:

 1
 2#
 3# Social Bookmarks to identify and display when enabled
 4#
 5social.bookmark.jsp[facebook]=/html/taglib/ui/social_bookmark/facebook.jsp
 6social.bookmark.jsp[plusone]=/html/taglib/ui/social_bookmark/plusone.jsp
 7social.bookmark.jsp[twitter]=/html/taglib/ui/social_bookmark/twitter.jsp
 8social.bookmark.jsp[linkedin]=/html/taglib/ui/social_bookmark/linkedin.jsp
 9
10social.bookmark.types=facebook,plusone,twitter,linkedin
James Falkner
RE: Adding a new social network bookmark in 6.1 - not working
February 11, 2012 7:43 PM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1222

Join Date: September 17, 2010

Recent Posts

Aaron Paxson:
I'm loving the social bookmarks in 6.1. I had to strip out my current hooks that did them, to allow Liferay to do it. I'm trying to add another social bookmark, LinkedIn, but it doesn't look like it's loading. I don't see any messages in the log, so I'm not sure what I'm doing wrong. Can someone give me some pointers?


I think your jsp has some issues - you placed a <div> and some text inside a <script> tag which confuses the liferay script minifier. This code worked for me:
 1
 2<%@ include file="/html/taglib/ui/social_bookmark/init.jsp" %>
 3
 4<%
 5String linkedInDisplayStyle = displayStyle;
 6
 7if (displayStyle.equals("simple")) {
 8    linkedInDisplayStyle = "none";
 9}
10if (displayStyle.equals("vertical")) {
11    linkedInDisplayStyle = "top";
12}
13if (displayStyle.equals("horizontal")) {
14    linkedInDisplayStyle = "right";
15}   
16%>
17
18<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
19<script type="in/share" data-url="<%= url %>" data-counter="<%= linkedInDisplayStyle %>"></script>


Also, if you're interested in other social bookmarks, check out the social-bookmarks-hook plugin which has a bunch of other plugins for linkedin, reddit, evernote, slashdot, stumbleupon, buzz (is that even a thing now?), digg, and more. Also, you may be interested in comparing the linkedin code therein with your code. Usage of the <liferay-util:html-bottom> may get you better render performance.
Aaron Paxson
RE: Adding a new social network bookmark in 6.1 - not working
February 11, 2012 8:10 PM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

James Falkner:

I think your jsp has some issues - you placed a <div> and some text inside a <script> tag which confuses the liferay script minifier. This code worked for me:
1
2<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
3<script type="in/share" data-url="<%= url %>" data-counter="<%= linkedInDisplayStyle %>"></script>



Odd, I simplified the script tags as you have it, and it is still not loading after a restart.

James Falkner:

Also, if you're interested in other social bookmarks, check out the social-bookmarks-hook plugin


Thanks, I'll take a look at it!
James Falkner
RE: Adding a new social network bookmark in 6.1 - not working
February 11, 2012 8:16 PM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1222

Join Date: September 17, 2010

Recent Posts

Aaron Paxson:
James Falkner:

I think your jsp has some issues - you placed a <div> and some text inside a <script> tag which confuses the liferay script minifier. This code worked for me:
1
2<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
3<script type="in/share" data-url="<%= url %>" data-counter="<%= linkedInDisplayStyle %>"></script>



Odd, I simplified the script tags as you have it, and it is still not loading after a restart.

Weird. I just tested it using the blogs portlet, attached is the image I see. Also attached the Asset Publisher results.
Attachment

Attachment

Attachments: Screen Shot 2012-02-11 at 11.14.12 PM.png (27.0k), Screen Shot 2012-02-11 at 11.15.40 PM.png (14.0k)
Aaron Paxson
RE: Adding a new social network bookmark in 6.1 - not working
February 12, 2012 9:11 AM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

I've got it working now. The problem was that Liferay was loading /root/portal-ext.properties and not under WEB-INF/classes. VERY WIERD! No idea how that happened.

I used the social-bookmark-plugin code, and it works great! Very easy to add more. I don't like some of the CSS spacing between them, and will have to tweak that, but the functionality is a much needed feature! Thanks!
Attachment

Attachments: Screen Shot 2012-02-12 at 10.49.48 AM.png (20.8k)
James Falkner
RE: Adding a new social network bookmark in 6.1 - not working
February 12, 2012 4:32 PM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1222

Join Date: September 17, 2010

Recent Posts

Aaron Paxson:
I've got it working now. The problem was that Liferay was loading /root/portal-ext.properties and not under WEB-INF/classes. VERY WIERD! No idea how that happened.

I used the social-bookmark-plugin code, and it works great! Very easy to add more. I don't like some of the CSS spacing between them, and will have to tweak that, but the functionality is a much needed feature! Thanks!


You're welcome, glad you figured it out! I guess I should have thought it odd that you had no errors -- when I tried your code, I got a HUGE amount of error output from the minimizer (when it encountered the text that you had between a <script> and </script> in your original code). With no errors, that surely would make me think that your portal-ext.properties was not being loaded. /root is the default home directory for the root user on some Unix-based OS's, and yeah, we look in $HOME. But we should also have found the one under WEB-INF/classes. You can see which properties file Liferay is loading by inspecting the log file. BTW, the suggested location for your portal-ext.properties is the "Liferay Home" directory, which is one directory above your app server directory. This avoids it disappearing when you re-deploy Liferay.