We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Share This Plugin

Development and Programming

Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

Hi,

I use EE since a while and wanted to integrate some syndication links for every post lately. After looking through the plugin list I wasn’t very satisfied with the solutions. Luckely I just stumbled over a post from Alex King who just coded a plugin for WordPress called “Share This”, which I found very helpful. So I just had a look at that code and wrote a plugin for EE, which you can find working here at my personal blog. It’s almost done, but I still have some difficulties with one feature I would like to implement. That’s why there is no download there yet. I would like to to have an email this link feature, but I don’t have a clue how to best integrate that into EE. It would be easy to write just a little helper script that get’s an ajax request and sends the email, but this would be a dirty hack and I would like to have it integrated into EE nicely. So the question is, is this possible with a plugin or do I need to create a extension? Any ideas and thoughts are welcome..

/lars

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

See Tell A Friend. It’s built into EE. =)

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

thanks Lisa, I just forgot about it.. 😉

       
dinalsi's avatar
dinalsi
1 posts
16 years ago
dinalsi's avatar dinalsi

hey this looks cool, are you going to release this?

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff
hey this looks cool, are you going to release this?

yes, after I built the email functionality I will release it within the next few days.

/lars

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

The Plugin is now available here:

Any thoughts and ideas are welcome..

/lars

       
Rob Quigley's avatar
Rob Quigley
236 posts
16 years ago
Rob Quigley's avatar Rob Quigley

I’m intrigued by this but I’ve received an error message when using the entry id

{exp:share_this entry_id="{entry_id}"}

shows me this message when I try to render the page:

MySQL ERROR:

Error Number: 1064

Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}' at line 3

Query: SELECT title FROM `exp_weblog_titles` WHERE entry_id = {entry_id}

When I take out the entry_id from the tag then I do get a link on the page but nothing happens when I click on the link. Here’s a test page that I had:

<html>
<head>
<link href="/css/share_this.css" rel="stylesheet" type="text/css">
</script>
</head>

<body>

{exp:share_this entry_id="{entry_id}"}

</body>

</html>

I double checked that the JS and CSS files were accessible to the page.

EDIT: the forum is filtering out and not displaying the JS file in the above code but I do have that in my actual template.

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

Dear Rob Q,

the share_this tag must be placed within the weblog:entries tag in the templates. So your code should look like this:

<html>
<head>
<link href="/css/share_this.css" rel="stylesheet" type="text/css">
</script>
</head>

<body>
{exp:weblog:entries weblog="" .... }
      
     your other stuff...
     {exp:share_this entry_id="{entry_id}"}

{/exp:weblog:entries}

</body>

</html>

I added this to the documentation and added a warn message to the plugin, if entry_id isn’t set correctly.

/lars

       
Rob Quigley's avatar
Rob Quigley
236 posts
16 years ago
Rob Quigley's avatar Rob Quigley

Hmmm. I updated to the most recent version. It’s giving me this message: The Tag must be included within the ‘{weblog}’ tag - even though I have it now included in the weblog tag.

And when I use the entry id tag I get this message still:

MySQL ERROR:

Error Number: 1054

Description: Unknown column 'field_id_2' in 'field list'

Query: SELECT field_id_2 FROM `exp_weblog_data` WHERE entry_id = 24

This is the EE code for what I had in the template:

</head>

<body>

{exp:weblog:entries weblog="blog" }
      

{exp:share_this entry_id="{entry_id}"}


{/exp:weblog:entries}

</body>

</html>
       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

The entry_id is required. This is why you got the error message even as you put the tag within the weblog:entries tag.

Did you change your input fields? Do you have custom input fields. As I thought the field_id_2 is used for the bodytext of the standard installation. Did you modify this? Other question what is your weblog_data table called? Did you use another prefix for tables?

Is there a global constant for the table prefix that could be used. I had a brief look at the code in the core file , but didn’t found any?

/lars

       
Deon's avatar
Deon
87 posts
16 years ago
Deon's avatar Deon

I cannot get this plugin to work at all. I uploaded the javascript and made sure it is being called properly. I have the stylesheet uploaded and called properly.

This is the code I am using (and it is in a {exp:weblog:entries} tag)

{exp:share_this entry_id="{entry_id}" title="Title"
url="{title_permalink=cdreviews/comments}" orientation="top" bodytext="This is an article about yada yada yada..."}


{/exp:share_this}

I am calling it on a comments page. Is this correct?

When I mouse over the Share This link it disappears. When I finally click it, nothing happens.

Firefox reports this error when clicked on: $ is not defined [Break on this error] var form = $(‘share_this_form’);

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

I’m sorry I forget to include the prototype library. I updated the zip file with the necessary javascript library.

/lars

       
Deon's avatar
Deon
87 posts
16 years ago
Deon's avatar Deon

Thanks, works great now!

       
Deon's avatar
Deon
87 posts
16 years ago
Deon's avatar Deon

Sorry, I spoke too soon. It isn’t working in FireFox for Mac I still get this error:

unterminated string literal void(share_this_show(‘6449’, ‘bottom’, ‘http://…

       
Lars Kirchhoff's avatar
Lars Kirchhoff
58 posts
16 years ago
Lars Kirchhoff's avatar Lars Kirchhoff

What parameters did you use? do you get this error on all pages or articles where it is used? Can you give me a url where I can watch it?

/lars

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.