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.

Plugins

SQLite integration in Grav

first-time

Started by Zwitterio 8 years ago · 7 replies · 1351 views
8 years ago

Hi,
I know maybe I'm asking too much, but - as the tag say, that's my first time with this functions. I'd like to build a simple plugin who takes infos from an SQLite database and put the infos somewhere in my templates.
I'm not talking about something specifical like the SQLite plugin (who works with shortcodes), but just a way to take the string or the integer from the database and putting that somewhere in the page or outside the page (footer, sidebar...).
How can I do that?
I know I should use PDO functions, but I don't know how.
Thank you all, great community as always.

👍 1
8 years ago

First of all: thank you for the accurate answer.
I'm not used to php, so I have a hard time in exploring other's code.
I'm gonna try to build my own plugin following your instructions. If I will find some problem wich I can't solve, maybe I write again. Otherwise I'll post my results and reflections and close the topic in the next days.
Thanks again

8 years ago

I tried many times, but I can't run your plugin blogroll properly. I was trying because I thought I could learn from how blogroll works, but I really don't know why (with original yaml file) it doesn't work on quark theme. I tried disabling css, changing tags and links but nothing. Any ideas on why it doesn't work?

8 years ago

What do you mean by "doesn't work"? I'd have to see your config files and twig.

8 years ago

It means that I include the blogroll.html.twig file in the sidebar template exactly like you suggest in the readme (copypasting) but, without touching the config files, it show me only the "SIDE PROJECTS" h2 in the sidebar.
I tried with my edited quark theme, with an old quark theme and with a fresh new version of grav exactly like it's released in the landing page.
So, with a full default version of grav + quark theme, with the fully default plugin I can't see a list. I really didn't touch anything in the settings to make things easy.

8 years ago

The sample code uses the tag projects, but in the default config, there's no such tag. Try using tag1 or tag2. I should change that in the README.

👍 2
8 years ago

Oh, that's true! I was searching the problem in the php and I didn't noticed that the error was in the template. It makes perfect sense. Thanks

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 54 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago