TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 09:23:26 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 212
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 79
  • Total: 79

External articles linking to forum thread

Started by Olemak, September 26, 2012, 11:30:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Olemak

I am using the TinyPortal Frontpage to present selected discussion threads.
Just clicking the "promote to front page" works well for this, and I've customized the way posts appear on the front page a little bit.
Feel free to look how this is set up on my site, The adress is:

byggebolig dot no

Now - to the issue: I'd prefer to use articles linking directly to the treads.
That would have several advantages:
* Write intro texts that only shows in the Front Page
* Use images without editing the original thread
* Manage the sequence of frontpage items by position

...and more. In fact, the advantages to doing it this way are so many that I always thought this was the way "link articles" was supposed to work.

But I just can't get that to work!

Seems to me that an "External article" is really a way to use "include" on content on or off the server. Frankly, I can't really get that to work either.

So what I am asking is: am I really dim and missing something elemental here, or do I need to modify the template to get this working the way described above?
Not being very good at PHP programming (yet :)), any pointers would be greatly appreciated!

IchBin

Sorry I don't understand what you are asking here. The forum post when displayed on the front page shows a link to the post. Do you want something more than that? You can't have intro's for forum posts because they are not saved and stored like the articles are. They are simply pulled from the table where SMF stores them. Thus, they don't have an intro or a position marker for them.

Olemak

I am sorry for my unclear post! I'll try to be clearer now.

Most CMS'es I've used has custom titles, images and intro texts for use on the  front page as a standard feature. The front page intro links directly to the promoted content, which may have a different main photo, headline or intro text.

That is what I'd like: the ability to post an "external link" (TP article, with title, intro text and image) that links directly to any URL.

The current system seems to use "external" articles to do an include on a file stored on the same server, and the link has to be relative to the location of the forum installation. That is great for one particular use (but I still can't get it to work), but I think that the name is rather misleading (I'd consider this an internal link). But even if the "External" article type worked, it would not really do the job, as I just want to link directly (not include content on a new page).

So - what I would like to do, is to make an article that contains:

Title
Intro text
URL
+ an image if possible.

When the article is clicked on the front page, the link destination is opened in the same window (although a target="_blank" could be an option).

This could be used to just open any link from the front page.
I would mostly use this to link to threads on the forum.
It could also be used to link to a particlar post, or to the last post in a thread.
Sometimes front page links to other resouces, such as a competition or a new feature, can be nice.

Why I would like to do this:
This would allow a much more "Newspapery" front page, with

  • Custom intro texts, written by moderators, which can describe the promoted thread (or other content) better than just the first part of the first post, which rarely reflect the full discussion following the first post. Introductions to threads on the front page would not be cut short in the mi[ddle of a sentence]. It would give more control over the front page.
  • Custom titles, same as above.
  • Selected images, cropped and 'shopped to work well on the front page - if desired.
  • Control over the sequence of articles on the front page, rather than having the promoted threads be sorted by the publication date of the first post. Some times old threads become very interesting after a while, and it would be good to sort them the same way articles can be sorted - by position, author or other parameters.

I hope I am able to describe this clearly - English is not my first language, sorry for any mistakes or lack of nuances.

I would really like this functionality, and I am prepared to try to cobble something together (it would be a new article type I guess). But not being very good at PHP (understatement!) I'd appreciate any pointers!

Or maybe this is already possibly through the use of some clever settings that I don't know about?

Please have a look at the front page for the forum I manage to get a better impression of what I am trying to do:
byggebolig dot no

My front page is getting there, but I don't like having to edit the first post in promoted threads in order to get an image on the front page, and I don't really like the way texts are arbitrarily cut short, or the fact that many good threads start with a poor first post, full of bad spelling and "Hi, I am new to this forum, and I was wondering how (etc etc). The first post is not necessarily front page material even if the rest of the thread is.

I'd appreciate any help or input!

IchBin

Your english is great. Much better than my complete lack of Norweigan. ;)

External for our use, means outside of TinyPortal. The external include option would also allow you to include a file from another site assuming your server configuration would allow such things. Just to be clear on what we mean anyway.

From what I gathered from your post though, I would say you can already do most of what you are asking with some minor exceptions. The caveat being that you have to use PHP articles for all of these. You can create an article with all of what you asked: title, intro text, URL, image etc. You can then point that article to any post you want on the forum. In the main body of the article you could just have a redirectexit('topic=2'); call to forward the person to the topic id of choice. Although this would require you doing all the articles yourself (because it has to be a PHP article type), or you make absolutely sure you trust those who you give access to PHP articles. A person who is not trustworthy can do all sorts of damage to your site if given access to write PHP articles. All the info you need you just put into the intro section and it should work out that way.

If you are looking for some automated way of doing all this though, that's a bit out of the question for the moment. I don't have the time to write a completely new way of doing articles into TP right now. Sorry.

Olemak

Brilliant! With redirectexit the link works exactly the way I want it to! Thanks!

However... Now I can't get the introduction text (which would also contain the image) to show... only the title shows is displayed.

When I change the article type to External Article then the "top" (with the embedded image and intro text) shows on the front page, as it should.
So I suspect that the use of introductions don't work the way it should for PHP articles? Or am I simply doing something wrong?

Thank you for your other comments too. I certainly see how something like this can be used to wreak havoc in the wrong hands.
I plan to keep the right to publish PHP articles exclusive to me, myself and I for the time being :)

Just to be absolutely clear: I do not expect you or anyone else to do this for me!
I am just looking for pointers, as I think this will be a great feature for our site when everything works the way I plan. Doing it manually like this is a little cumbersome, and maybe I'll try to make some sort of a simplified GUI for this eventually, when I (hopefully) get better at PHP stuff or get some help with it. Maybe something including an image uploading and resizing feature, and maybe a "Browse to the thread (or other content) your are redirecting to". Something like that could make this more foolproof (and more secure). I'll try to tinker with it a bit, teach myself along the way... I think I'll call it a "Redirect Article", that sounds about right.

But maybe that kind of duct-tape-and-gum tinkering would be a breach of TinyPortal service terms?

Again, thank you for your reply, that helps a lot!
I hope you have some insights to share regarding the introduction top not working for PHP articles too, if I can get that to work I am sorted!

IchBin

Remember it is PHP. So in the introduction if you want something to appear you have to use echo() (php code).

echo 'all your html and image stuff in between the single quotes and end with an semi-colon';

As for breaching TP terms. We have none. lol Well we do, and it's all stated in the MPL 2.0 license. We just hope that you keep the link on your site for us to get the exposure. You're even free to remove that provided you can figure it out. lol But we reserve the right not to support those who don't support us by keeping the link in the footer. Other than that, you are free to do with TP what you please.

The use of external articles is limited yes. It doesn't behave like the others with intro's etc.

Olemak

I had forgotten to remember that is is PHP!

Now it works beautifully, thank you so much!

While this works the way I want it to now, I'll try to figure out how I can turn this into a new article type, get a nice and simple interface for doing just exactly this and nothing else. A nice learning project for me, I should think, and it is also going to save me a lot of time eventually. When (if) I am happy with this, I could post the badly mangled code I'll produce here if there's any interest in this "Redirect Article" functionality. I can see myself using this a lot, so maybe others will have a use for it too.

I won't worry to much about the terms, then :)
But I'll never remove the link back here, even though I do know how to do it now :)

Again: thanks - you solved a big problem for me that has been holding my site back!

ZarPrime

Olemak,

Please feel free to post anything like that code if you feel that it will help other users of TinyPortal.  We would be glad to see it. O0

ZarPrime