Using Database
# help-with-umbraco
m
Hello, i am new to umbraco and asp.net and need to use a sqlite database, can anyone help me with that
a
Hi @merhmood , if you start a 'fresh' installation of Umbraco, during the installer you can easily make the sqlite database
You can read a bit more about where it's located / how to connect to it (which is done automatically when using the installer) here: https://docs.umbraco.com/umbraco-cms/reference/configuration/connectionstringssettings
m
Okay thanks @Ambert, so I was given a task to implement this
With the following instructions:
Create scripts that will load more grid data when click See More Stories on homepage
Also I am confused on how to add data to the database
With this also; Is there a clear image which describes each distinct table, their primary keys and the unique relationships between each and all tables?
Really confused on that, would really appreciate your help
@User
c
Hi @merhmood, Moderators are here to keep the Discord server under control where need be, not necessarily to be support, so please be mindful when pinning all moderators. I'm sure someone in the community will be able to help you when available 😇
m
Okay thanks for the info
s
By looking at your screenshot, what is the reason this needs to go into a custom database table? If I were to create this, I would: 1. Create a doctype for a story and then add the relevant fields on that. 2. Create an ApiController where you can request x-amount of stories by the click of the button.
a
I think he missed a bit of what Umbraco actually is. You can basically see it as a framework that does the talking to the database for you. You can create the content easily in the backoffice, and use your own code to get that content from the backoffice using ApiControllers. Assuming from your screenshot you need to extend a existing environment, or do you need to build it from scratch ? If the first, there's probably already logic for creating the data in the backoffice, so you'll only need to add a controller which you can then call (for exampling using javascript) in the frontend to get the data and show it on your page. https://docs.umbraco.com/umbraco-cms/reference/routing/umbraco-api-controllers
m
Big thanks for the info it’s really helpful
@Søren Mastrup It will be a document type without a template right
s
@merhmood In your screenshot it seems that the stories should be able to visit? If that is correct, then you should have a template
m
okay thanks, @Søren Mastrup but how do link up that template with home, the idea is still vague to me
a
I can recommend checking out the basics first: https://docs.umbraco.com/umbraco-cms/fundamentals/design/templates/ A template is usually bound to a documentType, if you want the item to be able to be visited by a user In your example. You can write a piece of code on your HomePage that loops through all the items of type "story", and have it link to the storypage. Something like (simplistic example):
Copy code
c#
foreach(var story in Model.Descendants<Story>())
{
   <a href="@story.Url">@story.Name</a>
}
But I can definitly recommend going through the basics first, so you get a grasp on how the documentTypes/Templates work
m
Thanks you so much for the pointers @Ambert
a
Anytime!
m
hello @Ambert these are the task to implement
- Community Stories will be the Parent page of Community Story Item - Community Story Item can support more than 1 article
can you please tell me how to go about implementing that because the whole concept of content publish, document type and template haven't really come together for me to be able implement the task
r
I suggest watching @CodeSharePaul’s tutorials on YouTube, it’ll walk you through a lot of the stuff and even though they’re for v10 they still apply to the latest version

https://www.youtube.com/watch?v=qEZtjxDEK8g&list=PL90L_HquhD-81xTOCLLJZLl1roU6hXPhp&pp=iAQBâ–¾

m
Started the tutorials and it’s been great so far, thanks @rasmusjp and @CodeSharePaul
3 Views