Sacra.Wiki Modul:RandomOrganisation: Unterschied zwischen den Versionen

Modul:RandomOrganisation: Unterschied zwischen den Versionen

Aus Sacra.Wiki
 
Zeile 19: Zeile 19:
         result = result .. '<div class="random-organisation">'
         result = result .. '<div class="random-organisation">'
             if row["Hat Bild"] then
             if row["Hat Bild"] then
             result = result .. '[[File:'..row["Hat Bild"]..'|link=[['..row[1]..']]]]\n'
             result = result .. '[[File:'..row["Hat Bild"]..'|link='..row[1]..']]\n'
             end
             end
     result = result .. '<div class="random-organisation--name"><span>[[' .. row[1] .. ']]</span></div></div>\n'
     result = result .. '<div class="random-organisation--name"><span>' .. row[1] .. '</span></div>'
    result = result .. '</div>\n'
         end
         end
         return result..'</div>'
         return result..'</div>'

Aktuelle Version vom 27. September 2022, 17:25 Uhr

Die Dokumentation für dieses Modul kann unter Modul:RandomOrganisation/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:Organisation]][[Hat Bild::+]]|?Name|?Hat Bild|limit=4|order=random")
	
	if queryResult == nil then
        return "(no values)"
	end
	
	local result = frame:extensionTag('templatestyles', '', { src = 'RandomOrganisation/style.css' })
	
	if type( queryResult ) == "table" then
        local result = result..'<div class="organisation-container">'
        for num, row in pairs( queryResult ) do
        	result = result .. '<div class="random-organisation">'
            if row["Hat Bild"] then
            	result = result .. '[[File:'..row["Hat Bild"]..'|link='..row[1]..']]\n'
            end
    		result = result .. '<div class="random-organisation--name"><span>' .. row[1] .. '</span></div>'
    		result = result .. '</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.