Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Doable in Grav?: random snippet of text

Solved by Aaron Dalton View solution

Started by Ernest Bornheimer 8 years ago · 4 replies · 650 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 Paul Hodges, 4 weeks ago
19 485 5 days ago
Support · by Lauw, 7 days ago
2 99 7 days ago
Support · by Anna, 3 weeks ago
4 426 1 week ago
Support · by gtx, 4 weeks ago
4 377 3 weeks ago
Support · by Anna, 1 month ago
9 484 3 weeks ago