How to create a dynamic website like normal blogs on the web

Asked

Viewed 56 times

2

I need help with a question I’ve been having. The URL of blogs in general on the web are by directories for example: www.qualquercoisa/post/example-do-post.

I am creating a blog that is dynamic and use parameters in the URL to display the content on the page, example: www.qualquercoisa/post? id=1.

The database has a table called post, example:

nome varchar     | conteúdo: <h1>Meu primeiro post</h1>
conteudo varchar | conteúdo: <p>Este é o meu conteudo do primeiro post</p>

When the user clicks on the link, it goes to a file called post and along with it the post ID to display. With the ID I can take the database name and content.

Doubt: Is it wrong to do it this way? Do regular blogs have to create a file with the post when they want to post a story? Creating a file for each post would not weigh on the server?

  • 1

    It would. The technique that is used and you should search is URL rewriting. You define a entry-point standard for your entire application and handles the accessed URL. A 1:1 relationship is usually defined between the URL and the post (in general, through the post title after the slugify)

  • Thank you, I’ll look into.

  • Just one question: are you doing this "on the nail" on purpose? As it could easily do everything in Wordpress.

  • 1

    @Rogériodec the site is about programming. If it were to use wordpress, nor would it make sense to ask here, after all in WP already has the feature ready. But of curiosity, why anyone would use WP nowadays with so much better stuff (made in hand, including).

  • 2

    @Rogériodec I’m doing it in the nail to understand how everything works. Before using any framework I want to understand what happens behind the curtains.

  • https://httpd.apache.org/docs/current/mod/mod_rewrite.html

  • @Bacco, many years ago I developed sites in Drupal, because at the time Wordpress was basically a blog creator. But currently WP is very well advanced. But which CMS you say are far better than Wordpress?

  • @Andersoncarloswoss I have to thank you again. What you said was what I needed. I have not fully solved my problem, but I have found a way. vlw man

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.