Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Editing
Module:GameLanding/Latest news
From TwogPedia
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local cargo = mw.ext.cargo local p = {} local prizeToString = require('Module:Functions').prizeToString function p.news(game) local tables = 'News' local fields = '_pageName, date, game' local cargoArgs = { where = 'game HOLDS "' .. game .. '"', orderBy = 'date DESC', limit = 10 } local results = cargo.query(tables, fields, cargoArgs) if #results > 0 then local list = '' for i = 1, #results do local result = results[i] local dateString = mw.ustring.gsub(result.date, "%s(AM|PM)$", "") -- Use os.date to convert the string to a table of date and time components local dateTimeTable = os.date("*t", os.time({year=string.sub(dateString, 1, 4), month=string.sub(dateString, 6, 7), day=string.sub(dateString, 9, 10), hour=tonumber(string.sub(dateString, 12, 13)) + ((string.sub(dateString, 22, 22) == "PM") and 12 or 0), min=string.sub(dateString, 15, 16), sec=string.sub(dateString, 18, 19)})) -- Use os.date again to format the date and time components into a desired format local formattedDate = os.date("%d %b %Y %H:%M", os.time(dateTimeTable)) local news = mw.html.create('div'):wikitext(formattedDate .. ' - [[' .. result._pageName .. ']]') list = list .. tostring(news) end local latestNews = mw.html.create('div'):addClass('box__container'):node(mw.html.create('div'):addClass('box__title'):wikitext('Latest news')):node(mw.html.create('div'):addClass('tc'):node(list)) return latestNews end return nil end return p
Summary:
Please note that all contributions to TwogPedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:GameLanding/Latest news/doc
(
edit
)
No categories
Edit