XOOPS CMS · Smarty3 Plugin

xtaggen

Universal Content Tag Generator

Pull content from any module in your XOOPS site with a single Smarty tag into any theme template. Zero PHP knowledge, maximum flexibility.

{* Most downloaded 10 items *} <{xtaggen module="tdmdownloads" limit="10" sort="POPULAR" template="download_list"}> {* 5 random articles — sidebar widget *} <{xtaggen module="publisher" limit="5" sort="RAND" template="widget"}>
All Modules Auto Table Detection 6 Sorting Modes Admin Panel Smarty3 Compatible Debug Mode
explore

01 · WHAT IS IT

Single tag,
endless content.

xtaggen is a Smarty3 function plugin written to pull database content from any installed module in XOOPS CMS directly into theme template files (.tpl).

🔌
Universal Compatibility
Dedicated handlers for recognized modules like news, publisher, xcreate; automatic generic handler for all others. No module is left out.
🧠
Smart Table Detection
Automatically detects module database tables via information_schema. Extracts main content table, column map, and URL structure on its own.
Zero Configuration
To test a module, just write module="directory_name". xtaggen handles the rest.
🎛️
Full Admin Control
Limit, sorting, template, and status settings for each module are configured from the admin panel. Tag code is auto-generated, template variables are listed.
🗄️
Access All Columns
Along with standard alias variables ($item.title), any non-matching column is also available in the template as $item.COLUMN_NAME and $item.raw_COLUMN.
🐛
Debug Mode
Using the debug parameter outputs the selected table, column list, alias map, and executed SQL query as HTML comments on the page.

02 · HOW IT WORKS

Data flow in
4 steps.

When the tag runs during Smarty template rendering, the following process happens in the background:

01
Module Detection
The module parameter is read. Checks if the module directory exists in XOOPS. Compares against the list of dedicated handlers.
02
Table & Column Analysis
For generic modules, lists tables via information_schema, selects the main table, extracts columns, and creates an alias map.
03
SQL & Sorting
Creates ORDER BY clause based on sort mode (RAND(), alias column, title column, etc.) and fetches data.
04
Smarty Assign & Render
For each record, standard aliases, non-aliased columns, and raw_ prefixed raw values are assigned to Smarty as an array, and the template is rendered.

Handler System

📰
news
⭐ DEDICATED HANDLER
Optimized handler for the standard XOOPS News module. Includes topic filter, hit counter, and author information.
$item.title$item.body $item.published$item.counter $item.author$item.imgurl $item.topic_title
📄
publisher
⭐ DEDICATED HANDLER
Advanced content module. Comes with category filter, SEO slug URLs, subtitle, and full category data.
$item.title$item.subtitle $item.url$item.cat_title $item.cat_url$item.image_url
xcreate
⭐ DEDICATED HANDLER
Custom fields content module. Supports cat slug filter, item slug URL, and built-in xcreate plugin integration.
$item.title$item.description $item.url$item.cat_name $item.hits$item.created
♾️
All Other Modules
∞ GENERIC HANDLER
tdmdownloads, mylinks, wfsection, and all other installed modules. Table detection + column map are automatically created. All columns are accessible.
$item.ALIAS$item.COLUMN_NAME $item.raw_COLUMN$item.url $item.date$item.author

03 · USAGE

Paste into theme template,
it just works.

Write the tag anywhere in your .tpl file. The template file is searched for in the theme directory or module directory.

themes/YOUR_THEME/templates/news.tpl
{* Fetch last 5 news articles *} <{xtaggen module="news" limit="5" sort="DESC" template="news"}> {* Most downloaded 10 items *} <{xtaggen module="tdmdownloads" limit="10" sort="POPULAR" template="downloads"}> {* 4 random items — different on each load *} <{xtaggen module="publisher" limit="4" sort="RAND" template="featured"}> {* Alphabetical articles from category 2 *} <{xtaggen module="publisher" limit="8" category="2" sort="ALPHA" template="cat_list"}> {* Debug mode — table + SQL written as HTML comment *} <{xtaggen module="mylinks" limit="5" template="links" debug}>
themes/YOUR_THEME/templates/news.tpl — Template Content
{foreach item="item" from=$xtaggen_items} <div class="news-card"> {if $item.imgurl} <img src="{$item.imgurl}" alt="{$item.title|escape}"> {/if} <h3><a href="{$item.url}">{$item.title}</a></h3> <p class="meta">{$item.published_short} · {$item.author}</p> <p>{$item.body_short}</p> <span class="views">👁 {$item.counter}</span> </div> {/foreach} <p>Total {$xtaggen_count} news items</p>
Template search order: xtaggen searches for the template file in this order: /themes/YOUR_THEME/templates/TEMPLATE.tpl/modules/MODULE/templates/TEMPLATE.tpl/modules/xtaggen/templates/TEMPLATE.tpl/themes/YOUR_THEME/templates/xtaggen_default.tpl

04 · PARAMETERS

A parameter
for every need.

All parameters you can use inside the tag. Only module is required.

Parameter Default Description
modulerequired XOOPS module directory name. Must exactly match the folder name under /modules/. Example: "tdmdownloads", "news", "wfsection"
limitoptional 10 Number of records to fetch. Minimum 1.
fromoptional 0 Starting record offset. Used as SQL OFFSET. Useful for manual pagination.
orderoptional auto ORDER BY column. If left blank, automatically selects date → ID → first column. Ignored when sort="RAND", "POPULAR", or "ALPHA" is used.
sortoptional DESC Sorting mode. Valid values: DESC · ASC · RAND · POPULAR · ALPHA · ALPHA_DESC
templateoptional MODULE_list Name of the Smarty template file to use (without extension). Example: "news" → searches for news.tpl
categoryoptional Filter by category ID. Works with publisher, xcreate, and generic modules that have a category_id column.
statusoptional 1 Status filter. Valid for publisher and xcreate. 0 for drafts, 1 for published content.
topic_idoptional Only for the news module. Filters news articles belonging to a specific topic.
cat_slugoptional Only for the xcreate module. Filter by category slug instead of ID.
debugoptional Takes no value, just including it is enough. Outputs table name, column list, alias map, and SQL query as HTML comments. Do not use on live sites.

