TinyPortal

Development => Support => Topic started by: Wichtlmex on May 27, 2019, 02:31:28 PM

Title: Article close/back button
Post by: Wichtlmex on May 27, 2019, 02:31:28 PM
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 (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
Title: Re: Article close/back button
Post by: lurkalot on May 28, 2019, 07: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.

<script>
    document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>
Title: Re: Article close/back button
Post by: lurkalot on May 28, 2019, 08: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
Title: Re: Article close/back button
Post by: Wichtlmex on May 28, 2019, 10:27:19 AM
GREAT! Thank you!
Title: Re: Article close/back button
Post by: Wichtlmex on May 29, 2019, 12:53:59 PM
Quote from: lurkalot on May 28, 2019, 07:29:37 AM

<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
Title: Re: Article close/back button
Post by: lurkalot on May 29, 2019, 05:25:30 PM
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.  ;)
Title: Re: Article close/back button
Post by: Wichtlmex on May 29, 2019, 07:11:00 PM
Good to know. I always doubt first of my competence before thinking it might be a system problem ;-)