Μετάβαση στο περιεχόμενο

Πρότυπα και μπλοκ

Ο Publisher παρέχει προσαρμόσιμα πρότυπα για την εμφάνιση άρθρων και μπλοκ για ενσωμάτωση sidebar/widget. Αυτός ο οδηγός καλύπτει την προσαρμογή προτύπου και τη διαμόρφωση μπλοκ.

ΠρότυποΣκοπός
publisher_index.tplΑρχική σελίδα ενότητας
publisher_item.tplΠροβολή ενός άρθρου
publisher_category.tplΚαταχώριση κατηγορίας
publisher_archive.tplΣελίδα αρχείου
publisher_search.tplΑποτελέσματα αναζήτησης
publisher_submit.tplΈντυπο υποβολής άρθρου
publisher_print.tplΠροβολή φιλική προς την εκτύπωση
ΠρότυποΣκοπός
publisher_block_latest.tplΤελευταία άρθρα μπλοκ
publisher_block_spotlight.tplΜπλοκ επιλεγμένων άρθρων
publisher_block_category.tplΜπλοκ λίστας κατηγοριών
publisher_block_author.tplΜπλοκ άρθρων συγγραφέα
{* Available in publisher_item.tpl *}
<{$item.title}> {* Article title *}
<{$item.body}> {* Full content *}
<{$item.summary}> {* Summary/excerpt *}
<{$item.author}> {* Author name *}
<{$item.authorid}> {* Author user ID *}
<{$item.datesub}> {* Publication date *}
<{$item.datemodified}> {* Last modified date *}
<{$item.counter}> {* View count *}
<{$item.rating}> {* Average rating *}
<{$item.votes}> {* Number of votes *}
<{$item.categoryname}> {* Category name *}
<{$item.categorylink}> {* Category URL *}
<{$item.itemurl}> {* Article URL *}
<{$item.image}> {* Featured image *}
{* Available in publisher_category.tpl *}
<{$category.name}> {* Category name *}
<{$category.description}> {* Category description *}
<{$category.image}> {* Category image *}
<{$category.total}> {* Article count *}
<{$category.link}> {* Category URL *}

Αντιγράψτε πρότυπα στο θέμα σας για προσαρμογή:

themes/mytheme/modules/publisher/
├── publisher_index.tpl
├── publisher_item.tpl
└── blocks/
└── publisher_block_latest.tpl

# Παράδειγμα: Προσαρμοσμένο πρότυπο άρθρου

Ενότητα με τίτλο «# Παράδειγμα: Προσαρμοσμένο πρότυπο άρθρου»
{* themes/mytheme/modules/publisher/publisher_item.tpl *}
<article class="publisher-article">
<header>
<h1><{$item.title}></h1>
<div class="meta">
<span class="author">By <{$item.author}></span>
<span class="date"><{$item.datesub}></span>
<span class="category">
<a href="<{$item.categorylink}>"><{$item.categoryname}></a>
</span>
</div>
</header>
<{if $item.image}>
<figure class="featured-image">
<img src="<{$item.image}>" alt="<{$item.title}>">
</figure>
<{/if}>
<div class="content">
<{$item.body}>
</div>
<footer>
<{if $item.who_when}>
<p class="attribution"><{$item.who_when}></p>
<{/if}>
<div class="actions">
<{if $can_edit}>
<a href="<{$xoops_url}>/modules/publisher/submit.php?itemid=<{$item.itemid}>">
Edit Article
</a>
<{/if}>
<a href="<{$item.printlink}>" target="_blank">Print</a>
<a href="<{$item.maillink}>">Email</a>
</div>
</footer>
</article>
ΜπλοκΠεριγραφή
Τελευταία ΝέαΕμφανίζει πρόσφατα άρθρα
Φώτα της δημοσιότηταςΕπιλεγμένο άρθρο
Μενού κατηγορίαςΠλοήγηση κατηγορίας
ΑρχείαΣύνδεσμοι αρχείου
Κορυφαίοι ΣυγγραφείςΟι πιο ενεργοί συγγραφείς
Δημοφιλή είδηΆρθρα με τις περισσότερες προβολές
ΕπιλογήΠεριγραφή
Στοιχεία προς εμφάνισηΑριθμός άρθρων
Φίλτρο κατηγορίαςΌριο σε συγκεκριμένες κατηγορίες
Εμφάνιση περίληψηςΕμφάνιση αποσπάσματος άρθρου
Μήκος τίτλουΠερικοπή τίτλων
ΠρότυποΑποκλεισμός αρχείου προτύπου
{* themes/mytheme/modules/publisher/blocks/publisher_block_latest.tpl *}
<div class="publisher-latest-block">
<{foreach item=item from=$block.items}>
<article class="block-item">
<h4>
<a href="<{$item.link}>"><{$item.title}></a>
</h4>
<{if $block.show_summary}>
<p><{$item.summary}></p>
<{/if}>
<div class="block-meta">
<span class="date"><{$item.date}></span>
<span class="views"><{$item.counter}> views</span>
</div>
</article>
<{/foreach}>
</div>
{* Show different content for different users *}
<{if $xoops_isadmin}>
<a href="admin/item.php?op=edit&itemid=<{$item.itemid}>">Admin Edit</a>
<{elseif $item.uid == $xoops_userid}>
<a href="submit.php?itemid=<{$item.itemid}>">Edit Your Article</a>
<{/if}>
{* Add status-based styling *}
<article class="article <{$item.status}>">
{* Content *}
</article>
{* Format dates with Smarty *}
<time datetime="<{$item.datesub|date_format:'%Y-%m-%d'}>">
<{$item.datesub|date_format:$xoops_config.dateformat}>
</time>
  • ../User-Guide/Basic-Configuration - Ρυθμίσεις μονάδας
  • ../User-Guide/Creating-Articles - Διαχείριση περιεχομένου
  • ../../04-API-Reference/Template/Template-System - XOOPS κινητήρας προτύπου
  • ../../02-Core-Concepts/Themes/Theme-Development - Προσαρμογή θέματος