У меня есть строка, в которую пользователь может добавить специальную отметку, например [include=example_file]
, и я хотел бы включить «example_file. php» в место, где находится отметка.
Пользовательский текст может быть похожим на:
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industrys standard dummy text ever since the 1500s.
[include=contact_form] // here should be contact_form.php included
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industrys standard dummy text ever since the 1500s
Я использую это, чтобы отобразить текст пользователя, теперь:
<?php echo $this->view['users_text']; ?>
... и новый вывод должен быть таким:
<?php
// echo first paragraph
include "contact_form.php";
// echo second paragraph
?>
Как проще всего включить файлы, отмеченные этими специальными отметками?