I want to make a page and add a javascript source after a div element. my code is like this:
public function process_request($request) { $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('example_page/page_title'); $qa_content['error'] = 'An example error'; $qa_content['custom'] = '<div>custom html</div>'; $qa_content['script'] = '<script type="text/javascript" src="'.$this->directory.'myscript.js"></script>'; return $qa_content;
}
But it doesn't work.
Just add the below code
var $directory;
var $urltoroot;
function load_module($directory, $urltoroot)
{
$this->directory=$directory;
$this->urltoroot=$urltoroot;
OR
Replace $this->directory with __DIR__
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.