Thêm position vào template joomla 3.x

Để nhìn thấy các position của module trong template joomla 3.x, đăng nhập vào admin, chọn Extensions-> Template Manager-> Options-> Templates-> Preview Module Positions, chose Enabled. Sau đó ra ngoài front-end, thêm ?tp=1 vào cuối đường dẫn trang web của bạn, ví dụ: example/joomla_test?tp=1, bạn sẽ thấy position của template:

create-module-position-joomla.png

Bây giờ ta sẽ tạo một module position cho template. Minh sử dụng protostar làm ví dụ
Bước 1: Mở file templateDetails.xml tại đường dẫn: yoursite/joomla_test/templates/protostar/templateDetails.xml , tìm tới dòng 27 to 46:
HTML:
[/FONT][/COLOR]
<positions>

        <position>banner</position>

        ...................................

        <position>footer</position>

</positions>[COLOR=#333333][FONT=Noto Serif]
Thêm dòng code này vào giữa code bên trên:
HTML:
[/FONT][/COLOR]
<position>new-position</position>[COLOR=#333333][FONT=Noto Serif]
Thay new-position bằng tên bạn muốn.
Bước 2: Mở file index.php itại đường dẫn: yoursite/joomla_test/templates/protostar/index.php , thêm dòng này:
HTML:
[/FONT][/COLOR]
<jdoc:include type="modules" name="new-position" style="none" />[COLOR=#333333][FONT=Noto Serif]
vào vùng mà bạn muốn đặt position, ví dụ tôi sẽ đặt vào vùng main-content
HTML:
[/FONT][/COLOR]
<main id="content" role="main" class="<?php echo $span; ?>">
<!-- Begin Content -->
<jdoc:include type="modules" name="position-3" style="xhtml" />
........................
<jdoc:include type="modules" name="position-2" style="none" />
<jdoc:include type="modules" name="new-position" style="none" />//position create
<!-- End Content --> </main>[COLOR=#333333][FONT=Noto Serif]
và thế là chúng ta đã tạo thành công một position mới
create-module-position-joomla2.png
 

Bài viết đang hot

Thống kê

Chủ đề
102,786
Bài viết
470,606
Thành viên
340,592
Thành viên mới nhất
NDHU
Top