Good day, master. I try to learn PHP, do not scold too much, I make my CMS for a small project, I will give the code:

index.php <html> <head><title> Мой заголовок </title></head> <body> <div class="логотип"> <? /* тут php код ищущий в базе jpg логотипа */ ?> </div> <div class="главное меню"> <? /* тут php код ищущий в базе ссылки главного меню, формата: index.php?page=главная index.php?page=контакт index.php?page=о_фирме */ ?> </div> <div class="тело страницы"> <? /* тут php код ищущий в базе тело страницы если GET($page) не существует, тогда $page=главная если GET($page) == "главная", тогда поиск в базе текста #главной, print ("текст"); если GET($page) == "контакт", тогда поиск в базе текста #контакт, print ("текст"); если GET($page) == "о_фирме", тогда поиск в базе текста #о_фирме, print ("текст"); */ ?> </div> </body></html> 

And I would like advice from experienced gurus:

- How correct is this << system >>, what are the pitfalls?

PS read about Smarty, I want to try my own way

  • one
    If you do quite well - see Code Igninter. ellislab.com/codeigniter . Implementation through MVC. There and see what yes how - embarcadero
  • Thanks for the link I will study, but first I would like to understand the whole structure myself and not to insert someone else's code (read frameworks). From this, I ask whether it is correct and what are the pitfalls, mb so stupid to do for unknown reasons, or say the server loads. - ferrari
  • one
    > I try to learn PHP, do not scold too much, I do my CMS as usual - “I don’t know anything, but I am writing an operating system from scratch”))) - DreamChild
  • And you do not want to learn PHP by creating a search engine or social network? And then both Google and FaceBook yesterday were newcomers - igolka97
  • Will your logo change often in the same way as Google? They do change every time ?! - igolka97

1 answer 1

Answer these questions for yourself:

  • What will happen if a new page needs to be made different in structure?
  • Where will the connection to the database occur?
  • if there is incoming data, who and where will check and process them?

I will tell you that this is not the right structure . You cannot understand any “whole structure” by doing this. Examine the ready-made solutions and then you can try to do better. Now you are moving either in the wrong direction at all, or you will go for a very long time to where everyone has already come.

Pitfalls : it is unextendable and unsupported.

However , if your site consists and will consist of 3 pages of the same type, then you will benefit from such a decision.

Logo in the database? Is he really going to change so often?

  • one
    I support the answer, I will add only that the URLs are thought out badly from the point of view of the CEO - the main one should be opened only by the root, and it is not desirable to use Russian characters in the URL. Plus, the structure clearly does not have page 404, which, again, does not reflect very well on indexing. - Indifferent