Answer the question
In order to leave comments, you need to log in
Automatic link/page creation?
Я начал создавать сайт (мой первый сайт, поэтому вопрос нубский) на HTML CSS немного js и php, и столкнулся с такой проблемой - мне приходиться создавать все ссылки вручную, к примеру я создал шаблон страницы контента, у меня есть 30 категорий, а значит нужно продублировать 30 одинаковых страниц, разместить на них разный контент (и это тоже вручную, с HTML насколько это правильно я не знаю). Как мне избавиться от таких заморочек? Может использовать laravel или zend framework изучив их?
Answer the question
In order to leave comments, you need to log in
Make one php file which will store an array of descriptions of all pages.
Then you include_once this file into the finished page - parse it and get all the links...
Sample file:
<?php
$config = [
[
'name' => 'page_one',
'title' => 'первая страница',
],
[
'name' => 'page_two',
'title' => 'вторая страница',
],
];
?>
no.
1. you need to use the "sewing" of the page from pieces through include in php
there is a header, content, footer, all this is in separate files, etc.
2. you can implement it through SPA and load the same piece of menu from html for different pages via ajax
You should learn how to create websites. It is advisable to write the first guestbook in pure php without a framework, and then take on them.
1. Read, understand and use MCV
2. It is desirable to read, understand and use OOP in PHP
In fact, you need a component (php code) that will connect to index.php and resolve requests using some of your rules. In this case, the server will conduct all requests through index.php.
If all of the above is "difficult" or if you don't want to masturbate - use a framework where this is already implemented, for example Yii2 or laravel. I find it easier to start with yii2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question