ADBLOCK_MSG
Social Media Buttons in Joomla 2.5Published: Tuesday, 30 April 2013 22:37 Written by Ogri Hits: 32812
Social Media Buttons in Joomla 2.5
Where to embed?
Different types of button bars
Share42 horizontal panel
Share42 floating vertical panel
Selective placement
As I promised in one of articles from series "Migrating from Joomla 1.5 to Joomla 2.5", I will elaborate on integration of social networks share buttons to Joomla 2.5 website.
Social bookmarking plugin I have used in Joomla 1.5 has not been upgraded by its author to 2.5. At that time, existing Joomla extensions had not satisfied as a solution, to the same - where is the guarantee that their authors would promptly update them? So my choice is to work a little by hands to implant buttons into template. There has been found a sufficient number of varieties of social buttons, but they will be described in the next article. Here will be explained, where exactly their scripts are being embedded.
Standard variant is - to insert buttons panel to an article body before or after its content. In the latter case, when using component JComments, you can integrate social buttons into its plugin. Then the buttons will only appear in those articles that have comments turned on. As a separate option would be considered a vertical panel that can be hung anywhere on a web page.
So let's get it clear, in which files and to what places in their code the scripts of buttons panel will be inserted.
1. Into an article body before or after its content.
In general case file components \ com_content \ views \ article \ tmpl \ default.php will be edited. The following code fragment of this file clearly shows, where to insert the button bar:
/* ------------ More code..... ----------- */ <?php if (!empty($this->item->pagination) AND $this->item->pagination AND !$this->item->paginationposition AND !$this->item->paginationrelative): echo $this->item->pagination; endif; ?> /* =====> !!! Before the content - Insert here */ <?php echo $this->item->text; ?> /* ------------ More code..... ----------- */ /* =====> !!! After the content - Insert here */ <?php if (!empty($this->item->pagination) AND $this->item->pagination AND $this->item->paginationposition AND $this->item->paginationrelative): echo $this->item->pagination;?> <?php endif; ?> <?php echo $this->item->event->afterDisplayContent; ?> </div> /* ------------ End of File ----------- */
Method described above works fine in the templates that ship with Joomla by default - Beez2, Beez5, Atomic, as well as in many others. However, there are a variety of templates where their own file default.php overrides the one we discussed earlier. For example, my template, made in Artisteer and being active at the time of this writing. Let's find out, where to implement the code of social media buttons in this case.
We edit the following file: templates \ [my_template] \ html \ com_content \ article \ default.php.
/* ------------ More code..... ----------- */ if (!$article->introVisible) $content .= $article->event('afterDisplayTitle'); $content .= $article->event('beforeDisplayContent'); /* =====> !!! Before the content - Insert here */ if (strlen($article->toc)) $content .= $article->toc($article->toc); /* ------------ More code..... ----------- */ if (strlen($article->readmore)) $content .= $article->readmore($article->readmore, $article->readmoreLink); /* =====> !!! After the content - Insert here */ if ('below full article' === $article->paginationPosition) $content .= $article->pagination(); $content .= $article->event('afterDisplayContent'); $params['content'] = $content; // Render article echo $article->article($params); echo $component->endPageContainer(); /* ------------ End of File ----------- */
Hopefully the concept is clear here as well. The only thing I want to clarify - in this case the entire script of a page is assigned to the variable $content
. Therefore, the panel's code is not inserted as is, but is added to the value of this variable in string representation, ie, framed by single or double quotes:
$content .= 'Code of the buttons panel';
2. Integration into JComments.
The file for customizing is components \ com_jcomments \ tpl \ default \ tpl_index.php. It's simple:
// include JComments JavaScript initialization ?> /* =====> !!! Insert here */ <script type="text/javascript">
Now, after we know, where and in which case we will integrate the scripts of our panels, we turn to the topic of what to embed. Next article will address this issue.
Latest News
-
Tuesday, 21 July 2020 03:18
Joomla 3: Redirect to same page after successful login -
Saturday, 30 December 2017 16:11
Joomla: how to add your own language constants or override existing ones -
Thursday, 30 November 2017 23:27
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
Saturday, 25 June 2016 15:33
Unified filtering of mod_jcomments_latest module's output -
Thursday, 17 September 2015 16:23
Post an illustrated Joomla-site article on Facebook using OG-tags
Articles Most Read
-
148854
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
83530
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
56857
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
40098
Editing animated GIF-images in Photoshop CS3 -
39237
Custom 404 error page in Joomla 2.5
Login
Guest Column
Recent comments
-
Custom 404 error page in Joomla 2.5
-
Roseann
02.11.2020 08:17
Noot spamming but wanted to say this is hugely useful!
-
Roseann
02.11.2020 08:17
-
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments
-
PG SLOT
13.01.2021 09:21
Hey! I could have sworn I've been to this site before but after browsing through some of the post ...
-
Nidia
12.12.2020 08:04
HELP. I can't write a comment without it hanging.
-
Launa
17.11.2020 15:13
I can agree with the accuracy of this as I work in a related sector. Interesting cheers for sharing.
-
JD sports vouchers
04.10.2020 03:12
Happy to pay for something like this, or donate witth paypal even
-
PG SLOT
13.01.2021 09:21
-
Joomla: how to add your own language constants or override existing ones
-
Vouchersort
29.10.2020 11:33
Is this a free template that you are using as I really love it. As a website desugner myself I hope that ...
-
Vouchersort
29.10.2020 11:33
-
Migrating from Joomla 1.5 to Joomla 2.5. Epilogue
-
Dewitt
11.02.2021 06:17
HELP. I can't write a comment without the page freezing.
-
Dewitt
11.02.2021 06:17
-
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments
-
Francine
14.12.2020 08:49
I cant stomach this person so sorry x
-
Vouchersort
30.10.2020 15:43
Once again, great resource for us newbs.
-
Francine
14.12.2020 08:49
-
Unified filtering of mod_jcomments_latest module's output
-
Фильмы 2022 онлайн
03.12.2021 21:37
This web site definitely has all of the info I wanted about this subject and didn't know who to ask.
-
Фильмы 2022 онлайн
03.12.2021 21:37
Comments
dailly and take good facts from here all the time.
Poker for real mopney pokermatch скачать pokermatch android скачать