[SOLVED] Stand-alone Latest Topics script!

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
User avatar
Tyz
Registered User
Posts: 4
Joined: Wed Apr 30, 2003 2:22 pm
Location: Holland, lwrden

Post by Tyz » Sun May 04, 2003 5:53 pm

Yes!! this was what i was looking for. Thank u all!!
:D :D :D

alexela
Registered User
Posts: 41
Joined: Sat Dec 14, 2002 6:12 am
Location: SF Bay Area
Contact:

How to add topics php script to the tpl file

Post by alexela » Sun May 04, 2003 8:07 pm

I wasn't able to get the Topics Anywhere mod working - so I want to replace it with this script... if I place Antony's script into a php page called scrolling_topic.php how do I then get this info placed into my tpl page?

Here's a link to the page I want recent topics listed on:
http://www.alexmitchell.com/client/albu ... ?user_id=2

Thanks.
graphic & web site design
www.marmalade.com & www.alexmitchell.com

dvduval
Registered User
Posts: 74
Joined: Sun Jul 28, 2002 4:57 am
Contact:

Post by dvduval » Sun May 04, 2003 9:11 pm

THe main problem I see with this Mod is it lists private forums. How could we exclude posts from private forums?
PHP Link Directory - one of the best free link directory scripts available.

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Re: How to add topics php script to the tpl file

Post by Shantra » Sun May 04, 2003 9:56 pm

alexela wrote: I wasn't able to get the Topics Anywhere mod working - so I want to replace it with this script... if I place Antony's script into a php page called scrolling_topic.php how do I then get this info placed into my tpl page?

Here's a link to the page I want recent topics listed on:
http://www.alexmitchell.com/client/albu ... ?user_id=2

Thanks.


If your tpl is a php file, all I you need to is to include it. <?php include("scrolling_topic.php"); ?> where you want the code to be placed.

Antony
Registered User
Posts: 529
Joined: Wed Feb 12, 2003 9:06 am

Post by Antony » Sun May 04, 2003 10:08 pm

<iframe src="blah.php"></iframe>
I've Been Banned!

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Post by Shantra » Sun May 04, 2003 10:19 pm

dvduval wrote: THe main problem I see with this Mod is it lists private forums. How could we exclude posts from private forums?


I think you should add a: WHERE auth_read = 0

This should get topics from forums where ALL can read.
I think this should work :roll: , but are not sure.

Matt Z
Registered User
Posts: 17
Joined: Sat May 03, 2003 11:46 am

Post by Matt Z » Sun May 04, 2003 11:19 pm

is there a way that, instead of

auth_read = 0

you could set it equal to the user's authorization? (I don't know php, and haven't looked at the file, so I'm totally guessing here...) I don't know if there is a user_auth variable, but if there is, or something equivalent--i'll call it var_name, just so It's obvious that I'm not referring to some existing variable that serves an entirely different purpose :wink: -- then would something that looked like this work? (once again, I assume that since 0 is general read, the numbers increase with higher exclusiveness...)

auth_read =< var_name

If I'm totally off, then just ignore me, I won't mind :)
-Z-

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Post by Shantra » Mon May 05, 2003 12:29 am

Matt Z,

Your not totally off :D
0 is equal to the user's authorization. Higher numbers is restricted. Ex 2 = Private (I think)

Try this:

Code: Select all

$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username 
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u 
WHERE t.topic_id = p.topic_id AND 
f.forum_id = t.forum_id AND 
t.topic_status <> 2 AND 
p.post_id = t.topic_last_post_id AND 
p.poster_id = u.user_id AND f.auth_read = 0 ORDER BY p.post_id DESC LIMIT $topicnumber"; 
Note the new code: AND f.auth_read = 0

I cant think of other ways of doing it.
I'm not exactly a wizard in php myself :D

dvduval
Registered User
Posts: 74
Joined: Sun Jul 28, 2002 4:57 am
Contact:

Post by dvduval » Mon May 05, 2003 12:42 am

I'm still learning sql statements. I tried a couple of things, but I can't get it to work. If anyone figures out how to exclude posts to private forums, I hope you'll show me.
Thanks.
PHP Link Directory - one of the best free link directory scripts available.

