Fork me on GitHub



Make donations with PayPal!
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00

Learn XOOPS Core

Local Support


XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2.5 2.6 4 6 2013 Abuse admin Android AntiHarvesting AntiSpam API Apple Battlefield Blocks Bootstrap Captcha cell chronolabs Clicks Cloud content CĂN demo download Dresses facebook Fat for free Gateway giải Google Guide herre Home Honeypot html5 Human HỘ IP iPhone jQuery Language Law Legal List Loss mobile module modules Monster new newbb news nhiệt NHÀ online PARK Payment phone PHP Prevention profile project Protector publisher RESIDENCE responsive review Rights rmcommon Room security Sentry Signed Signup site Smartphone Smarty Smoking Solution Spam Studio tag tags tdmcreate The Theme themes User userlog web weight Wishcraft xoops Xortify XPayment

New Users

Registering user

# 138484


Welcome to XOOPS!


News archives

Using templates pages in modules

Posted by alain01 on 2013/1/10 11:30:00 (7541 reads) | Posted on Tutorials

A lot of people using XOOPS, need to use templates for presenting homogeneous pages :

- cooking,
- some books,
- some movies,
- ...

I would show you how to use a template to generate your pages :


- Same template for all pages
- Homogeneous and more clear presentation
- Using of pre-defiined pages

Creating a Template (gabarits) in 6 steps:

1 - TinyMCE editor activation for modules
2 - Add the template botton
3 - Create template files
4 - Create a definition file for templates
5 - upload files on server
6 - Use

1 - TinyMCE editor activation for modules (See this editor in demo here)
Administration / Preferences / systeme Module Settings / Editor Settings / Editor for all modules: : tinymce
(or choose TinyMCE for default editor for the module that you will use, in module preferences)

2 - Add the template button

Modify the file /class/xoopseditor/tinymce/settings.php:

Line 70, change

then line 85
"theme_advanced_buttons4" => "xoopsimagemanager,xoopsemotions,xoopsquote,xoopscode,xoopsmlcontent",
"theme_advanced_buttons4" => "xoopsimagemanager,xoopsemotions,xoopsquote,xoopscode,xoopsmlcontent,template",
"template_external_list_url" => '/uploads/gabarits/liste-gabarits.js',

(Here it is for indicate that templates are in the directory /uploads/gabarits and definition's file of the template is liste-gabarits.js

3 - Create template files

Theses files must be in html format, but without < html >, < body > or <head >
Here, we create 2 html files:

- fiche-cooking.html,
- fiche-book.html.

Please, make a clean html file, with fixed positions...
For example, for the template 'cooking' :
Title of the cooking :
Ingredients :
Difficulty to make :

4 - Create the definition's file of the template

Here, create the file liste-gabarits.js :
// JavaScript Document 

var tinyMCETemplateList = [ 

// Nom, URL, Description 

["Fiche cuisine""/_uploads/gabarits/fiche-cooking.html""Template for the cooking."], 

"Fiche Livre""/_uploads/gabarits/fiche-book.html""Template for books."] ];

5 - upload files on server

On /uploads/gabarits, uploads files :

- liste-gabarits.js
- fiche-cooking.html,
- fiche-book.html.
- index.htlm ( same as in another directory)

6 - Use

Go to module (news for example), then click on the "template" icon then, in the opening window, select the template that you want to use (fiche-cooking for create a page for "Apple cake", for example)

Thats' all !

It is nice ?

Let me know what you think. I will appreciate your comments !

PS 1 : Big thanks to montuy337513 for the support in the XOOPS France Forum.

PS 2 : it would be nice to have this option available by default in the next XOOPS version, wouldn't it?

Printer friendly page Send this story to a friend Create a PDF from the article
Bookmark Me
Bookmark to Google Plus
The comments are owned by the author. We aren't responsible for their content.

Thanks alain01, great job!

I think you have to replace :

// JavaScript Document 

var tinyMCETemplateList = [  

// Nom, URL, Description 

["Fiche cuisine""/_uplods/gabarits/fiche-cooking.html""Template for the cooking."], 

"Fiche Livre""_uplods/gabarits/fiche-book.html""Template for books."] ];

with :

// JavaScript Document 

var tinyMCETemplateList = [  

// Nom, URL, Description 

["Fiche cuisine""/_uploads/gabarits/fiche-cooking.html""Template for the cooking."], 

"Fiche Livre""_uploads/gabarits/fiche-book.html""Template for books."] ];

Published: 2013/1/10 15:10 • Updated: 2013/1/10 15:10
Please, modify the news here :

// JavaScript Document
var tinyMCETemplateList = [

// Nom, URL, Description
["Fiche cuisine", "/_uploads/gabarits/fiche-cooking.html", "Template for the cooking."],

["Fiche Livre", "/_uploads/gabarits/fiche-book.html", "Template for books."] ];

Published: 2013/1/10 17:19 • Updated: 2013/1/10 21:07
Nice tutorial, must be corrected and moved to Wiki for localization...
Published: 2013/1/12 8:22 • Updated: 2013/1/12 8:22