FAQ theme
theme Pertanyaan yang Sering Diajukan
Section titled “theme Pertanyaan yang Sering Diajukan”Pertanyaan dan jawaban umum tentang theme, penyesuaian, dan manajemen XOOPS.
Instalasi & Aktivasi theme
Section titled “Instalasi & Aktivasi theme”Q: Bagaimana cara menginstal theme baru di XOOPS?
Section titled “Q: Bagaimana cara menginstal theme baru di XOOPS?”J:
- Unduh file zip theme
- Buka Admin XOOPS > Tampilan > theme
- Klik “Unggah” dan pilih file zip
- theme muncul di daftar theme
- Klik untuk mengaktifkannya untuk situs Anda
Alternatif: Ekstrak secara manual ke direktori /themes/ dan segarkan panel admin.
T: Unggahan theme gagal dengan “Izin ditolak”
Section titled “T: Unggahan theme gagal dengan “Izin ditolak””A: Memperbaiki izin direktori theme:
# Make themes directory writablechmod 755 /path/to/xoops/themes
# Fix uploads if uploadingchmod 777 /path/to/xoops/uploads
# Fix ownership if neededchown -R www-data:www-data /path/to/xoops/themesT: Bagaimana cara menetapkan theme berbeda untuk pengguna tertentu?
Section titled “T: Bagaimana cara menetapkan theme berbeda untuk pengguna tertentu?”J:
- Buka Manajer Pengguna > Edit Pengguna
- Buka tab “Lainnya”.
- Pilih theme yang disukai di dropdown “theme Pengguna”.
- Simpan
theme yang dipilih pengguna menggantikan theme situs default.
T: Bisakah saya memiliki theme berbeda untuk situs admin dan pengguna?
Section titled “T: Bisakah saya memiliki theme berbeda untuk situs admin dan pengguna?”A: Ya, atur di XOOPS Admin > Pengaturan:
- theme front-end - theme situs default
- theme Admin - theme panel kontrol Admin (biasanya terpisah)
Cari pengaturan seperti:
theme_set- theme bagian depanadmin_theme- theme admin
Kustomisasi theme
Section titled “Kustomisasi theme”T: Bagaimana cara menyesuaikan theme yang sudah ada?
Section titled “T: Bagaimana cara menyesuaikan theme yang sudah ada?”A: Buat theme anak untuk mempertahankan pembaruan:
themes/├── original_theme/│ ├── style.css│ ├── templates/│ └── images/└── custom_theme/ {* Create copy for editing *} ├── style.css ├── templates/ └── images/Kemudian edit theme.html di theme khusus Anda.
T: Bagaimana cara mengubah warna theme?
Section titled “T: Bagaimana cara mengubah warna theme?”A: Edit file CSS theme:
# Locate theme CSSthemes/mytheme/style.css
# Or theme templatethemes/mytheme/theme.htmlUntuk theme XOOPS:
:root { --primary-color: #2c3e50; --secondary-color: #3498db; --accent-color: #e74c3c;}
body { background-color: var(--primary-color); color: #333;}
a { color: var(--secondary-color);}
.button { background-color: var(--accent-color);}T: Bagaimana cara menambahkan CSS khusus ke theme?
Section titled “T: Bagaimana cara menambahkan CSS khusus ke theme?”J: Beberapa pilihan:
Opsi 1: Edit theme.html
<head> {* Existing CSS *} <link rel="stylesheet" href="{$xoops_url}/themes/{$xoops_theme}/custom.css"></head>Opsi 2: Buat custom.css
# Create filethemes/mytheme/custom.css
# Add your stylesbody { background: #fff; }Opsi 3: Pengaturan Admin (jika didukung) Buka XOOPS Admin > Pengaturan > Pengaturan theme dan tambahkan CSS khusus.
T: Bagaimana cara memodifikasi template theme HTML?
Section titled “T: Bagaimana cara memodifikasi template theme HTML?”A: Temukan file template:
# List theme templatesls -la themes/mytheme/templates/
# Common templatesthemes/mytheme/templates/theme.html {* Main layout *}themes/mytheme/templates/header.html {* Header *}themes/mytheme/templates/footer.html {* Footer *}themes/mytheme/templates/sidebar.html {* Sidebar *}Edit dengan sintaks Smarty yang tepat:
{* XOOPS Theme Template *}<!DOCTYPE html><html><head> <meta charset="{$xoops_charset}"> <title>{$xoops_pagetitle}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="{$xoops_url}/themes/{$xoops_theme}/style.css"></head><body> <header> {include file="file:header.html"} </header>
<main> <div class="container"> <div class="row"> <div class="col-md-9"> {$xoops_contents} </div> <aside class="col-md-3"> {include file="file:sidebar.html"} </aside> </div> </div> </main>
<footer> {include file="file:footer.html"} </footer></body></html>Struktur theme
Section titled “Struktur theme”Q: File apa saja yang diperlukan dalam sebuah theme?
Section titled “Q: File apa saja yang diperlukan dalam sebuah theme?”J: Struktur minimum:
themes/mytheme/├── theme.html {* Main template (required) *}├── style.css {* Stylesheet (optional but recommended) *}├── screenshot.png {* Preview image for admin (optional) *}├── images/ {* Theme images *}│ └── logo.png└── templates/ {* Optional: Additional templates *} ├── header.html ├── footer.html └── sidebar.htmlLihat Struktur theme untuk detailnya.
T: Bagaimana cara membuat theme dari awal?
Section titled “T: Bagaimana cara membuat theme dari awal?”A: Buat struktur:
mkdir -p themes/mytheme/imagescd themes/mythemeBuat theme.html:
<!DOCTYPE html><html><head> <meta charset="{$xoops_charset}"> <title>{$xoops_pagetitle}</title> <link rel="stylesheet" href="{$xoops_url}/themes/{$xoops_theme}/style.css"></head><body> <header>{$xoops_headers}</header> <main>{$xoops_contents}</main> <footer>{$xoops_footers}</footer></body></html>Buat style.css:
* { margin: 0; padding: 0; }body { font-family: Arial, sans-serif; }header { background: #333; color: #fff; padding: 20px; }main { padding: 20px; }footer { background: #f5f5f5; padding: 20px; border-top: 1px solid #ddd; }Variabel theme
Section titled “Variabel theme”Q: Variabel apa saja yang tersedia di template theme?
Section titled “Q: Variabel apa saja yang tersedia di template theme?”A: Variabel theme XOOPS yang umum:
{* Site Information *}{$xoops_sitename} {* Site name *}{$xoops_url} {* Site URL *}{$xoops_theme} {* Current theme name *}
{* Page Content *}{$xoops_contents} {* Main page content *}{$xoops_pagetitle} {* Page title *}{$xoops_headers} {* Meta tags, styles in head *}
{* Module Information *}{$xoops_module_header} {* Module-specific header *}{$xoops_moduledesc} {* Module description *}
{* User Information *}{$xoops_isuser} {* Is user logged in? *}{$xoops_userid} {* User ID *}{$xoops_uname} {* Username *}
{* Blocks *}{$xoops_blocks} {* All block content *}
{* Other *}{$xoops_charset} {* Document charset *}{$xoops_version} {* XOOPS version *}T: Bagaimana cara menambahkan variabel khusus ke theme saya?
Section titled “T: Bagaimana cara menambahkan variabel khusus ke theme saya?”A: Dalam kode PHP Anda sebelum rendering:
<?php// In module or admin coderequire_once XOOPS_ROOT_PATH . '/class/xoopstpl.php';$xoopsTpl = new XoopsTpl();
// Add custom variables$xoopsTpl->assign('my_variable', 'value');$xoopsTpl->assign('data_array', ['key1' => 'val1', 'key2' => 'val2']);
// Use in theme template$xoopsTpl->display('file:theme.html');?>Dalam theme:
<p>{$my_variable}</p><p>{$data_array.key1}</p>Penataan theme
Section titled “Penataan theme”T: Bagaimana cara membuat theme saya responsif?
Section titled “T: Bagaimana cara membuat theme saya responsif?”A: Gunakan CSS Grid atau Flexbox:
/* Mobile first approach */body { font-size: 14px;}
.container { display: grid; grid-template-columns: 1fr; gap: 20px;}
main { order: 2;}
aside { order: 3;}
/* Tablet and up */@media (min-width: 768px) { .container { grid-template-columns: 2fr 1fr; }}
/* Desktop and up */@media (min-width: 1200px) { .container { grid-template-columns: 3fr 1fr; }}Atau gunakan integrasi Bootstrap:
<head> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" rel="stylesheet"></head>
<div class="container"> <div class="row"> <div class="col-md-9">{$xoops_contents}</div> <div class="col-md-3">{* Sidebar *}</div> </div></div>T: Bagaimana cara menambahkan mode gelap ke theme saya?
Section titled “T: Bagaimana cara menambahkan mode gelap ke theme saya?”J:
/* Light mode (default) */:root { --bg-color: #ffffff; --text-color: #000000; --border-color: #cccccc;}
body { background-color: var(--bg-color); color: var(--text-color); transition: background-color 0.3s, color 0.3s;}
/* Dark mode */@media (prefers-color-scheme: dark) { :root { --bg-color: #1a1a1a; --text-color: #ffffff; --border-color: #444444; }}
/* Or with CSS class */body.dark-mode { --bg-color: #1a1a1a; --text-color: #ffffff; --border-color: #444444;}Beralih dengan JavaScript:
<script>document.getElementById('dark-mode-toggle').addEventListener('click', function() { document.body.classList.toggle('dark-mode'); localStorage.setItem('darkMode', document.body.classList.contains('dark-mode'));});
// Load preferenceif (localStorage.getItem('darkMode') === 'true') { document.body.classList.add('dark-mode');}</script>Masalah theme
Section titled “Masalah theme”T: theme menampilkan kesalahan “variabel template tidak dikenal”.
Section titled “T: theme menampilkan kesalahan “variabel template tidak dikenal”.”A: Variabel tidak diteruskan ke template. Periksa:
- Variabel ditetapkan di PHP:
<?php$xoopsTpl->assign('variable_name', $value);?>- template ada jika ditentukan
- Sintaks template sudah benar:
{* Correct *}{$variable_name}
{* Wrong *}$variable_name{variable_name}Q: Perubahan CSS tidak muncul di browser
Section titled “Q: Perubahan CSS tidak muncul di browser”A: Hapus cache browser:
- Penyegaran keras:
Ctrl+Shift+R(Cmd+Shift+R di Mac) - Hapus cache theme di server:
rm -rf xoops_data/caches/smarty_cache/themes/*rm -rf xoops_data/caches/smarty_compile/themes/*- Periksa jalur file CSS di theme:
ls -la themes/mytheme/style.cssQ: Gambar dalam theme tidak dimuat
Section titled “Q: Gambar dalam theme tidak dimuat”A: Periksa jalur gambar:
{* WRONG - relative path from web root *}<img src="themes/mytheme/images/logo.png">
{* CORRECT - use xoops_url *}<img src="{$xoops_url}/themes/{$xoops_theme}/images/logo.png">
{* Or in CSS *}background-image: url('{$xoops_url}/themes/{$xoops_theme}/images/bg.png');T: template theme hilang atau menyebabkan kesalahan
Section titled “T: template theme hilang atau menyebabkan kesalahan”A: Lihat Kesalahan template untuk proses debug.
Distribusi theme
Section titled “Distribusi theme”T: Bagaimana cara mengemas theme untuk didistribusikan?
Section titled “T: Bagaimana cara mengemas theme untuk didistribusikan?”A: Membuat zip yang dapat didistribusikan:
# Structuremytheme/├── theme.html {* Required *}├── style.css├── screenshot.png {* 300x225 recommended *}├── README.txt├── LICENSE├── images/│ ├── logo.png│ └── favicon.ico└── templates/ {* Optional *} ├── header.html └── footer.html
# Create zipzip -r mytheme.zip mytheme/T: Bisakah saya menjual theme XOOPS saya?A: Periksa lisensi XOOPS:
Section titled “T: Bisakah saya menjual theme XOOPS saya?A: Periksa lisensi XOOPS:”- theme yang menggunakan XOOPS classes/templates harus menghormati lisensi XOOPS
- theme CSS/HTML murni memiliki batasan lebih sedikit
- Periksa Pedoman Kontribusi XOOPS untuk detailnya
Performa theme
Section titled “Performa theme”T: Bagaimana cara mengoptimalkan kinerja theme?
Section titled “T: Bagaimana cara mengoptimalkan kinerja theme?”J:
- Minimalkan CSS/JS - Hapus kode yang tidak digunakan
- Optimalkan gambar - Gunakan format yang tepat (WebP, AVIF)
- Gunakan CDN untuk sumber daya
- Pemuatan lambat gambar:
<img src="image.jpg" loading="lazy">- Versi penghancur cache:
<link rel="stylesheet" href="{$xoops_url}/themes/{$xoops_theme}/style.css?v={$xoops_version}">Lihat FAQ Kinerja untuk lebih jelasnya.
Dokumentasi Terkait
Section titled “Dokumentasi Terkait”- Kesalahan template
- Struktur theme
- FAQ Kinerja
- Proses Debug Smarty
#xoops #theme #faq #pemecahan masalah #penyesuaian