I have been trying to create a resource pointing to another site on my server and using the Web Page option.
Things work out well until I click on the breadcrumb link and the resource opens up to the original homepage. It kind of defeats the purpose of having the resource within course when someone can access the original homepage outside of Moodle.
Is there a way to have the resource stay within the frame and to disable the breadcrumb link?
The reason for using the Web Page option is to have the resource use php functions that are not available within the regular html editor.
I have tried various options and I may be missing somthing obvious.
Using:
Moodle 1.2 Beta (2004022400)
Apache on Debian
Any ideas or sugestions are gratefully appreciated.
Bill
include("../config.php"); /// Provide the correct path to the Moodle config file.
require_login();
Thanks for the tip. However, it does not seem to be working.
Just to clarify, I add the resource using 'Web Page' option.
I choose a link, something like:
http://example.com/location_of_files/test.php
In the test.php file, I have the lines you suggested at the top:
include("../config.php"); //relative or absolute, both O.K.?
require_login();
Click OK, page shows up in frame below Moodle.
Mouseover breadcrumb shows link in browser, lower left, same as assigned link.
Click brings up page outside of frame, same as before.
Should the link be within the moodle subdirectory?
Does it matter?
Other settings?
Thanks in advance.
Bill
My suggestion DOES prevent people viewing the page without being logged into your Moodle.
Thanks for your response.
I understand and I would just have to make sure that they can renavigate back into Moodle if they view the resource outside the frame.
Is there a way to include the referring link into the resource in PHP? Sort of like a hyped-up back button?
Thank again. Learning lots.
Bill
Hello, some days ago I posted some code to protect web link resources. Basically the code is what Martin suggest with the addition to the ability of redirecting user to the enrollment page or the password page if the students are not enrolled or have not enetered the course password.
Usually it is nice to have the breadcrumb link available to make the web page loose its Moodle frame. But if you don't want to have it, simply take it out from your copy of cvs:/moodle/mod/resource/view.php. Look for the section starting with
case WEBPAGE:
if ($frameset == "top") {
print_header($pagetitle, "$course->fullname",
"$navigation <a target=\"{$CFG->framename}\" href=\"$resource->reference\"
title=\"$resource->reference\">$resource->name</a>", "", "", true,
and take out the link after $navigation.
Thanks for the suggestion. I was able to do that. However, I am still concerned about the authorization.
If the PHP file has a:
require_login();
function, then I still should not be able to view the file outside the Moodle frame. No?
I am still able to do that by right-click --> view frame in separate window.
Stumped.
Bill
Could it be that you are logged in inside your Moodle course? This would allow you to view the file outside of the frame since your session is stored in a cookie. Try jotting down the URL of the file, closing down your browser completely, re-opening your browser en copying the URL in the address bar.
Can you still access it?
Thanks for the suggestion. I thought I was able to get the resource outside the frame from another P.C.. I'll try again as it is 2:00am and I am not thinking straight.
Bill