Linking from one web page (resource) to another web page (resource)

Linking from one web page (resource) to another web page (resource)

Michael Heraghty發表於
Number of replies: 11
Is it possible to link from one web page to another web page, both created as resources, without using absolute URLs?

The reasons I would not like to use absolute URLs are:
1. It prevents us from being able to export the course (this is the main reason)
2. It can cause problems for course maintainability generally, e.g. if we ever move servers or change the main URL, it may "get forgotten", in time, that absolute URLs are being used within the course content

I found this thread:
http://moodle.org/mod/forum/discuss.php?d=83988

... where Martin suggests going to Admin > Modules > Filters and turning on the "Resource Names Auto-Linking" filter.

However, this is not quite what we're looking for, as it doesn't give us control over the anchor text of the link.

For example, in our existing course, to take one example, the anchor text of the link says "Let's find out >>"

If we were to use the Resource Names Auto-Linking filter, we would be limited to only using the names of the resources as the anchor text.

Does anyone know if it's possible to do what we want without using absolute URLs?

If not, may I suggest this as a desired feature, for the reasons I mentioned above?



評比平均分數: -
In reply to Michael Heraghty

Re: Linking from one web page (resource) to another web page (resource)

Mary Evans發表於
Have you tried to use a RELATIVE url for the particular resource page you want to link to?

If not try setting up a hyperlink from one resource page to another using a relative url...

for example:

<a href="../resource/view.php?inpopup=true&id=7" >Related Topic</a>

Mary







In reply to Mary Evans

Re: Linking from one web page (resource) to another web page (resource)

Michael Heraghty發表於
Hi Mary,

Thanks for that suggestion. Yes, I guess that will work 微笑 It certainly will solve issue 2 ... but do you know whether it will solve issue 1?

For example, if I were to save a course, using relative URLs in this way, would I be able to export it to other installations of Moodle, or even other LMSs?
In reply to Michael Heraghty

Re: Linking from one web page (resource) to another web page (resource)

Mary Evans發表於
At a guess I would say yes, because, technically, it would make no difference where the moodledata folder, which stores the mod folder, which houses the resource files, is. But then again, I don't know how an imported course would work in Moodle, or any other LMS package, not having any experience in that field, but I sure would like to be able to try and emulate the problem you face, just to find out where further problems may be, or may not be, for that matter!


Mary
In reply to Mary Evans

Re: Linking from one web page (resource) to another web page (resource)

Brent Gamble發表於

I have  a similair problem

I can set up a search function within the main header block and by using "adding  a label"can create a quick search tool for students so that they can click on a number and go direct to that topic block

it is alliabsolute reference - have you got some HTML that i could se that would make it a relative URL

cheers

brent

In reply to Brent Gamble

Re: Linking from one web page (resource) to another web page (resource)

Mary Evans發表於
Yes...in my post I added the actual link I used in my example. All you need to do is delete the part from your actual ABSOLUTE link from the http:// through to just before the resouce directory and in place of the part you delete with ../ (2 dots forward slash) this is in effect a 'short hand' which makes it RELATIVE to the files within your Moodle directory...since all your resource pages will be stored in the same directory, or should be if generated by using the 'Add a Resouce' option in Moodle.

So for example... if you go to my Moodle test site HERE - this is a resource page I have linked to another page which has a related topic...this is the HTML I used for that related topic link...

Related Topic:
<a href="../resource/view.php?inpopup=true&id=7">Why use styles?</a>

The ABSOLUTE reference to that particular page is...
http://visible-expression.co.uk/moodle/mod/resource/view.php?inpopup=true&id=7

So you can see I have replaced this part of the hyperlink ...
http://visible-expression.co.uk/moodle/mod
with ../ which transforms it into a RELATIVE reference point which I used in my hyperlink.

Hope this all helps?

Mary



評比平均分數:Useful (1)
In reply to Mary Evans

Re: Linking from one web page (resource) to another web page (resource)

Brent Gamble發表於

thanks mary thats brilliant- will play with this code

In reply to Michael Heraghty

Re: Linking from one web page (resource) to another web page (resource)

Pauline McNamara發表於

Hi all,

Came upon this because I've run into this particular problem with a course backup that was restored to the same installation.

Michael asked:
"For example, if I were to save a course, using relative URLs in this way, would I be able to export it to other installations of Moodle, or even other LMSs?"

Alas, no.

Apparently the resources are assigned new ids, breaking those absolute links. That means a relative link wouldn't work either. I

've only actually experienced this with a course copy restored to the same Moodle installation, but I suspect that they'd get new ids in a different installation of Moodle also (so as not to duplicate any existing ids in Moodle, I guess?).

I'm in the process of fixing those broken links now, quite a pain. If anyone else has a solution for this it would be great to hear it!


Best,
Pauline
In reply to Pauline McNamara

Re: Linking from one web page (resource) to another web page (resource)

Brent Gamble發表於

Unfortunately no solution but i can confirm that restoring to a different installation of moodle also breaks the links

we usualy build links in the site

Brent

In reply to Brent Gamble

Re: Linking from one web page (resource) to another web page (resource)

Pauline McNamara發表於
Thanks for the confirmation Brent.

What do you mean by "build links in the site"?


I ended up removing an absolute link that we had on every resource page. Others we will have to discover as they come up.


Best,
Pauline
In reply to Pauline McNamara

Re: Linking from one web page (resource) to another web page (resource)

Brent Gamble發表於

sorry shouldve been more specific

what i meant was that we usually build these absolute links in the site that is going to be used by the student for the semester ( hence the absolute reference that usues the site ID stays for that semester. but we still have  a problem when restoring that site to a new site in the same environment for the next semester as the ID changes- i am looking at a way to do this withiout beaking lnks( linking from one web page to another web page but havnt found a solution as yet

cheers

B

In reply to Brent Gamble

Re: Linking from one web page (resource) to another web page (resource)

Tiffany Morgan發表於
What I have found is linking to a activity page using an absolute link (so linking to the list of forums for a course, or the the list of quizzes) will update and use the new course ID when I restore that course to create the new course at the beginning of the next semester. What will not update is is the link to the individual activities or resources.

I have tried creating the new course from a restore of an existing course and also as creating a course "shell" and then importing the existing content into the new shell. Didn't see much difference.

I would be very interested to hear any solutions for this! thanks!