Semantic MediaWikiDit bericht verdwijnt nadat alle relevante taken zijn afgerond.

Er is één onvoltooide of openstaande taak, die nodig is om het installeren van Semantic MediaWiki te voltooien. Een beheerder of gebruiker met voldoende rechten kan deze uitvoeren. Dit moet worden gedaan voordat nieuwe gegevens worden toegevoegd om tegenstrijdigheden te voorkomen.

Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 23: Regel 23:
]]--
]]--
p.getdatafromslot = function( page, slot, template, param )
p.getdatafromslot = function( page, slot, template, param )
local page = page or mw.title.getCurrentTitle()
local slotdata = mw.slots.slotTemplates( slot, page ) -- produces table
local slotdata = mw.slots.slotTemplates( slot, page ) -- produces table
if template == nil or template == '' then
if template == nil or template == '' then
Regel 28: Regel 29:
local str = '@todo'
local str = '@todo'
else
else
local str = slotdata[template][param]
local str = slotdata[template][param]['_text']
end
end
Regel 45: Regel 46:
p.getdata = function(frame)
p.getdata = function(frame)
-- todo without pagename, get current page
-- todo without pagename, get current page
local page = frame.args.page or ""
local page = frame.args.page or mw.title.getCurrentTitle()
local slot = frame.args.slot or "ws-page-props"
local slot = frame.args.slot or "ws-page-props"
local template = frame.args.template or "Book"  --template parameter
local template = frame.args.template or "Book"  --template parameter

Versie van 21 sep 2023 20:46

Module:FF




invoke within form

{{#invoke:FF|input 
|type=text 
|name=myname
|value=Value here 
|id=fff-443434 
|class=form-control

|label=Name
|template=Data item

|slot=
|param=
|template=
}}


Getdata

Kikkers en tongzoenen - Sarah Mlynowski 2007, 1ᵉ druk, Uitgeverij Van Goor Unieboek BV, Houten:

Luafout op regel 31: attempt to index field '?' (a nil value)

Works with parser function though


Titel/-787178247

getdatatest

Scriptfout: de functie "getdatatest" bestaat niet.


local p = {}

p.input = function(frame)
	local content = frame.args.content or frame.args[1] or ""
	local frompage = frame.args.page or ""
	local fromslot = frame.args.slot or ""
	local fromparam = frame.args.param or "" --template parameter
	local label = frame.args.label or ""
	-- slot
	-- Remove anything from args that should not be sent to FF
	local additkeys = { 'content', 'page', 'slot', 'label' }
	for k in ipairs( additkeys ) do
		if ( frame.args[k] ~= nil ) then
			frame.args[k] = nil
		end
	end
	-- FF
	local str = frame:extensionTag( '_input', content, frame.args )
	return str
end

--[[
]]--
p.getdatafromslot = function( page, slot, template, param )
	local page = page or mw.title.getCurrentTitle()
	local slotdata = mw.slots.slotTemplates( slot, page ) -- produces table
	if template == nil or template == '' then
		--todo
		local str = '@todo'
	else
		local str = slotdata[template][param]['_text']
	end
	
	local str = ''
	if next(slotdata) == nil then
		str = "table is empty"
	end

	return str
end


--[[
test
]]--
p.getdata = function(frame)
	-- todo without pagename, get current page
	local page = frame.args.page or mw.title.getCurrentTitle()
	local slot = frame.args.slot or "ws-page-props"
	local template = frame.args.template or "Book"  --template parameter
	local param = frame.args.param or nil  --template parameter
	-- getdatafromslot( page, slot, param )
	local str = p.getdatafromslot( page, slot, template, param )
	return str
	--local pagepropsparams = { slot, page, '@' .. slot }
	--local slotdatapf = frame:callParserFunction( '#slottemplates', pagepropsparams )
	--local slotdata = frame:preprocess( slotdatapf )
	
end

--[[
test to show comparison callParserFunction and extensionTag
]]
p.form1 = function(frame)
	-- test of frame:callParserFunction
	-- {{#tag:form||id=bla|action=get}}
	local content = 'Test'
	local formparams = { 'form', content, id = 'bla', action = 'get' }
	local str = frame:callParserFunction( '#tag', formparams )
	return str
end

--[[
Makes more sense than using callParserFunction
but "equivalent to a call to frame:callParserFunction() with function name '#tag' "
]]--
p.form2 = function(frame)
	-- frame:extensionTag( name, content, args )
	local content = 'Test'
	local tag = 'form'
	local args = { id = 'bla', action = 'get' }
	local str = frame:extensionTag( tag, content, args )
	return str
end

return p