D
D
Dmitry Aksenov2016-05-23 14:59:25
Yii
Dmitry Aksenov, 2016-05-23 14:59:25

Yii2 how to create new files in views/site?

I want to make a module in the admin panel to create new sections of the site. I understand that views are hosted by views/site , but I don’t understand how to generate them, and even what it’s called.
Explain how to create new *.php in views/site ?
If my path is not correct, point me to another, more convenient way to solve my problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2016-05-23
@alikust

Umm. Gii?
In general, I strongly do not recommend writing a section for creating / editing templates in the admin panel. It's simply not necessary. You are not developing the site in the admin panel. There are IDEs or simple text editors for this (although it’s generally stupid to explain this under the Yii tag).
By the way, there is nothing specific about creating a view file under Yii2. In general, the essence of your idea is not clear.

A
Alexander N++, 2016-05-23
@sanchezzzhak

Well, generating templates is stupid...
1) The manager is not a coder, but a stupid creature, an animal that can only cackle and ask when is the task, when is the task?
Create a page_post model of
the page
id
slug
content
Need a gallery on the page, the animal checked the box uploaded photos
If you need to call the gallery somewhere between the content, the manager puts pseudo placeholders
selects ready-made templates

$content = strtr($content,[
  '{photos}' => $post->is_photo ? $this->renderPhotosContent($post->photos, $post->photo_template) : '',
  '{related_page}' => $post->is_related_page ? $this->renderRelatedContent($post->id, $post->related_page_template) : '',
]);

everything can be programmed ....
Need templates, take Bitrix Xe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question