Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Doable in Grav?: random snippet of text

Solved by Aaron Dalton View solution

Started by Ernest Bornheimer 8 years ago · 4 replies · 717 views
8 years ago

Hello! I'm thinking of switching from WP, but there is a website feature that I must preserve, and I can't picture how it can be done without a database.

It's a quote-of-the-day type thingy. On page load, PHP pulls a random text snippet from a table of such snippets. I hope that's clear.

Please let me know your thoughts........thank you!

eeeeebeeeee

8 years ago

You don't need a database for that. A simple text file of quotes is more than sufficient. I'm surprised there's not already a plugin that does this, but it would be trivial to write. And you could do it just in twig, too.

8 years ago

If nobody beats me to it, I'll do a fortune plugin this week.

8 years ago

I have just uploaded an example plugin that shows a random quote from a list of quotes stored in user/data/randomquote.yaml.

The repo's url is Random Quote and feedback is welcome.

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 1 week ago
4 160 7 days ago
Support · by nwhitfield, 1 week ago
2 137 1 week ago
Support · by stell, 3 weeks ago
5 370 2 weeks ago
Support · by gravinator, 1 month ago
5 563 2 weeks ago
Support · by Gravver, 3 weeks ago
6 348 3 weeks ago