05 · SORTING MODES

6 different
sorting modes.

Use the sort parameter to fetch content in any order you want. The order parameter is ignored in POPULAR and ALPHA modes.

DESC
Newest to Oldest
Default mode. Sorts in descending order by the order column. Typically for latest content.
ASC
Oldest to Newest
Ascending order by the order column. Chronological order or smallest to largest ID.
RAND
Random
Different content on each page load. SQL ORDER BY RAND(). Ideal for featured content widgets.
POPULAR
Most Viewed
Automatically detects the counter, hits, views, or downloads column in the table and sorts in descending order.
ALPHA
A → Z Alphabetical
Ascending alphabetical order by title/name column. For directories, glossaries, and list pages.
ALPHA_DESC
Z → A Reverse Alphabetical
Descending alphabetical order by title column. When reverse alphabetical listing is needed.

06 · TEMPLATE VARIABLES

Three ways
to access data.

The generic handler creates a three-layer array for each record. Aliases always take precedence.

⬡ STANDARD ALIAS VARIABLES — All generic modules
📦 Array Variables
foreach loop and counter
$xtaggen_items
Array of all records — iterate with foreach
$xtaggen_count
Total number of returned records
🏷️ Basic Fields
Columns matched via the alias system
$item.id
Record ID (from storyid, itemid, lid, etc. column)
$item.title
Title — escaped with htmlspecialchars
$item.body
Full content — raw HTML included
$item.body_short
Summary trimmed to 200 characters, HTML tags stripped
$item.url
Auto-generated content detail URL (SEO URL if slug exists)
$item.slug
URL short name (SEO slug)
📅 Date
Formatted and raw date
$item.date
Date — long format (XOOPS formatTimestamp)
$item.date_short
Date — short format
$item.date_raw
Unix timestamp — for custom formatting
👤 Author
Automatically resolved from uid column
$item.uid
Author user ID
$item.author
Author username (resolved from users table)
$item.author_link
Author profile URL
🖼️ Image & Other
$item.image
Image filename
$item.image_url
Full image URL (/uploads/MODULE/FILENAME)
$item.counter
View / click / download count
$item.cat_id
Category ID
$item.weight
Sorting weight / priority
$item.status
Publication status (0/1 or module-specific value)
Non-aliased columns: If any column in the module table doesn't match an alias, it's directly accessible as $item.COLUMN_NAME (sanitized). For example, xaf9_tdmdownloads_filesize column → accessible via {$item.xaf9_tdmdownloads_filesize}.
Raw access: Every column is always accessible in the format $item.raw_COLUMN_NAME. Whether aliased or not: {$item.raw_published_date}, {$item.raw_downloads}, etc.

07 · ADMIN PANEL

Everything
on one screen.

Clicking on the xtaggen module in the XOOPS administration panel opens a 5-page full control center.

🏠 Overview admin/index.php
  • Statistics on number of installed modules
  • Dedicated / generic handler distribution
  • Active / unconfigured modules
  • Quick start steps
⚙️ Module Settings admin/modules.php
  • Limit, sorting, template settings for each module
  • Active / passive toggle
  • Saved configurations written to database
  • Category and status filters
🏷️ Tag Generator admin/tags.php
  • Ready-to-copy Smarty tag code for each module
  • All template variables — aliased, direct, and raw_
  • Column map tab
  • Auto-generated sample template code
🔌 Plugin Install admin/install.php
  • Copies the function.xtaggen.php file to the correct location
  • Smarty3 plugin directory auto-detected
  • Installation status check
📖 Guide admin/help.php
  • All parameters and sort modes
  • Module-specific copyable examples
  • Template variables reference
  • Copy button on every code block

08 · INSTALLATION

Ready in
5 minutes.

XOOPS module installation and plugin activation are two separate steps. Both must be completed.

1
Upload the Module Folder
Copy the xtaggen/ folder to the /modules/ directory of your XOOPS installation.
Directory structure
/modules/ └── xtaggen/ ├── admin/ ├── class/ ├── plugins/ │ └── function.xtaggen.php ├── templates/ └── xoops_version.php
2
Install the Module in XOOPS
Go to XOOPS Admin → System → Modules page. Find the xtaggen module in the list and click the install button. SQL tables will be created automatically.
3
Install the Smarty Plugin
Go to xtaggen Admin → Plugin Install page. Click the button to copy the function.xtaggen.php file to the Smarty3 plugin directory.
Manual installation: Copy to /class/smarty3_plugins/function.xtaggen.php.
4
Create a Template File
Create a .tpl file in your theme directory. You can paste the automatically generated sample template code from the Tag Generator page.
Example location
/themes/YOUR_THEME/templates/news.tpl
5
Add the Tag to Your Theme
Write the xtaggen tag in any theme template file (index.tpl, header.tpl, etc.). That's all.
Example usage
<{xtaggen module="news" limit="5" sort="DESC" template="news"}>
⚠️ Update notice: When updating the module, don't forget to also update the function.xtaggen.php file in the /class/smarty3_plugins/ directory. The Plugin Install page in the admin panel does this automatically.