I am desperately trying to get a Platform JavaScript API to work on a page in my site. Can someone please assist me on how to get this to work?
Thanks
I am desperately trying to get a Platform JavaScript API to work on a page in my site. Can someone please assist me on how to get this to work?
Thanks |
There are a few ways, you can add javascript to the template files. If it needs to be on one page only, then you can insert a page block with the code, it depends on the code you need to insert, if it needs to be loaded in a certain place. There are some mods in the market for header injections if you need it on a certain page in the header of the page. Geeks, making the world a better place |
Thanks for the response. I have added the PHP block mod, but the java script is not running there. My page stays blank, the actual thing I am trying to insert doesn't appear
Any ideas on what header injection mods to look for? |
PM me the API that you are trying to add so I can better help you. Once I know the requirements I can better explain to you where to place the code. Geeks, making the world a better place |
Any ideas on what header injection mods to look for?
I've had good results with Deano's head injection module: http://www.boonex.com/m/Head_Injections
Check with him if it's compatible with v 7.2 though. My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Check with him if it's compatible with v 7.2 though.
https://www.deanbassett.com |
mailed you Geek Girl, thanks |
Thanks Houston and Deano,
Any other ideas on how I can get this to work? |
Any other ideas on how I can get this to work?
Dolphin has a built in php function that you can use to load a js file. The function is used to load files in the inc/js folder, but they can be anywhere you specify.
As an example, I add a folder: inc/js/lytebox then put lytebox.js in that folder
Then I put this in a php block on any page I create in page builder (or any page at all for that matter):
$GLOBALS['oSysTemplate']->addJs('lytebox/lytebox.js');
On the page that this php block exists, and only that page, lytebox.js will be loaded. If you have multiple js files you want to load at the same time:
$GLOBALS['oSysTemplate']->addJs(array('lytebox.js', 'someOther.js')); //etc
There's another convenient built in function to add css files, and it works the same way:
$GLOBALS['oSysTemplate']->addCss(array('some.css', 'someMore.css')); // here the css is expected to be in /templates/base/css or in /templates/tmpl_someTemplate/css
These functions will add the js or css appropriately between the head tags My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Thanks Houston, going to try this! |