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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Doable in Grav?: random snippet of text

Solved by Aaron Dalton View solution

Started by Ernest Bornheimer 8 years ago · 4 replies · 527 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 Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 19 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago