-1

I searched for this topic but they all mention including in HTML file which I do not have. I am working only with js files in some php application-so NO HTML!

I have js file 1.js

function check_custom_data()
{
    YAHOO.SUGAR.MessageBox.show({msg: 'Fodo', type: 'plain'} );
}

This YAHOO function is defined in some 2.js file. (on example path is /custom/2.js)

How to include it?

Thank you

Veljko
  • 1,708
  • 12
  • 40
  • 80
  • If you aren't dealing with HTML (which is unusual, normally when dealing with PHP+JS the PHP will generate an HTML document which is delivered to the browser) then how are you interacting with the JS? Are you using the [V8 integration](http://php.net/manual/en/book.v8js.php)? Making an HTTP request to a Node.js server? Something else? – Quentin Feb 27 '13 at 10:48
  • They mention : 2 - Add a script tag with the script URL in the HTML. I do not have HTML. Do not have HEAD or BODY tags – Veljko Feb 27 '13 at 10:53
  • user1394965 thank you for response but I am confused with such large code in the answer. Could you tell me which part of code I should use for this mine very simple include example.thank you – Veljko Feb 27 '13 at 12:00

1 Answers1

0

Your PHP is (most likely) generating HTML. You need to find which PHP file is responsible for the HTML head tag generation, and from there you'll be able to include other scripts. You may also use AMD to lazy-load JS files, but that's not necessary for such a simple case.

Greg
  • 3,370
  • 3
  • 18
  • 20