Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Вебмастеру (http://forum.oszone.net/forumdisplay.php?f=22)
-   -   как в шаблон joomla 3.3 добавить свои модули. (http://forum.oszone.net/showthread.php?t=284765)

vanoman 08-07-2014 23:39 2373888

как в шаблон joomla 3.3 добавить свои модули.
 
Скажите, вот есть шаблон joomla 3 . Там есть свои позиции. Но можно ли мне добавить свою позицию. Например position 5 ,чтобы она была в правом ,верхнем углу.
Какой файл шаблона jooml'ы надо редактировать. Я так подозреванию , что index.php
но какой туда текст вставить.
На всякий случай даю содержимое index.php своего шаблона
PHP код:

<?php
/**
 * @version        $Id: index.php $
 * @package        Joomla.Site
 * @copyright    Copyright (C) 2009 - 2011 SiteGround.com - All Rights Reserved.
 * @license        GNU General Public License version 3 or later; see LICENSE.txt
    
 *    This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.

 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

// No direct access.
defined('_JEXEC') or die;

JHTML::_('behavior.framework'true);

/* The following line gets the application object for things like displaying the site name */
$app JFactory::getApplication();
$tplparams    $app->getTemplate(true)->params;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language?>" lang="<?php echo $this->language?>" dir="<?php echo $this->direction?>">
<head>
    <jdoc:include type="head" />
    <!-- The following line loads the template CSS file located in the template folder. -->
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
</head>
<body id="page_bg">
    <div id="header">
        <h1><a href="<?php echo $this->baseurl ?>"><?php echo $app->getCfg('sitename'); ?></a></h1>                    
        <div class="top-menu">
            <div id="sgmenu">
                <jdoc:include type="modules" name="menuload" />
            </div>
        </div>
    </div>
    <div id="wrapper">
        <div id="content_m">
            <?php if ($this->countModules'position-7 and position-4' )) : ?>
            <div class="maincol">                 
            <?php elseif( $this->countModules'position-7' ) ) : ?>
            <div class="maincol_w_left">
            <?php elseif( $this->countModules'position-4' ) ) : ?>
            <div class="maincol_w_right">
            <?php else: ?>
            <div class="maincol_full">
            <?php endif; ?>
            
                <?php if( $this->countModules('position-7') ) : ?>
                    <div class="leftcol">
                        <jdoc:include type="modules" name="position-7" style="rounded"/>
                    </div>
                    <?php endif; ?>
                    
                        <div class="cont">
                        
<?php require_once(dirname(__FILE__) .'/css/system.php'); ?>
                            <jdoc:include type="component" />
                        </div>
                    
                <?php if( $this->countModules('position-4') ) : ?>
                <div class="rightcol">
                    <div id="search">
                        <jdoc:include type="modules" name="position-0" />
                    </div>
                    <jdoc:include type="modules" name="position-4" style="rounded"/>
                </div>
                <?php endif; ?>
                <div class="clr"></div>
            </div>
        </div>
        <div id="footer">
            <p style="text-align:center;"><?php $sg ''; include "templates.php"?></p>
        </div>
    </div>
    <div id="footergrad"><div id="underfooter">&nbsp;</div></div>
</body>
</html>


Andrey N. 10-07-2014 15:11 2374723

Вроде также, как и в 2.5. Добавить позиции в файлах шаблона: index.php и templateDetails.xml.
Какой текст вставить, такой:
Код:

<?php if( $this->countModules('позиция') ) : ?><div></div><?php endif; ?>
и
Код:

<position>позиция</position>
в соответствующие файлы.

vanoman 12-07-2014 19:01 2375746

Andrey N.,
смотрите, т.е. можно сделать так
между этими кодами
PHP код:

<?php if( $this->countModules('position-7') ) : ?>
                    <div class="leftcol">
                        <jdoc:include type="modules" name="position-7" style="rounded"/>
                    </div>
                    <?php endif; ?>




PHP код:

<div class="cont"

вставить такой
PHP код:

<?php if( $this->countModules('position-8') ) : ?>
                    <div class="rightcol">
                        <jdoc:include type="modules" name="position-8" style="rounded"/>
                    </div>
                    <?php endif; ?>

Правильно?

А как тогда прописывается именно, что правый верхний.

Andrey N. 12-07-2014 20:25 2375800

Сейчас только заметил, в предыдущем моём посте
Цитата:

Цитата Andrey N.
<?php if( $this->countModules('позиция') ) : ?><div></div><?php endif; ?> »

это, конечно же условие отображать модуль или нет. Сам код вставки модуля указан у Вас правильно.
Где вставлять этот код, зависит от того, где Вы хотите видеть этот модуль.
Я так понял, что Вы хотите видеть этот модуль в правой колонке "rightcol". Плюс ещё, чтобы он был самым верхним, тогда вставляйте его внутри блока div class="rightcol" до блока div id="search" подредактировав условие вывода позициий 4 и 8, т.е. примерно так:

Код:

<?php if( $this->countModules('position-4 or position-8') ) : ?>
                <div class="rightcol">
                    <jdoc:include type="modules" name="position-8" style="rounded"/>
                    <div id="search">
                        <jdoc:include type="modules" name="position-0" />
                    </div>
                    <jdoc:include type="modules" name="position-4" style="rounded"/>
                </div>
<?php endif; ?>

Код самой позиции можете обернуть в div, присвоить id и написать для него стили.

vanoman 13-07-2014 19:07 2376086

Цитата:

Цитата Andrey N.
Плюс ещё, чтобы он был самым верхним, тогда вставляйте его внутри блока div class="rightcol" »

а если в середине или внизу. то как писать?

Andrey N. 13-07-2014 20:21 2376110

Цитата:

Цитата vanoman
а если в середине или внизу. то как писать? »

Переставлять можно здесь как угодно, это же html c php-вставками, и как будет выглядеть модули зависит от стилей (css). Т.е. если нужно в середине, то блок position-8 ставите между position-0 и position-4, если внизу, то соответственно position-0, position-4 и position-8, подправив, если нужно стили.


Время: 13:19.

Время: 13:19.
© OSzone.net 2001-