URL to javascript file & image file located in single page subdirectory
Permalink
I'm porting a PHP application and trying to instantiate it as a single page named "audio". The existing php script tries to load up a javascript file and a few images located in the audio subdirectory and it's not working. The URL ends up resolving tohttp://www.domain.com/audio/script.js... orhttp://www.domain.com/audio/image.png,... which are not recognized as valid URLs. What is the appropriate approach to include the external JS & Image files?
If it's at the top-level of your site, put your javascript in a top-level "js" folder, and your images in a top-level "images" folder. Then you can load it during your single_page controller's on_before_render() function:
For the images paths, you can put this in your single_page:
If your single_page is in a package, then you can do the same basic thing, but the "js" and "images" folders would be inside your package instead of at the top-level of your site. Also you'll need to add your package handle as a 2nd parameter to the $html->javascript() function, like so:
...and for the image, you'll need to do this:
Best of luck!
-Jordan