Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
News World of XOOPS Developers Hacks Modules Themes YAXS Archive Submit News

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $65.00
Net Balance: $61.80
Left to go: $38.20

Donations
studioC  ($25)May-17
Anonymous ($15)May-16
Anonymous ($25)May-4

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

2 2.5 2.6 3.0 87 2013 Abuse admin Amazon AntiHarvesting AntiMalUser AntiSpam API Beats billige black Blocks blue Captcha capture Casual cell Checksum Christmas chronolabs content Conversion Debauchosity demo docek download Dresses EC2 editor evden eve facebook floor free herre Honeypot Human IP jQuery kantor klubovi lamps log logger Marquee mobile module modules Monster MyAlbum-p newbb news newsletter online PageRank Password Permissions pink Plugin portal Prevention profile project propose Protector Protocols publisher Rights rmcommon Room sale security Server site SmartClone Smarty Songlist Spam stem Studio tag tags tdmcreate Theme themes upgrade userlog website Whitepaper WSDL XIPS xoops Xortify XPayment ZendFramework

New Users

Registering user

# 136033

Arizamartin

Welcome to XOOPS!

Archives

News Archives

Using templates pages in modules

Posted by alain01 on 2013/1/10 11:30:00 (2459 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: editor   template   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