Answer the question
In order to leave comments, you need to log in
Include error when sending the path to the file through a variable, why does it occur and how to solve it?
I use CodeIgniter as a framework, there is a {CONTENT} tag in the template, I send it to the template like this:
$this->tp->assign('CONTENT', APPDIR . "/views/contents/main.html");
include('{CONTENT}');
include("path/main.html");
Answer the question
In order to leave comments, you need to log in
Issue resolved. I passed the $content variable to {CONTENT}, which I presented like this (I know that it’s a crutch, but it still works, and the presence of a line break there is not very important, because html, after all):
$content = file_get_contents(APPDIR . "/views/contents/main.html");
If I'm not mistaken, the variables should be applied after the entire template is formed, with sub-templates, respectively, for the include('{CONTENT}'); this variable is not yet known.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question