Как вставить рекламу Google AdSense в шаблон Joomla.
(3 Голосов)

Google AdSenseЧасто в работе веб мастера встречается потребность вставить рекламу от Google AdSense на CMS Joomla, и начинающии веб мастера начинают бороздить просторы интернета в поиске плагина или модуля который позволил бы вставить рекламу на сайт под управлением joomla, в этой статье я хотел бы показать как можно вставить любую рекламу на сайт joomla без всяких плагинов и модулей.Рекламный код мы будем вставлять прямо в шаблон..



Для того чтоб вставить рекламу в шаблон Joomla нам надо открыть index.php нашего шаблона, для этого идем по пути как показано ниже на картинках

Google AdSense
Google AdSense
Google AdSense


Также предварительно вы должны знать названия позиции в которую будет установлен код рекламы в основном это правая и левая колонка сайта, в joomla они в основном обозначаются right(правая колонка) и left(левая колонка) для этого ищем в index.php нашего шаблона эти позиции в моем случае это строка 54 и строка 88 эти строки я подсветил зеленым цветом




<?php
defined('_JEXEC') or die('Restricted access'); // no direct access
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'functions.php';
$document = null;
if (isset($this))
 $document = & $this;
$baseUrl = $this->baseurl;
$templateUrl = $this->baseurl . '/templates/' . $this->template;
artxComponentWrapper($document);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<jdoc:include type="head" />
 <link rel="stylesheet" href="/<?php echo $this->baseurl; ?>/templates/system/css/system.css" type="text/css" />
 <link rel="stylesheet" href="/<?php echo $this->baseurl; ?>/templates/system/css/general.css" type="text/css" />

 <link rel="stylesheet" type="text/css" href="/<?php echo $templateUrl; ?>/css/template.css" />
 <!--[if IE 6]><link rel="stylesheet" href="/<?php echo $templateUrl; ?>/css/template.ie6.css" type="text/css" media="screen" /><![endif]-->
 <!--[if IE 7]><link rel="stylesheet" href="/<?php echo $templateUrl; ?>/css/template.ie7.css" type="text/css" media="screen" /><![endif]-->
 <script type="text/javascript" src="/<?php echo $templateUrl; ?>/script.js"></script>
 </head>
<body>
<div id="art-main">
<div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div></div>
 <div>
<div>
 <div></div>
<div>
 <h1 id="name-text"><a href="/<?php echo $baseUrl; ?>/">Headline</a></h1>
 <div id="slogan-text">Slogan Text</div>
</div>


</div>
<jdoc:include type="modules" name="user3" />
<jdoc:include type="modules" name="banner1" style="artstyle" artstyle="art-nostyle" />
<?php echo artxPositions($document, array('top1', 'top2', 'top3'), 'art-block'); ?>
<div>
<?php if (artxCountModules($document, 'left')) : ?>
<div><?php echo artxModules($document, 'left', 'art-block'); ?>
</div>
<?php endif; ?>
<div>

<?php
 echo artxModules($document, 'banner2', 'art-nostyle');
 if (artxCountModules($document, 'breadcrumb'))
 echo artxPost(null, artxModules($document, 'breadcrumb'));
 echo artxPositions($document, array('user1', 'user2'), 'art-article');
 echo artxModules($document, 'banner3', 'art-nostyle');
?>
<?php if (artxHasMessages()) : ?><div>
 <div>
<div>
<div>

<jdoc:include type="message" />

</div>
<div></div>

</div>

 </div>
</div>
<?php endif; ?>
<jdoc:include type="component" />

<?php echo artxModules($document, 'banner4', 'art-nostyle'); ?>
<?php echo artxPositions($document, array('user4', 'user5'), 'art-article'); ?>
<?php echo artxModules($document, 'banner5', 'art-nostyle'); ?>
</div>
<?php if (artxCountModules($document, 'right')) : ?>
<div><?php echo artxModules($document, 'right', 'art-block'); ?>
</div>
<?php endif; ?>

</div>
<div></div>

<?php echo artxPositions($document, array('bottom1', 'bottom2', 'bottom3'), 'art-block'); ?>
<jdoc:include type="modules" name="banner6" style="artstyle" artstyle="art-nostyle" />
<div>
 <div>
 <?php echo artxModules($document, 'syndicate'); ?>
 <div>
 <?php if (artxCountModules($document, 'copyright') == 0): ?>
<p>Copyright &copy; 2009 ---.<br/>
All Rights Reserved.</p>

 <?php else: ?>
 <?php echo artxModules($document, 'copyright', 'art-nostyle'); ?>
 <?php endif; ?>
 </div>
 </div>
 <div></div>
</div>

 </div>
</div>
<div></div>
</div>

</body> 
</html>

Итак после того как мы нашли нужную позицию в маем случае это правая колонка right сразу за ней можно вставлять код рекламы

<?php if (artxCountModules($document, 'right')) : ?>вот сюда вставляем рекламный код

 

Комментарии  

 
0 #2 14.05.2011 12:03
Странно, а почему по вашему способу рекламу видно только через ?tp=1, а так ни чего нет.
Цитировать
 
 
0 #1 28.04.2011 08:48
Спасибо
Цитировать
 

Добавить комментарий


Защитный код
Обновить