A week of major tech outages disrupted daily life. Experts expect more to come.
Commerce Dept. found suspect activity at delivery sites but did nothing, ex-staffers say
Incoming RSS — placeholder article. Will load from RSS feed.Fiona the hippo won hearts around the world. Now she's facing a new challenge.
Incoming RSS — placeholder article. Will load from RSS feed.White House's $50 billion air traffic demand hits turbulence in Senate
Incoming RSS — placeholder article. Will load from RSS feed.Weather / stocks / mail preview — placeholder. Wire later.
Shorts, Strong Feed, University — placeholders for internal promos.
Incoming RSS.
Placeholders for incoming RSS. Each card is one feed. When you wire RSS, replace the placeholder items with real feed items — same layout.
Written Articles.
Written by TinyFiles. Not RSS — original articles. Placeholders for now, same cards when real.
Written article headline goes here
Excerpt placeholder. Two lines about what this article is about, written by TinyFiles.
Written article headline goes here
Excerpt placeholder. Two lines about what this article is about, written by TinyFiles.
Written article headline goes here
Excerpt placeholder. Two lines about what this article is about, written by TinyFiles.
⬇ Backend — Homepage Backend — Template
Right now Homepage is local-only — hero is a hardcoded let heroes = [...] in JS, Trending / RSS / Written are placeholder cards in HTML, search only filters the 5 trending rows, and the ad slots say “Advertisement — placeholder”. This backend is the map to make it real: hero + trending + RSS + written all come from the server, search hits the server, ads are server-placed. Proposed, not connected.
01 / Files to create
api/home/hero.php GET /api/home/hero api/home/trending.php GET /api/home/trending?limit=5 api/home/rss.php GET /api/home/rss?feed=tech|world|finance api/home/written.php GET /api/home/written?limit=3 api/home/search.php GET /api/home/search?q=... api/home/admin-save.php POST /api/home/admin-save (admin only) sql/home_tables.sql
Keep the tinyfiles PHP pattern: each endpoint loads /api/bootstrap.php, uses json_in() / json_out(), prepared PDO statements.
02 / Database tables
-- sql/home_tables.sql
home_heroes
id INT AUTO_INCREMENT PRIMARY KEY
title VARCHAR(200) NOT NULL
source VARCHAR(80) NOT NULL -- "TINYFILES", "RSS • TECH"
link VARCHAR(255) NOT NULL DEFAULT '#'
sort_order INT NOT NULL DEFAULT 0
active TINYINT(1) NOT NULL DEFAULT 1
created_at DATETIME NOT NULL
home_trending
id INT AUTO_INCREMENT PRIMARY KEY
rank INT NOT NULL -- 1-5, display order
title VARCHAR(200) NOT NULL
kind ENUM('Written','RSS') NOT NULL
thumb_label CHAR(1) NOT NULL -- "B", "N", "F"
thumb_color VARCHAR(10) NOT NULL -- "#1a1a1a"
link VARCHAR(255) NOT NULL DEFAULT '#'
updated_at DATETIME NOT NULL
home_rss_items
id INT AUTO_INCREMENT PRIMARY KEY
feed ENUM('tech','world','finance') NOT NULL
title VARCHAR(250) NOT NULL
source VARCHAR(80) NOT NULL
link VARCHAR(255) NOT NULL
published_at DATETIME NOT NULL
fetched_at DATETIME NOT NULL
home_written
id INT AUTO_INCREMENT PRIMARY KEY
title VARCHAR(200) NOT NULL
excerpt TEXT NOT NULL
author VARCHAR(80) NOT NULL DEFAULT 'TinyFiles Staff'
thumb_color VARCHAR(10) NOT NULL
published_at DATE NOT NULL
link VARCHAR(255) NOT NULL DEFAULT '#'
Hero + trending are curated rows. RSS items are fetched by a cron job, not on page load. Written articles are the only originals — everything else is a pointer to a feed.
03 / API endpoints & request flow
GET /api/home/hero
- returns { "ok": true, "heroes": [ { title, source, link }, ... ] }
- only active=1, ORDER BY sort_order, max 15
- frontend replaces let heroes = [...] with this list
GET /api/home/trending?limit=5
- returns { "ok": true, "items": [ { rank, title, kind,
thumb_label, thumb_color, link }, ... ] }
- ORDER BY rank ASC
GET /api/home/rss?feed=tech
- feed in [tech, world, finance], default tech
- returns { "ok": true, "feed": "tech",
"items": [ { title, source, link, published_at }, ... ] }
- max 10, newest first, from home_rss_items cache table
GET /api/home/written?limit=3
- returns { "ok": true, "articles": [ { title, excerpt,
author, thumb_color, published_at, link }, ... ] }
- ORDER BY published_at DESC
GET /api/home/search?q=bond
- q = search across trending + written + rss titles
- returns { "ok": true, "results": [ { title, kind, link }, ... ] }
- max 20, LIKE %q%, cap q at 100 chars
POST /api/home/admin-save (admin only, session check)
{ "type": "hero|trending|written", ...row fields }
- validates type + fields, INSERT or UPDATE by id
Page load is 4 cheap GETs: hero + trending + rss (x3 feeds can be one call with ?feed=all) + written. Search is a separate call, only when the user types.
04 / RSS, caching & validation (server owns this)
// RSS is fetched by cron, not by the browser: // cron: php /api/home/fetch-rss.php every 15 min // fetch-rss.php pulls tech.xml / world.xml / finance.xml // INSERT ... ON DUPLICATE KEY UPDATE into home_rss_items // frontend never touches the raw feed URLs // Server validates on save: // title: 1-250 chars, source: 1-80 chars, link: valid URL or '#' // feed: must be in [tech, world, finance] // rank: 1-20, sort_order: 0-100 // excerpt: 1-500 chars, plain text, no HTML
Keep the placeholders’ layout exactly — same .home-card, .trend-item, .rss-item HTML. The backend only swaps placeholder text for real rows.
05 / Frontend wiring
// Replace the hardcoded let heroes = [...] in this page:
let heroes = []; // filled from server, same shape as now
async function loadHome(){
const [hero, trend, rss, written] = await Promise.all([
fetch('/api/home/hero').then(r=>r.json()),
fetch('/api/home/trending?limit=5').then(r=>r.json()),
fetch('/api/home/rss?feed=all').then(r=>r.json()),
fetch('/api/home/written?limit=3').then(r=>r.json()),
]);
// hero.heroes -> renderHero() / hero carousel, same #heroTitle etc.
// trend.items -> #trendList, same .trend-item HTML as now
// rss.items -> .rss-grid cards, same .rss-item HTML as now
// written.articles -> .written-grid cards, same .home-card HTML
}
// Replace filterHome(q):
async function filterHome(q){
if(!q) return renderTrendingFromCache();
const res = await fetch('/api/home/search?q=' + encodeURIComponent(q));
const data = await res.json();
// data.results -> render #trendList filtered, same markup
}
// On load: loadHome() then start 8s carousel interval
// If API fails, fall back to current hardcoded heroes + placeholder cards.
Keep the current hardcoded heroes + placeholder cards playable with no backend — if /api/home/hero fails, use the in-page list as the fallback.
api/home/ + sql/home_tables.sql — no GitHub needed. The <pre> blocks are the backend spec: server-owned hero + trending + RSS cache + written, server-side search, cron-fetched feeds, same layout, placeholders stay until wired.