Adding links in Joomla to Facebook is a simple matter. You can use ready-madeextensions that will do it for us, but more flexible will be to modify the Joomla code.In this way we will decide exactly where you will find our Facebook buttons.
Below are some examples of modification obtained with the help of one of the forum members (link to his web page http://www.landkiting.pl/).
In our examples we use a modified button "f add to wall" (you should create your custom icon), which looks a little different than the standard "I like it." In addition, we use the standard "f" button. We save the image files to / images / icons / (or any folder created by you).
(Note we can also use the following article to add a google+ button. For example, before facebook button, typing <g:plusone> </ g: plusone> and on the main page in the head section </ script> {lang: 'en'} <script type="text/javascript" src="https://apis.google.com/js/plusone.js">)
- Let's insert Facebook button on our home page in Joomla.
We need to edit the file (for example, after logging in via ftp / ssh, etc. .. on our server) is located
in components / com_content / views / frontpage / tmpl / default_item.php. Bellow the lines:
<?php if ($canEdit || $this->item->params->get('show_title') || $this->item->params->get('show_pdf_icon') || $this->item->params->get('show_print_icon') || $this->item->params->get('show_email_icon')) : ?>
<table class="contentpaneopen<?php echo $this->escape($this->item->params->get( 'pageclass_sfx' )); ?>">
<tr>
<?php if ($this->item->params->get('show_title')) : ?>
<td class="contentheading<?php echo $this->escape($this->item->params->get( 'pageclass_sfx' )); ?>" width="100%">
<?php if ($this->item->params->get('link_titles') && $this->item->readmore_link != '') : ?>
<a href="/<?php echo $this->item->readmore_link; ?>" class="contentpagetitle<?php echo $this->escape($this->item->params->get( 'pageclass_sfx' )); ?>">
<?php echo $this->escape($this->item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</td>
<?php endif; ?>
add:<td align="right" width="100%" class="contentheading">
<a target="_blank" href=http://www.facebook.com/share.php?u=your site address without the http at the beginning<?php echo $this->item->readmore_link; ?> title="Add to Facebook" ><img src="/images/icons/facebook.png" border="0" alt="Dodaj do Facebook`a"></a>
</td>
- If you want to add a button to each new article well enough to modify a file in components / com_content / views / article / tmpl / default.php. Bellow the lines:
<table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<tr>
<?php if ($this->params->get('show_title')) : ?>
<td class="contentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="100%">
<?php if ($this->params->get('link_titles') && $this->article->readmore_link != '') : ?>
<a href="/<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->article->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->article->title); ?>
<?php endif; ?>
</td>
add:
<td align="right" width="100%" class="contentheading">
<a target="_blank" href=http://www.facebook.com/share.php?u=your site address without the http at the beginning<?php echo $this->item->readmore_link; ?> title="Add to facebook" ><img src="/images/icons/facebook.png" border="0" alt="Add to Facebook"></a>
</td>
- We can also add a menu button to display a list of articles in the category. We need to edit the file components / com_content / views / category / tmpl / default_item.php and insert code:
<?php foreach ($this->items as $item) : ?>
<tr class="sectiontableentry<?php echo ($item->odd +1 ) . $this->escape($this->params->get('pageclass_sfx')); ?>" >
<td align="right">
<?php echo $this->pagination->getRowOffset( $item->count ); ?>
</td>
<?php if ($this->params->get('show_title')) : ?>
<?php if ($item->access <= $this->user->get('aid', 0)) : ?>
<td>
<a href="/<?php echo $item->link; ?>">
<?php echo $this->escape($item->title); ?></a>
<?php $this->item = $item; echo JHTML::_('icon.edit', $item, $this->params, $this->access) ?>
your site address without the http at the beginning<a target="_blank" href=http://www.facebook.com/share.php?u=<?php echo $this->item->readmore_link; ?> title="Add to facebook" ><img src="/images/icons/facebook1.gif" border="0" alt="Add to facebook"></a>
</td>
That's it folks ;)
Brak komentarzy:
Prześlij komentarz