Skip to content
Grav 2.1 is out: every page speaks Markdown. 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 · 684 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 complanar, 6 days ago
6 140 17 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 52 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago