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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,991
  • Total Topics: 21,323
  • Online today: 545
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 355
  • Total: 355

Need help with something

Started by WildGunsTomcat, February 05, 2009, 09:05:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WildGunsTomcat

Hey guys,

I'm fairly new to SMF and Tinyportal and I did an search of the forums and didn't see a post asking this so I'm going to give it a shot.

I would like to be able to take ONE post from my forums and display it as an article on my front page of Tiny Portal. I would like to be able to see the icon of the poster, and have a comment link on that article/post that would open up the post in the forum...effectively taking them into the post on the forum.

I am a total noob as far as this goes...so any help would be MOST appreciated. I must iterate...I don't like the way forum posts are currently displayed by tinyportal...I want them to look more like articles.

My website is www.cruciblegaming.com

Thanks in advance!

ed_m2

i have a custom page that does something similar i think....

look at http://www.covtri.co.uk/index.php?page=15&tid=311, if the functionality is close i'll post up the code.

WildGunsTomcat

Quote from: ed_m on February 05, 2009, 09:37:04 AM
i have a custom page that does something similar i think....

look at http://www.covtri.co.uk/index.php?page=15&tid=311, if the functionality is close i'll post up the code.

That is DAMN close to what I want. The only thing I would add is an Icon of the poster on the top left. Is that something that can be done?


ed_m2

#3
Quote from: WildGunsTomcat on February 05, 2009, 09:39:09 AM
Quote from: ed_m on February 05, 2009, 09:37:04 AM
i have a custom page that does something similar i think....

look at http://www.covtri.co.uk/index.php?page=15&tid=311, if the functionality is close i'll post up the code.

That is DAMN close to what I want. The only thing I would add is an Icon of the poster on the top left. Is that something that can be done?

... i expect so... although it would need a query from multiple tables... something i havent quite got my head around just yet !

[edit to add: looking at the code apparently i have got my head around it at some point before!]

ed_m2

here's my code.... in a php page....  with no frames as it attempts to reproduce the look of a TP article.

it actually returns the first post in the topic (tid) given in the url.
and the 'view discussion' link goes to the first post, it could go to the last i guess.
a few obvious bits of text & urls to edit.

i haven't shared this before so perhaps others can suggest improvements in the syntax.


$tid= $_GET['tid'];

if(is_numeric($tid))
    {

$request = db_query("SELECT subject, body, id_first_msg FROM smf_messages, smf_topics WHERE smf_messages.ID_MSG = smf_topics.ID_FIRST_MSG AND smf_topics.ID_TOPIC =" . $tid);

$result = mysql_fetch_assoc($request);


echo '
<div class="tborder tp_article_frame">
<div class="titlebg tp_subject">'

. $result['subject'] .

'</div>
<div class="tp_articletext">'

. doUBBC($result['body']) .

'<p align="right"><a href="http://www.covtri.co.uk/index.php?topic=' . $tid . '.msg' . $result['id_first_msg'] . ' ">
View forum discussion</a></p>

</div>
</div> ';

   }
    else
    {
        echo 'Invalid argument';
    }

WildGunsTomcat

Yeah I tried to plug it into a PHPBox module and it just says invalid argument...any suggestions?

ed_m2

Quote from: WildGunsTomcat on February 05, 2009, 11:53:44 AM
Yeah I tried to plug it into a PHPBox module and it just says invalid argument...any suggestions?

look at the link i posted.... you need to put a valid topic ID from your forum in the URL when you call the page.

ed_m2

#7
oh... in a block ? my stuff is in a page...... you'll need to define the tid variable instead of the GET command.

replace:
$tid= $_GET['tid'];

with

$tid= ??;

where ?? is the topic id you want to display

WildGunsTomcat

Yeah...still not doing it.

Where do I stick your original PHP? In the index template? And if so where?

ed_m2

Quote from: WildGunsTomcat on February 05, 2009, 01:26:09 PM

Where do I stick your original PHP? In the index template? And if so where?

nooo.. in a php article.

This website is proudly hosted on Crocweb Cloud Website Hosting.