ホーム
>>
RSSセンター
>>
Using templates pages in modules
RSSセンター
メイン | 簡易ヘッドライン |
Using templates pages in modules (2013/1/12 1:30:00)
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 by
then line 85 by
(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 :
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?
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" ,
"paste,fullscreen,visualchars,nonbreaking,inlinepopups,template" ,
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 :
// java_script 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?
execution time : 0.107 sec