Widgets
NAME
widgets - Describe implementation of widgets within Extenso
DESCRIPTION
Widget are based on the following tables:
- sn_widgets : contains widgets definitions
- sn_widgets_categories : defined widget categories
- sn_widgets_list : define widget implementation in the pages of the site
For each widget, a table for the content might be connected in the sn_widgets table.
Widgets are usually put in 2 places:
- /modules/module-name/widgets/widget-name/widget-name.sn when the widget is part of a module
- /widgets/widget-name/widget-name.sn
If a widget is connected with a table, then when we edit this widget we can publish this table.
The publish of the widget will then be placed in /publish/table_name.sn
This publish can use the following publish:
use cgidata;
use user;
use config;
use state;
use page;
%include "/extenso/functions/sn_publish.snc";
site_config = sql("select * from sn_configs");
elems = splitre(value:state.sn_path,re:":");
if state.sn_modal eq "t" && isdigit(elems[1]) && elems[0] eq "uid_widget" then
widget = sql(single:true,"select * from sn_widgets_list where uid = '?'", elems[1]);
res = sn_publish(widget.rows.table_name,widget.rows.uid_page,config.site);
...
else
ct(ct:"sn_ct",code:"Can't publish this widget %s", state.sn_path);
endif
In the implementation of a widget the following variables can be use:
- use lg; // for language
- use widget // widget information in the database
So an actual implementation might be:
for parten sql("select * from widget_slider_homepage where actif = 'oui' and uid_widget = '?' order by sn_custom", widget.rows.uid_widget_list) do
...
endfor
SEE ALSO
{{ include("includes/extenso_functions.sn") }}
AUTHOR
Written by Pierre Laplante <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit