M
M
Mikhail Artemiev2017-01-18 14:36:13
Yii
Mikhail Artemiev, 2017-01-18 14:36:13

How to implement the "client hook system" in yii2 in the least cycling way?

Don't be alarmed, I just came up with the term myself, but here's what you need:
A user from the admin panel writes a certain shortcode in the page text - and on the site on this page, a certain widget or view is rendered in place of this shortcode.
In my opinion, the task is the most trivial, but I fell into a stupor on how to do it correctly. Isn't it possible to skip the text of pages through str_replace and replace shortcodes with the result of rendering the desired view? Well, if not out of the box, then what kind of extensions for the convenient implementation of such functionality should definitely be?
I would be grateful not even for a complete answer, but for a kick in the right direction.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-01-18
@qonand

implement an interpreter on the back to determine shortcodes and replace them with the data you need

A
Andrey, 2017-01-18
@reaferon

Don't you want to completely transfer this task to the frontend?
That is, the user's shortcode is rendered on the page as a shortcode, processed by JS, which loads the desired view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question