News: TinyPortal Release Schedule. Please read this update for More Info.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

September 15, 2019, 08:49:01 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3752
  • Latest: Alizee
Stats
  • Total Posts: 188888
  • Total Topics: 20752
  • Online Today: 80
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 34
Total: 34

Author Topic: Article close/back button  (Read 430 times)

0 Members and 1 Guest are viewing this topic.

Offline Wichtlmex

  • Jr. Member
  • **
  • Posts: 88
Article close/back button
« on: May 27, 2019, 07:31:28 AM »
Hi,
when I open an article I would like to give the user the chance to go back or close the article.
As you can see in
http://www.ecotec2000.de/forum/index.php
after opening the "-no title-"s, some article appear. Click e.g. "Titel1 Artikel Coro" and the message opens but only via browser back or the site map, you can return back. Any ther possibility? Like e.g. the collapse function?
Regards
Michael
SMF 2.1 RC1, TP 1.6.3

Offline lurkalot

  • Administrator
  • *
  • Posts: 6216
    • Camera Craniums
Re: Article close/back button
« Reply #1 on: May 28, 2019, 12:29:37 AM »
Thing is, when you "open" an article you're actually navigating to another page, so the only way is to use the menus.  Or like we did with the "Back to Top" buttons here, you can add a bit of code to the actual article and it will create a back button.

Something like this should work.

Code: [Select]
<script>
    document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>
« Last Edit: May 28, 2019, 01:22:54 AM by lurkalot »

Offline lurkalot

  • Administrator
  • *
  • Posts: 6216
    • Camera Craniums
Re: Article close/back button
« Reply #2 on: May 28, 2019, 01:20:56 AM »
Further to my post above, I've added that back link to a article on my test site, https://cctestsite.info/testsite3/index.php

If you click the links tab you'll see it on the bottom left of that page.

Nice thing about that back link, it shows the page url you'll return to on hover.

Anyway, that's one solution.  You could put this in a separate block with no frame or title options if you like, then show it wherever you like, or just add it directly to the articles. 

It will work with a bbc article too, but you'll have to hit the toggle view button before adding that code and saving.

Hope this helps.

Also other solutions available if you google, html back button

Offline Wichtlmex

  • Jr. Member
  • **
  • Posts: 88
Re: Article close/back button
« Reply #3 on: May 28, 2019, 03:27:19 AM »
GREAT! Thank you!
SMF 2.1 RC1, TP 1.6.3

Offline Wichtlmex

  • Jr. Member
  • **
  • Posts: 88
Re: Article close/back button
« Reply #4 on: May 29, 2019, 05:53:59 AM »

Code: [Select]
<script>
    document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>

Hi Lurkalot:
There is a tiny problem with this code: It only works ONCE ;-)
I can attach it to the article and it works.
When clicking on the EDIT button and even without editing anything, this code is modified by the editor and it will not run again!

regards
Michael
SMF 2.1 RC1, TP 1.6.3

Offline lurkalot

  • Administrator
  • *
  • Posts: 6216
    • Camera Craniums
Re: Article close/back button
« Reply #5 on: May 29, 2019, 10:25:30 AM »
Yep, if you modify the bbc article in any way you'll have to hit the toggle view button, and paste code in again before you hit save.

Editors have a mind of their own unfortunately.  ;)

Offline Wichtlmex

  • Jr. Member
  • **
  • Posts: 88
Re: Article close/back button
« Reply #6 on: May 29, 2019, 12:11:00 PM »
Good to know. I always doubt first of my competence before thinking it might be a system problem ;-)
SMF 2.1 RC1, TP 1.6.3