Plugin Beginner

Plugin Beginner

by Jesse H -
Number of replies: 1

Hi There,
I've got an existing php web app that i want to run as a page in Moodle. I've noticed that if i just drop the file into the mod folder apache can't find it. My developer tells me i need to alter htaccess, but I'm sure a proper Moodle plugin wouldn't need this.

It ended up working, but only after i added this to my config:
<Directory "/public_html/psy.edu.au"> 
        Options Indexes FollowSymLinks Includes MultiViews ExecCGI 
        AllowOverride All 

        Order allow,deny 
        Allow from all 
</Directory> 

Can someone indicate in a moodle plugin where the plugin feeds apache?

Much thanks for any pushes in the right direction!


Average of ratings: -
In reply to Jesse H

Re: Plugin Beginner

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

It sounds to me like you are "barking up the wrong tree."

If all the other pages in Moodle are displaying correctly then I do not think you need to modify anything at the apache level just for your php file. I would first make sure that it has the same permissions and same ownership as the other files in the directory. 

The other issue here, is that if you want your php file to be a part of Moodle, it really should be a Moodle php page, and ideally part of a plugin.

Moodle provides an API that gives you access to permissions, layout (headers/footers etc) database, internationalisation etc. Much of that requires that Moodle knows which plugin is calling the API, via the plugin's "component name". Though depending on what you are doing, it is possible to just have a free standing page.

It might pay to look at an activity's view.php page (say /mod/page/view.php), because this will show the basic setup that a page accessed directly from a browser needs to be a nice Moodle citizen. (ie page layout, login check, javascript loading, parameter retrieval)