PDA

Zobacz pełną wersję : Poradnik dodawania nowego modułu do szablonu



start007
25-03-2011, 13:01
Witam, czy może ktoś zrobić lub podlinkować:
Poradnik dodawania nowego modułu do szablonu wraz z jego umiejscowieniem.

Poradnik od 1.5 nie nadaje się ponieważ w 100% odpowiada tylko na templateDetails.xml
w index.php nie ma tej zawartości co w J 1.5

Np u mnie w szablonie ja_purity_ii 1.6 index.php zawiera:

<?php
if (class_exists('T3Template')) {
$tmpl = T3Template::getInstance();
$tmpl->setTemplate($this);
$tmpl->render();
return;
} else {
//Need to install or enable JAT3 Plugin
echo JText::_('Missing jat3 framework plugin');
}i nic więcej.

Gdzie szukać źródła?

Natomiast w pozostałych szablonach podstawowych wszystko jest OK.

Bazyl
25-03-2011, 13:27
Witaj,

Zobacz, że masz tam kilka folderów więcej.
Poklikaj, poszukaj - znajdziesz.

Podpowiedź: w ustawieniach szablonu masz nazwę, której szukasz. :) oraz folder block

start007
25-03-2011, 14:24
Podpowiesz którym plikiem mam się zainteresować aby dodać moduł w miejscu nad i pod miejscem gdzie wyświetlają się artykuły.
Nie w left nie w right a w tym centralnym bloku.

Co do folderu to go już trzepałem ale z tego co widzę:
footer.php - wiadomo odpada
mainnav.php - wiadomo odpada
head.php

<?php
/*
# ------------------------------------------------------------------------
# JA Purity II template for Joomla 1.6
# ------------------------------------------------------------------------
# Copyright (C) 2004-2009 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: J.O.O.M Solutions Co., Ltd
# Websites: http://www.joomlart.com - http://www.joomlancers.com
# This file may not be redistributed in whole or significant part.
# ------------------------------------------------------------------------
*/
?>
<script type="text/javascript">
var siteurl='<?php echo JURI::base(true) ?>/';
var tmplurl='<?php echo JURI::base(true)."/templates/".T3_ACTIVE_TEMPLATE ?>/';
var isRTL = <?php echo $this->isRTL()?'true':'false' ?>;
</script>

<jdoc:include type="head" />

<?php if (T3Common::mobile_device_detect()=='iphone'):?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=1;" />
<meta name="apple-touch-fullscreen" content="YES" />
<?php endif;?>

<?php if (T3Common::mobile_device_detect()):?>
<meta name="HandheldFriendly" content="true" />
<?php endif;?>

<link href="<?php echo T3Path::getUrl('images/favicon.ico') ?>" rel="shortcut icon" type="image/x-icon" />

<?php JHTML::stylesheet ('', 'templates/system/css/system.css') ?>
<?php JHTML::stylesheet ('', 'templates/system/css/general.css') ?>
<?php JHTML::stylesheet ('', 'templates/ja_purity_ii/css/fixtures.css') ?>

<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->

<script language="javascript" type="text/javascript">
var rightCollapseDefault='show';
var excludeModules='38';
</script>
<script language="javascript" type="text/javascript" src="<?php echo JURI::base(true) ?>/templates/<?php echo T3_ACTIVE_TEMPLATE ?>/js/ja.rightcol.js"></script>
tu też nic, żadnego div'a abym mógł po źródle strony przypasować miejsce gdzie wstawić kod modułu.

---------- Post dodany o 13:18 ---------- Poprzedni post był o 13:14 ----------

Edytować z poziomu zaplecza main-only ?


<?xml version="1.0" encoding="utf-8"?>
<layout name="desktop">
<!--Extra css load for this layout-->
<blocks name="top" style="xhtml">
<block name="absolute" type="modules" style="raw">absolute</block>
<block name="top-panel" type="modules" style="raw" main-inner="1">top-panel</block>
<block name="header" type="header" main-inner="1"></block>
<block name="mainnav" type="mainnav" main-inner="1"></block>
<block name="cpanel" type="usertools/cpanel"></block>
<block name="topsl" type="spotlight" main-inner="1">user1,user2,user3,user4,user5</block>
</blocks>
<blocks name="middle">
</blocks>
<blocks name="bottom" style="xhtml">
<block name="botsl" type="spotlight" main-inner="1">user6,user7,user8,user9,user10</block>
<block name="navhelper" type="navhelper" main-inner="1"></block>
<block name="footer" type="footer"></block>
</blocks>
</layout>

