We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Plugin script | Forum

Alex Philipp
Alex Philipp Jan 23 '13
When we need to execute script of some plugin on its own (Plugin_index) page how should write a link to the script, which is placed ow_plugins/someplugin/scripts/script.js:

Here is the example of plugin index (ow_plugins/someplugin/views/controllers/Plugin_index.html) content code: 


<!DOCTYPE html><html>    <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">               <script type="text/javascript"src="/ow_plugins/someplugin/scripts/script.js"></script>    </head>    <body>

After installation it doesn`t catch script only got 404 error

Alex Philipp
Alex Philipp Jan 23 '13
Of course it should be executed on every site, which has this plugin..
Purusothaman Ramanujam
Are you making this a new plugin or hard-coding these to your existing plugins?

Actions differs based on what you want to do.
Alex Philipp
Alex Philipp Jan 23 '13
this is a new plugin
Purusothaman Ramanujam
You can add that using OW::getDocument()->addScript() function from your plugin. For reference, refer to any oxwall plugins.
Alex Philipp
Alex Philipp Jan 23 '13
Thanks for suggestion, but it would be better to make direct link to script.js file

May be simple example would be appreciated..

Alex Philipp
Alex Philipp Jan 23 '13
May be some of developers know PHP and can explain how to write the base path in example

<?php echo OW::getDocument()->addScript()->request->OW_URL_HOME.; ?>

Alex Philipp
Alex Philipp Jan 24 '13
Any more suggestions about how to get access from plugin_index.html to static/script.js?
Purusothaman Ramanujam
What I suggested is for including the link directly.

OW::getDocument()->addScript('url')
Alex Philipp
Alex Philipp Jan 24 '13
Can I paste this script: OW::getDocument()->addScript('url')  into myplugin_index.html or this should be another php

file? And if index.html requires connection to some .php file with OW::getDocument()->addScript('url') How we connect it?

The Forum post is edited by Alex Philipp Jan 24 '13