dvduval
Registered User
Posts: 74
Joined: Sun Jul 28, 2002 4:57 am
Contact:

Post by dvduval » Mon May 05, 2003 12:51 am

What about the non-scrolling version that you submitted as a Mod Request?
PHP Link Directory - one of the best free link directory scripts available.

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Post by Shantra » Mon May 05, 2003 12:54 am

dvduval wrote: I'm still learning sql statements. I tried a couple of things, but I can't get it to work. If anyone figures out how to exclude posts to private forums, I hope you'll show me.
Thanks.


First of all, which code do you refer to: Rikkis, Antony's or mine?

The above code is for Antony's.. Just replace this bit with the original one.
This code should exclude posts (including Private) other then those ment for ALL.

But as I said, I have not tested it to see if it works :roll:

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Post by Shantra » Mon May 05, 2003 1:07 am

dvduval wrote: What about the non-scrolling version that you submitted as a Mod Request?


To exclude others then ALL in my code, do the following:

EDIT EDIT EDIT
The code I posted here was a little buggy
Last edited by Shantra on Mon May 05, 2003 7:12 am, edited 1 time in total.

alexela
Registered User
Posts: 41
Joined: Sat Dec 14, 2002 6:12 am
Location: SF Bay Area
Contact:

Post by alexela » Mon May 05, 2003 5:44 am

Shantra wrote: replace with this:

Code: Select all

$query = mysql_query("SELECT topic_id, topic_title, topic_poster, topic_replies, topic_views, user_id, username, auth_read FROM $tbtopics, $tbforums LEFT JOIN $tbusers ON $tbtopics.topic_poster=$tbusers.user_id WHERE topic_status = 0 AND auth_read = 0 ORDER BY topic_id DESC LIMIT $numtopics"); 


Shantra I ended up using your code for the topics and the iframe code on the tpl page. It was working great until I added the new mod above... now the topics are limited to the public forums but they are repeating three times for each topic and then the next topic displays and repeats three times. I changed the table output to only show topics since I am using this in a sidebar. This is the only change I made:

Code: Select all

while ($row = mysql_fetch_array($query)) 
{
$topic_title = stripslashes($row[topic_title]); 
echo "<tr><td class= \"topicsbg\">"; 
echo "<a href=\"" . $forumpath . "/viewtopic.php?t=" . $row[topic_id] . "\" target=\"_parent\"><font size=\"1\" color=\"#464892\"><b>" . $topic_title . "</b></font></a>"; 
echo "</td></tr>"; 
}
echo "</table>"; 
I don't think my change is the problem since this worked with the previous code you submitted.

Here's my page showing your code displaying topics in the sidebar.
http://www.alexmitchell.com/client/album.php

Is there a quick fix for this?

Thanks again for your hard work - this is the exact mod I was looking for. well done!
graphic & web site design
www.marmalade.com & www.alexmitchell.com

Shantra
Registered User
Posts: 59
Joined: Thu Jul 05, 2001 8:42 pm
Location: Norway

Post by Shantra » Mon May 05, 2003 7:10 am

alexela,
Thanks :) Looks like some bugs entered when I tried to add the new function, I didn't have time to check it.

My knowledge in the mySQL department comes to short here :roll:

PS! I'll edit the post with the buggy code!

User avatar
ebee
Registered User
Posts: 6
Joined: Wed Dec 03, 2003 3:49 pm
Location: East Kilbride
Contact:

Post by ebee » Wed Dec 03, 2003 3:55 pm

Rikki wrote: You can place it whereever you like as it doesnt not need access to the phpBB folder. It access the database directly.

Just place it in a PHP script (we use it in main.php) and it should work fine.

R.


Fancy meeting you here !! Seraching through yahoo trying to find a script for the web-site as i'm moving it onto MySQL and whose name comes up, but big old rikster... it's a small place this inter-web thingy :lol:
[ ebee ]
[ ebeedesigns.co.uk ]

Post Reply

Return to “[2.0.x] MOD Requests”