i pomiędzy tagami

<blocks name="middle">

wklejać mój moduł ?

---------- Post dodany o 13:24 ---------- Poprzedni post był o 13:18 ----------

PS zrobiłem tak i nic :)

Bazyl
25-03-2011, 14:27
http://www.wiki.joomla.pl/index.php/Pozycje_modu%C5%82%C3%B3w

start007
25-03-2011, 14:38
Mam tak:
Ustawienia szablonu > Layout Settings > Default

<?xml version="1.0" encoding="utf-8"?>
<layout name="desktop">
<!--Extra css load for this layout-->
<stylesheets>
</stylesheets>
<blocks name="top" style="xhtml">
<block name="absolute" type="modules" style="raw">absolute</block>
<block name="top-panel" type="modules" style="raw" main-inner="1">top-panel</block>
<block name="header" type="header" main-inner="1"></block>
<block name="mainnav" type="mainnav" main-inner="1"></block>
<block name="cpanel" type="usertools/cpanel"></block>
<block name="topsl" type="spotlight" main-inner="1">user1,user2,user3,user4,user5</block>
</blocks>
<blocks name="middle" colwidth="20">
<block name="left1">left</block>
<block name="nad_artykulem" type="modules"></block>
<block name="right1" style="jarounded">right</block>
</blocks>
<blocks name="bottom" style="xhtml">
<block name="botsl" type="spotlight" main-inner="1">user6,user7,user8,user9,user10</block>
<block name="navhelper" type="navhelper" main-inner="1"></block>
<block name="footer" type="footer"></block>
</blocks>
</layout>templateDetalis.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd">
<extension
version="1.6"
type="template"
method="upgrade">
<name>ja_purity_ii</name>
<version>1.0.0 Beta</version>
<creationDate>28 Jan 2011</creationDate>
<author>JoomlArt.com</author>
<authorEmail>webmaster@joomlart.com</authorEmail>
<authorUrl>http://www.joomlart.com</authorUrl>
<copyright>Copyright (C), J.O.O.M Solutions Co., Ltd. All Rights Reserved.</copyright>
<license>license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html</license>
<description>JA Purity II For Joomla 1.6</description>
<engine>t3</engine>
<files>
<filename>component.php</filename>
<filename>favicon.ico</filename>
<filename>index.html</filename>
<filename>index.php</filename>
<filename>info.xml</filename>
<filename>params.ini</filename>
<filename>template_thumbnail.png</filename>
<folder>blocks</folder>
<folder>core</folder>
<folder>css</folder>
<folder>html</folder>
<folder>images</folder>
<folder>info</folder>
<folder>js</folder>

</files>

<languages>
<language tag="en-GB">en-GB.tpl_ja_purity_ii.ini
</language>
</languages>
<administration>
<languages folder="admin">
<language tag="en-GB">en-GB.tpl_ja_purity_ii.ini
</language>
</languages>
</administration>

<positions>
<position>hornav</position>
<position>breadcrumbs</position>
<position>search</position>
<position>banner</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>user5</position>
<position>user6</position>
<position>user7</position>
<position>user8</position>
<position>user9</position>
<position>user10</position>
<position>user11</position>
<position>footer</position>
<position>syndicate</position>
<position>debug</position>
<position>absolute</position>
<position>nad_artykulem</position>
</positions>

<config>
<fields name="params" addfieldpath="/plugins/system/jat3/jat3/core/element">
</fields>
</config>
</extension>
Ale tego to już nie dam rady :(
<jdoc:include type="modules" name="nad_artykulem" style="xhtml" />

Tylko tyle i ma wyświetlać?

Bazyl
25-03-2011, 14:43
Dopiero teraz zauważyłem, że to Joomla! 1.6. :hmm:

Ponieważ nie czuję się jeszcze na siłach wypowiadać o 1.6 - spadam :)
Zobacz obecne pozycje modułów i swoja dodaj analogicznie.

