Adding HTML to Page

Topics: Controls
Oct 26, 2011 at 4:57 PM

I wish to add the following "AddThis" script to each "Page":

How is that done?

 

<!-- AddThis Button BEGIN --><div class="addthis_toolbox addthis_default_style addthis_32x32_style"><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a></div><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=XXXXXXXX"></script><!-- AddThis Button END --> 

Oct 26, 2011 at 6:28 PM

Its better to just install the extension:

http://dnbegallery.org/cms/List/Extensions/AddThis

It gives you lots of options for format and tracking  too.

The code is also not "Hard" coded meaning its very easy to change if you need to.

 

Have a Good Day,

Brian Davis


Java Blog

Jan 2, 2012 at 3:12 PM
Edited Jan 2, 2012 at 3:31 PM

Sorry, but this extension is garbage. What Ian needs is clean insertion of AddThis code given by AddThis website. So the question is - how to modify the PostView.ascx without minification script freaking out and trying to download the script from the Scripts  directory.

Taking into account that ASP.NET has it's own minification now, this feature of BlogEngine is definitely dead-born and should be removed in favor of ASP.NET native one. IMHO, of course.

Now, answering the question of Ian:

You need to go to themes directory, and choose the directory with the name of your theme. Then, find the file named PostView.ascx. If you want the AddThis button to appear above the post text, add the script inside the <div class="text"> tag.

Now, you need to go to the settings of your blog and in Settings \ Advanced check the "Allow remote file downloads". That way the JavaScript handler won't look for addthis_widget.js in your Scripts directory.