how to make calls to the database? First time with concrete5
I had a small database with 6 tables, which I don't know where to put now (in the database with the tables of Concrete5? Or I have to create a new database?), and I want to make calls to this database through my website (with buttons) and display the data in the website.
I'm so confused because I don't know in which file I could make this calls and how to define where to display the data.
Before using Concrete5 I just had a Nodejs, html et css files, I don't know if maybe I can move them in Concrete5 or I have to start all over.
I hope someone can help me!
Thanks in advance.
You know in which files do I have to write the calls? I though in application/config/app.php but I'm not sure at all.
For actually querying your data and displaying it, for an on-page view develop a simple block type to do so. Addons such as Block Designer can help you get started if creating a block from scratch is too big a step. https://www.concrete5.org/marketplace/addons/block-designer...
If you are only displaying data, rather than developing blocks you could consider my Universal Content Puller addon to pull data from your tables or external database. https://c5magic.co.uk/addons/universal-content-puller/example-site-d...
Since I'm doing a website for a school project, unfortunately I can't use the addons. So I'm trying to figure out how to make the query in a block type.
I'm a little bit stuck and I hope I can ask you some clarifications... I understand the structure of a block type but I don't get in which file I have to put the call to the database and the query, and also how to ultimately pass this information to the view.php. I tried different locations but always without results.
Hope I'm not asking much, thanks a lot in advance!
Generally, query the db in the block controller view() method, then call $this->set('name', $results); to pass data to the view.php file.
There is also plenty more relating to making blocks in @shahroq's cheat sheet.
Now I'm trying to do one with a variable from the edit page (in the picture is $titre_projet), but when I do this it doesn't work. I think the form.php doesn't send the variable to the other files, and I can't find any help, I hope you can help me again this time!
Sorry to bother you again, thanks again in advance! :)
In the Hello World block they don't use any special request to "send" the variables from form.php to controller.php and view.php, this is why I'm confused!
I just did the exact same thing and it doesn't work, do I need do add something?