start007
25-03-2011, 14:49
Właśnie gdyby to był standardowy szablon to bym nawet nie męczył o pomoc no z tym jos faktycznie problem.
Jak tworze moduł to już go widzi i jest przypisany właśnie pod mój szablon. Custom HTML dałem i powpisywałem test test.

Chyba tylko to jos jest źle bo sie nie wyświetla... Pomocy

mjmartino
25-03-2011, 15:23
W T3
layouts/blocks tutaj masz *.php i tam dodaj moduł w tej kwestii nic się "chyba" nie zmieniło

start007
25-03-2011, 16:23
3845
T3 nie mam takiego katalogu w templates/nazwa stylu

za to jest sam block a w nim
footer.php
mainnav.php
head.php

Gdzie mam to wstawić i w jakiej formie? Taka co podałem wyżej ?

oto ten plik

<?php
/*
# ------------------------------------------------------------------------
# JA Purity II template for Joomla 1.6
# ------------------------------------------------------------------------
# Copyright (C) 2004-2009 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: J.O.O.M Solutions Co., Ltd
# Websites: http://www.joomlart.com - http://www.joomlancers.com
# This file may not be redistributed in whole or significant part.
# ------------------------------------------------------------------------
*/
?>
<script type="text/javascript">
var siteurl='<?php echo JURI::base(true) ?>/';
var tmplurl='<?php echo JURI::base(true)."/templates/".T3_ACTIVE_TEMPLATE ?>/';
var isRTL = <?php echo $this->isRTL()?'true':'false' ?>;
</script>
<jdoc:include type="head" />
<?php if (T3Common::mobile_device_detect()=='iphone'):?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=1;" />
<meta name="apple-touch-fullscreen" content="YES" />
<?php endif;?>

<?php if (T3Common::mobile_device_detect()):?>
<meta name="HandheldFriendly" content="true" />
<?php endif;?>

<link href="<?php echo T3Path::getUrl('images/favicon.ico') ?>" rel="shortcut icon" type="image/x-icon" />

<?php JHTML::stylesheet ('', 'templates/system/css/system.css') ?>
<?php JHTML::stylesheet ('', 'templates/system/css/general.css') ?>
<?php JHTML::stylesheet ('', 'templates/ja_purity_ii/css/fixtures.css') ?>

<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->

<script language="javascript" type="text/javascript">
var rightCollapseDefault='show';
var excludeModules='38';
</script>
<script language="javascript" type="text/javascript" src="<?php echo JURI::base(true) ?>/templates/<?php echo T3_ACTIVE_TEMPLATE ?>/js/ja.rightcol.js"></script>

start007
25-03-2011, 17:22
kilka godzin szukania i mam:

public_html/plugins/system/jat3/jat3/base-themes/default/blocks

szkoda, że szpece na forum nie wiedzieli tego bo bym już był po przebudowie całej templatki.

a_m
25-03-2011, 17:30
powiem tylko tyle, że niepotrzebnie tyle szukałeś, bo do takiej operacji jak dodanie nowej pozycji do ja t3 niepotrzebne jest grzebanie w plikach. uzupełnij plik templateDetails.xml / wejdź w parametry moduły > zakładka layouts - obok każdego widoku jest guzik edit i clone po kliknięciu w edit dodajesz blok z nową pozycją i wszystko

start007
25-03-2011, 18:01
Wszędzie mi to dodaje ale nie tam gdzie chcę..
http://www.n-style.yoyo.pl/reklama.png

Tu jak jest reklama1 chcę dodać moduł bo go tam nie ma.. Nie daje rady tak zakręcony jest ten szablon, że nie wyrabiam.. :(

nie wiem w której lini gdzie wstawić
<jdoc:include type="modules" name="nad_artykulem" style="xhtml" />
i jak go opisać aby później mu css dodać..

a_m
25-03-2011, 18:18
jat3/base-themes/default/page/default.php

start007
25-03-2011, 20:02
Dziękuję jak nie wiem co! Wszystko działa jak należy.

start007
31-03-2011, 16:10
Mam kolejny problem :(
strona: http://mksmyszkow.com/index.php
Tym razem ładnie wszystko się wyświetla tylko nie tak jak powinno.

Utworzyłem 3 moduły userT1 userT2 i userT3

Chciałem mieć coś w stylu:
http://joomlathemes.co/demo16/?template=jt005_j16 user1-3

U mnie niestety wszystko wyświetla się jedno pod drugim :(

Tak zmieniłem w PHP:

<!-- MAIN CONTAINER -->
<div id="ja-container" class="wrap <?php echo $this->getColumnWidth('cls_w')?$this->getColumnWidth('cls_w'):'ja-mf'; ?>">
<?php $this->genBlockBegin ($this->getBlocksXML ('middle')) ?>
<div id="ja-mainbody" style="width:<?php echo $this->getColumnWidth('mw') ?>%">
<?php if ($this->countModules('userT1 or userT2 or userT3')) : ?>
<div id="modsT1" class="spacer<?php echo $mainmod1_width; ?>">
<jdoc:include type="modules" name="userT1" style="xhtml" />
<jdoc:include type="modules" name="userT2" style="xhtml" />
<jdoc:include type="modules" name="userT3" style="xhtml" />
</div>
<?php endif; ?>
<!-- CONTENT -->Taki napisałem arkusz pod to:

/* Modules 1 */
#modsT1 {overflow: hidden;padding:0; margin:0 auto;clear:both; display:block; float:left;}
#modsT1 .module { padding:0; margin:0; }
#modsT1 .inner { padding:10px; }
#modsT1 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#FD9821;}
#modsT1 h3 {display: block; padding:0; margin:0;}
#modsT1 .module-body {padding:0; margin:0;}
#modsT1 ul {margin:0; padding:0;}
#modsT1 ul li {list-style:inside; border-bottom:1px dotted #eaeaea; list-style:none;}
#modsT1 ul li:hover {}
#modsT1 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li.png) 0 50% no-repeat}
#modsT1-i { clear:both;}
/* Modules 2 */
#modsT2 {overflow: hidden;padding:0; margin:0 auto;clear:both;width:990px;color:#ccc; }
#modsT2 .module { margin:0;padding:0;}
#modsT2 .inner { padding:10px;}
#modsT2 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#FD9821; text-shadow:1px 1px #111;}
#modsT2 .module-body {padding:0; margin:0;}
#modsT2 a { color:#ccc; text-decoration:underline;}#modsT2 a:hover { color:#fff;}
#modsT2 ul {margin:0; padding:0;}
#modsT2 ul li {list-style:inside; border-bottom:1px dotted #333; list-style:none;}
#modsT2 ul li:hover {}
#modsT2 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li2.png) 0 50% no-repeat}

/* Modules 3 */
#modsT3 {overflow: hidden;padding:0; margin:0 auto; clear:both; width:990px; color:#fff;}
#modsT3 .module { margin:0;padding:0;}
#modsT3 .inner { padding:5px 10px 0 10px;}
#modsT3 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#000; text-shadow:1px 1px #fff;}
#modsT3 .module-body {padding:0; margin:0;}
#modsT3 a { color:#fff; text-decoration:underline;}#modsT3 a:hover { color:#000;}
#modsT3 ul {margin:0; padding:0;}
#modsT3 ul li {list-style:inside; border-bottom:1px dotted #f0741a; list-style:none;}
#modsT3 ul li:hover {}
#modsT3 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li2.png) 0 50% no-repeat}

.spacer {float: left;}Gdzie jest błąd?

Bazyl
31-03-2011, 16:21
Nie musisz tworzyć nowych pozycji. Masz takie w szablonie. Sprawdź.

//
Utworzyłeś #modst1, #modst2, #modst3 (id), a powinno być .modst3 (class).
Przyrostek klasy modułu dodaj ze spacją "moduletable modsT1"

start007
31-03-2011, 18:15
Zmienione na:

<?php if ($this->countModules('userT1 or userT2 or userT3')) : ?>
<div class="moduletable modsT1<?php echo $mainmod1_width; ?>">
<jdoc:include type="modules" name="userT1" style="xhtml" />
<jdoc:include type="modules" name="userT2" style="xhtml" />
<jdoc:include type="modules" name="userT3" style="xhtml" />
</div>
<?php endif; ?>
Ale nadal nie wyświetlają się jedno obok drugiego.


/* Modules 1 */
.modsT1 {overflow: hidden;padding:0; margin:0 auto;clear:both; display:block; float:left;}
.modsT1 .module { padding:0; margin:0; }
.modsT1 .inner { padding:10px; }
.modsT1 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#FD9821;}
.modsT1 h3 {display: block; padding:0; margin:0;}
.modsT1 .module-body {padding:0; margin:0;}
.modsT1 ul {margin:0; padding:0;}
.modsT1 ul li {list-style:inside; border-bottom:1px dotted #eaeaea; list-style:none;}
.modsT1 ul li:hover {}
.modsT1 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li.png) 0 50% no-repeat}
.modsT1-i { clear:both;}
/* Modules 2 */
.modsT2 {overflow: hidden;padding:0; margin:0 auto;clear:both;width:990px;color:#ccc; }
.modsT2 .module { margin:0;padding:0;}
.modsT2 .inner { padding:10px;}
.modsT2 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#FD9821; text-shadow:1px 1px #111;}
.modsT2 .module-body {padding:0; margin:0;}
.modsT2 a { color:#ccc; text-decoration:underline;}.modsT2 a:hover { color:#fff;}
.modsT2 ul {margin:0; padding:0;}
.modsT2 ul li {list-style:inside; border-bottom:1px dotted #333; list-style:none;}
.modsT2 ul li:hover {}
.modsT2 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li2.png) 0 50% no-repeat}

/* Modules 3 */
.modsT3 {overflow: hidden;padding:0; margin:0 auto; clear:both; width:990px; color:#fff;}
.modsT3 .module { margin:0;padding:0;}
.modsT3 .inner { padding:5px 10px 0 10px;}
.modsT3 .module-title {margin:0 0 5px 0;padding:0;display: block;height: 22px;font-size: 18px;font-weight:bold; color:#000; text-shadow:1px 1px #fff;}
.modsT3 .module-body {padding:0; margin:0;}
.modsT3 a { color:#fff; text-decoration:underline;}.modsT3 a:hover { color:#000;}
.modsT3 ul {margin:0; padding:0;}
.modsT3 ul li {list-style:inside; border-bottom:1px dotted #f0741a; list-style:none;}
.modsT3 ul li:hover {}
.modsT3 ul li a {font-weight:100; display:block; text-decoration:none;padding:0 0 0 20px; background:url(../images/li2.png) 0 50% no-repeat}

a_m
31-03-2011, 18:31
jak chcesz to ułożyć obok siebie to z .modsT1 wywal float:left i dopisz

.modsT1 .moduletable{float:left; width:33%} (width trzeba zmienić jak dołożysz więcej modułów + jak jakieś paddingi czy coś

tylko nie wiem po co te kombinacje, bo ten szablon ma "miejsce" na moduły nad contentem w pozycjach tops1, content-top, mass-content-top; gdybyś mnie posłuchał wcześniej i nauczył wywoływać je przez plik xml używanego layoutu, wiele być sobie ułatwił

start007
01-04-2011, 00:19
Mam już prawie gotowe :) Jednak zrobione 2 moduły nie 3.
Mam problem z wyrównaniem. Jak lewy wyrównać do lewej prawy do prawej ? :D

Z modułami się bawiłem i efekt już można zobaczyć :) nie licząc tego krzywego rozstawienia.

a_m
01-04-2011, 13:37
w #modsT1 .moduletable zmień float na right + dopisz #modsT1 .moduletable:first-child {float:left} i do nauki ;)

start007
01-04-2011, 16:57
Tak właśnie zrobiłem, długo nie było odpowiedzi to zakombinowałem :) Kiedy kodowanie zajmowało mi całe dnie robiłem to dawno temu jeszcze na tabelach. Kilka lat przerwy i uczę się na nowo :)

.moduletable:first-childHA!! a to szmery bajery :D