Jump to content

Module:Pagination

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Codemini (talk | contribs) at 18:18, 25 May 2025 (Added parameter for optional colors). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- Introduction: Pagination primarily contains two buttons, a next and a previous button
local p = {}
function p.pagination(frame)
 args = frame.args
 prevcolor = args.prevcolor or ''
 nextcolor = args.nextcolor or ''
 previous = args[1] or args.previous
 nextEl = args[2] or args.next
 msg = '<strong class="error">PaginationScriptError: You must provide a link for the</strong>'
 tmp = '<div id="pagination" ><div class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</div> <div class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</div></div>'
if previous == '' and nextEl == '' then
 return '<strong class="error">' .. msg .. ' previous and next buttons</strong>'
else return tmp
end
if previous == '' then
 return '<strong class="error">' .. msg .. ' previous button</strong>'
else return tmp
end
if nextEl == '' then
 return '<strong class="error">' .. msg .. ' next button</strong>'
else return tmp
end

end
return p