Making the title of an entry into a link

Making the title of an entry into a link

by Brendan Kilshaw -
Number of replies: 9

Hi,


Great module, we are exploring using it for a project but are struggling a bit with the documentation. I have a couple of questions:

  1. How do you make the title of an entry into a link to a single view? We have tried the method here (by adding the href tag into the entry template): https://docs.moodle.org/31/en/Dataform_FAQ#How_can_I_make_the_title_of_an_entry_into_a_link.3F but it seems to get stripped out when the page is rendered. What are we doing wrong?
  2. Is there a definitive list of patterns anywhere? I have seen it mentioned elsewhere that not all the patterns are in the UI or documentation.


Kind regards

Average of ratings: -
In reply to Brendan Kilshaw

Re: Making the title of an entry into a link

by Itamar Tzadok -

See if the approach suggested at https://moodle.org/mod/forum/discuss.php?d=256813#p1123734 works for you.

A definitive list of patterns is definitely one of the features I'd like to implement sooner than later. The docs list patterns for some of the fields. See for instance Dataformfield entryactions at Dataform_Plugins.

hth smile

In reply to Itamar Tzadok

Re: Making the title of an entry into a link

by Brendan Kilshaw -

Thank you for the swift reply!

I have tried the method at https://moodle.org/mod/forum/discuss.php?d=256813#p1123734 but maybe I am getting it wrong?

I have tried:

##viewlink:Single view;Title;;##

in the Entry template, where 'Title' is our title field and 'Single view' is the name of the view, is that the correct format?


Many thanks in advance.

In reply to Brendan Kilshaw

Re: Making the title of an entry into a link

by Itamar Tzadok -

Not quite. But in any case this pattern is actually designed for the view template and doesn't work in the entry template. Have you tried the following format? (remove redundant spaces between brackets)

<a href="##viewurl:Single view##&[[entryid] ]">[[Title] ]</a>

It seems to work on my end.

smile

In reply to Itamar Tzadok

Re: Making the title of an entry into a link

by Brendan Kilshaw -
Ah, yes I did wonder whether I was using the correct format for the entry template.

However, we still cannot get this to work.

If I use your suggested format we still get a completely empty table cell, no content at all.

We also get a 'Suspect patterns found" warning for the  entryid pattern.

Any ideas?

In reply to Brendan Kilshaw

Re: Making the title of an entry into a link

by Itamar Tzadok -

Can you post a screenshot of your entry template?

The entryid pattern is a legitimate suspect. It will be replaced by an internal field which will provide the pattern.

smile

In reply to Itamar Tzadok

Re: Making the title of an entry into a link

by Brendan Kilshaw -

Hi Itamar,


Here we go:


Thank you for your help with this.

smile

In reply to Brendan Kilshaw

Re: Making the title of an entry into a link

by Itamar Tzadok -

The aligned view was actually designed to use simple patterns in the content columns. For custom html you should use other view types. You can use the tabular view for a tabular effect. You can also use  the grid view by setting the entry template as the tr of the entry and then enclosing the ##entries## in the view template with the table tags and header row if needed (although the editor may attempt to "fix" the broken html if you don't disable it).

smile

In reply to Itamar Tzadok

Re: Making the title of an entry into a link

by Brendan Kilshaw -

Thanks Itamar,


That is now displaying the title as a link but the link is wrong and we are still getting an error for the entryid pattern:

We are trying the following in the entry template:

<td class="cell c3" style="text-align:left;"><a href="##viewurl:Single view##&amp;entryid ">Title </a></td>


In reply to Brendan Kilshaw

Re: Making the title of an entry into a link

by Itamar Tzadok -

In what way the link is wrong? I'm assuming you have a view that is called 'Single view'. smile