Linking to a label

Linking to a label

by William Mair -
Number of replies: 7

Is it possible to link directly to a label resource? If so, what should the URL look like?

Basically, I have several labels on the frontpage (so can only use one topic), and want users to be able to a specific one.

Any help would be greatly appreciated.

Any small tweaks to code to make it happen would be looked into too.

Thanks

Average of ratings: -
In reply to William Mair

Re: Linking to a label

by William Mair -

Anyone?

In reply to William Mair

Re: Linking to a label

by Robert Brenstein -
Labels have no links to view them, so no, you can't provide links to them. At best, you can use a link to the section they are in. You can link to edit them but such links require proper rights to work.

Having said that, I am not sure whether you really mean what Moodle calls labels. Your statement of problem is somewhat ambiguous.
In reply to Robert Brenstein

Re: Linking to a label

by William Mair -

On my front page I am looking to have several label resources (possibly around 15-20 hidden/shown based on user profile fields) for navigation. 

Some users may see 5-6 of these and instead of scrolling down, I wanted to be able to put links in a label resource at the top that I could use to jump down the page to the required label and wondered how I could do that.

I could set it up so that the frontpage redirects to a course page and set the course out in a standard way and link to sections, but I would rather not go down that route. I can't jump to different sections on the frontpage either as there is only one section on the frontpage (unless someone tells me differently).

I hope that makes more sense.

In reply to William Mair

Re: Linking to a label

by Robert Brenstein -
Yes, there is only a single section on the front page. Yes, you can put links into labels.

Labels are normally either shown or hidden and are not user-specific, so you must have some local modification that they behave in the way you describe.

If you need links within the same section, those label resources must be rather big. It sounds to me that your setup might require lots of reading, navigation, scrolling up and down, and thus won't be very user-friendly. I wonder whether it would not be better to use the page or book resources instead of labels, so only titles are shown and users see the actual content if they click on the selected item -- same as clicking links in your design but the front page will be shorter and clearer.
In reply to William Mair

Re: Linking to a label

by Floyd Saner -

William,

One idea to try is the following:

  1. The top-most label should contain just an anchor tag.  The html code will be something like <p id="labels"></p>  Nothing will show in the label box because it contains only an anchor.

  2. Create a link to the anchor

    1. Create a link to the anchor in the front page area. This will likely be another label.  The html code will be something like <a href="#labels">Information for you</a>  Clicking that link will jump to the anchor position in the page, and if you have the label access restrictions set properly, user will see only those labels open to them.

    2. Another option is to create a User Menu item that links to the above anchor. However access to this is reserved for system administrators, so creating the link as specified above is probably the best option.
Average of ratings: Useful (2)
In reply to Floyd Saner

Re: Linking to a label

by William Mair -

I have to admit that was my next fallback solution (with my last being to redirect to a standard course page).

I just wanted to know if anyone had a better solution (it just seems strange that you can't reference a specific label in Moodle). 

In reply to William Mair

Re: Linking to a label

by William Mair -

One concern I had with that suggestion was that I had originally thought of adding in additional 'jump to' labels in between the current labels, making the course longer, but I just put the id at the beginning html tag within the existing labels and it works perfectly.

Thanks