0

At the url below there is a tag at the top left called "Big Picture Pubs". It leads to a table showing a compact list of tagged weblinks.

https://www.victoriasforestryheritage.o ... cture.html

Clicking on a link in the table leads only to the weblink title and the url connected to the weblink - in this case a link to publications held on Google Drive. To access the publication you obviously follow the url displayed.

I would like to remove this middle step and provide for the link in the table to directly access and open the publication in a new tab. I have used tagged weblink tables in articles, and positioned in modules using the menu item url, across the site. (See also Tagged Lists arising from links in buttons:

https://www.victoriasforestryheritage.org.au/resources/site-library.html#general-publications

All the places and ways I have used them give the same outcome. I cannot see any Option in the tag or weblink components to change the way tagged items are displayed.

I note that weblinks I have used elsewhere have the term "task=weblink.go.........." within the url (and I know this provides direct access to the item) and those in the tag table do not.

For example, in Chrome Dev Tools I edited one of the links to add "task=weblink.go"

Original link - a href="/component/weblinks/weblink/433-a-history-of-forestry-in-australia-doc0005.html?catid=94&Itemid=486" A History of Forestry in Australia. doc0005

Edited Link - a href="/component/weblinks/weblink/433-a-history-of-forestry-in-australia-doc0005.html?task=weblink.go&catid=94&Itemid=486" A History of Forestry in Australia. doc0005

It worked - so the key is to get this task added into each link as the table is prepared.

I assume a template override will address the issue - but while I understand the process by which overrides are created I do not understand PHP. I have looked through what I think are the relevant template tables (com_weblinks and com_tags) and cannot see any code that may be relevant, and even if I did see it would not know how to amend it to get the outcome I want.

Can anyone please provide me with what I assume is a snippet of code in the correct place in the correct table to resolve this issue for me?

Richard

1 Answer 1

0

Short Answer:

Use Re-Replacer, https://regularlabs.com/rereplacer, to identify the tag links and insert the task=weblink.go into the link before the page is displayed.

In Re-Replacer you need to search for a line containing weblinks/weblink and html?catid= and then replace the html?catid= with html?task=weblink.go&catid=. html?catid= may appear in links for other extensions therefore you have to make sure you are only working with weblink created links.

Long Answer:

The task=weblink.go is only applied to the link if you are counting clicks, a setting in the options for the com_weblink extension, and this occurs in the HtmlView class for weblink categories. In this class the segments of link are constructed(the elements after the ?) and passed to Router to construct the rest of the link(everything to the left of the ?).

The use of Tags goes through a very different process to construct the link, it is more generic as it has to work with any number of extensions, and from what I can see in the process there is little opportunity to change the processing in the way you want.

Your idea of putting code into a template override might be possible with a fair bit of effort and then you, or someone, has to maintain that code/override each time a template changes or upgrades occur.

Hence the Re-Replacer solution ideal as it is independent of any changes to templates or underlying code, making the change(s) after the page is render but before it is displayed to the visitor.

3
  • Thank you so much for the information. We will give it a go.
    – Richard
    Commented Jan 27 at 1:27
  • A colleague who knows far more than I about this stuff has fixed the issue using re-replacer. Thank you again for the response. I am sure we would still be floundering without your assistance.
    – Richard
    Commented Jan 30 at 5:29
  • Good to hear the answer has been helpful and the issue resolved. If you could Accept the answer to mark it as being solved.
    – Irata
    Commented Jan 30 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.