') ') Fork me on GitHub

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $10.00
Net Balance: $9.41
Left to go: $90.59

Donations
Dante7237  ($10)Dec-3

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

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

New Users

Registering user

# 137911

mydarkglobe

Welcome to XOOPS!

Archives

News Archives

Using templates pages in modules

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

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 :

Advantages:

- 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
"paste,fullscreen,visualchars,nonbreaking,inlinepopups",
by
"paste,fullscreen,visualchars,nonbreaking,inlinepopups,template",

then line 85
"theme_advanced_buttons4" => "xoopsimagemanager,xoopsemotions,xoopsquote,xoopscode,xoopsmlcontent",
by
"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?


Tags: template   editor   TinyMCE  
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 :

Quote:
// 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