Jump to content

Question about addJS


julien59

Recommended Posts

Hi,

 

I have a little question about addJS.

I added this line under DisplayHeader hook

 

$this->context->controller->addJS("/index.php?fc=module&module=mymodule&controller=myJScontroler");

 
What I want to achieve is to generate dynamically a JS file with a php script.
If I put the code above, it does not work.
If I replace the file path by an existing js file, located in my modules/mymodule/views/js/front folder, the js script is added successfully
It seems that the addJS function does not add a file that does not physically exists on the file system.
Is it right ? 
If it is, do you have any workaround ?
 
Thanks
 
Julien
Link to comment
Share on other sites

I moved a little bit forward with my problem.

The issue is that my php page returns a html content, even if I add 

$this->context->smarty->assign('content_only', 1);

in initContent() before doing some echo(...)

 

The result is the text I sent via echo() followed by html tags.

 

How can I have the page returning only plain text, without html ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...