Sacra.Wiki Modul:RandomPerson

Modul:RandomPerson

Aus Sacra.Wiki

Die Dokumentation für dieses Modul kann unter Modul:RandomPerson/Doku erstellt werden

local p = {}

function p.ask(frame)
	if not mw.smw then
        return "mw.smw module not found"
	end

	local queryResult = mw.smw.ask("[[Kategorie:Person]]|?Name|?Bildname|limit=3|order=random")
	
	if queryResult == nil then
        return "(no values)"
	end
	
	local result = frame:extensionTag('templatestyles', '', { src = 'RandomPerson/style.css' })
	
	if type( queryResult ) == "table" then
        local result = result..'<div class="people-container">'
        for num, row in pairs( queryResult ) do
            result = result .. '<div class="random-person">'
            if row["Bildname"] then
            	result = result .. '<img class="person-image" src="/images/e/ea/Blank-profile-picture-g765c70dd2_640.png"/>\n'
        	else
        		result = result .. '<img class="person-image" src="/images/e/ea/Blank-profile-picture-g765c70dd2_640.png"/>\n'
            end
            result = result .. '<h2>[[' .. row["Name"] .. ']]</h2></div>\n'
        end
        return result..'</div>'
    end
end

return p
Cookies helfen uns bei der Bereitstellung von Sacra.Wiki. Durch die Nutzung von Sacra.Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.