Firefox PHP

Last X topics (and no posts)

Posted by Clément 
Re: Last X topics (and no posts)
March 22, 2005 07:45AM
you have to loop through $p and output all its content then with print or echo.

a simple debug-output can be shown with that:
[phorum.org]


Thomas Seifert
Re: Last X topics (and no posts)
September 06, 2005 11:38AM
hi i'm now trying to use the latestthreads.php but I keep getting this massage:
cannot connect to MySQL
I don't know what I am doing wrong

in the latestthreads.php i have this:

$host = $PHORUM[DBCONFIG][localhost];
$dbuser = $PHORUM[DBCONFIG][my_username];
$dbpass = $PHORUM[DBCONFIG][my_password];
$dbname = $PHORUM[DBCONFIG][my_name];
$table = $PHORUM[message_table];

is there more to be modified ?

I am sorry about these probably stupid questions, but I am new to this.

Regarts
Troels


Re: Last X topics (and no posts)
September 06, 2005 08:40PM
dragonbook Wrote:
-------------------------------------------------------
> hi i'm now trying to use the latestthreads.php but
> I keep getting this massage:
> cannot connect to MySQL
> I don't know what I am doing wrong
>
> in the latestthreads.php i have this:
>

$host = $PHORUM[DBCONFIG][localhost];
$dbuser = $PHORUM[DBCONFIG][my_username];
$dbpass = $PHORUM[DBCONFIG][my_password];
$dbname = $PHORUM[DBCONFIG][my_name];
$table = $PHORUM[message_table];
>
> is there more to be modified ?

You don't have a database connection, you could replace the above data with hardcoded values, so it doesn't take them from your phorum settings.

Just put the same info as in your Phorum db config file.

Or you could try to make it so that common.php gets loaded at some point.

---
-=[ Panu ]=-
Re: Last X topics (and no posts)
September 07, 2005 03:53PM
Hi

Thanks know the script is able to log on to the MySQL server, but I only get at blank page :-(

I have read the postes in this forum and tried to do this:

echo "<pre>";
print_r($p);
echo "</pre>";
array_multisort($pkey, SORT_DESC, $p);
echo "<pre>";
print_r($p);
echo "</pre>";

As you have described in another post, but nothing happens.

I have also tried to ad this to the end of the script:

{section name=i loop=$p}
<p>
<span class="time">{$p.datestamp}</span><br/>
{$p.subject}<br/>{$p.author}:&nbsp;{$p.body}
</p>
{/section}

but nothing happens.

What am I doing wrong ?

You can see how the document looks like right here: [www.dragonbook.frac.dk]
Re: Last X topics (and no posts)
September 07, 2005 05:52PM
dragonbook Wrote:
-------------------------------------------------------
> I have read the postes in this forum and tried to
> do this:
>
> echo "";
> print_r($p);
> echo "";
> array_multisort($pkey, SORT_DESC, $p);
> echo "";
> print_r($p);
> echo "";
>
> As you have described in another post, but nothing
> happens.

Do you get anything at all?

> I have also tried to ad this to the end of the
> script:
>
> {section name=i loop=$p}
>
> {$p.datestamp}
> {$p.subject}{$p.author}: {$p.body}
>
> {/section}
>
> but nothing happens.

Thats smarty tags, are you using and initialized it?

> What am I doing wrong ?

Did you read the comments on the script? Please comment (or remove) the line:
$smarty->assign("p", $p);

Your PHP is probably choking because you don't have a smarty object to assign anything to.

I may release yet another version with better documentation :)


---
-=[ Panu ]=-
Re: Last X topics (and no posts)
September 08, 2005 02:32AM
> Do you get anything at all?

Nope just a blank page

I will try to remove the $smarty->assign("p", $p); when I get home from work.

> I may release yet another version with better documentation :)

That would be very nice, because it isn't easy to make the script work, if you new to Phorum and php :-)

I have installed some other modules to Phorum, just by readying the readme.txt
Re: Last X topics (and no posts)
September 08, 2005 04:33AM
dragonbook Wrote:
-------------------------------------------------------
> I have installed some other modules to Phorum,
> just by readying the readme.txt

Well this isn't exactly a module :)

There's countless ways different people would like to present the results of that script so I decided not to display any html at all in the script. Partly because it's a bad habit to mix php and html and everyone should use somekind of templating anyway and partly because I'm lazy and just packaged a script that I did/modified for my own use.

I'll try to make it easier to get something out of the box sort of speak a little easier.



---
-=[ Panu ]=-
Re: Last X topics (and no posts)
September 08, 2005 07:07AM
Sounds great :-) THANKS
Re: Last X topics (and no posts)
September 15, 2005 03:37AM
Panu Wrote:
-------------------------------------------------------

> I'll try to make it easier to get something out of the box sort of speak a little easier.

Any progress ?

:-)
Re: Last X topics (and no posts)
September 15, 2005 04:50AM
Sorry I've been busy/lazy/tired and more or less forgot about this.

Did you manage to get the database connection working? You can copy username, password etc from phorums settings file and use them.

for example:

$host = "localhost";
$dbuser = "db_username";
$dbpass = "mypasword";
$dbname = "P5_database";
$table = "P5_messages";


You can find out the messages table-name (it's Phorum table prefix + messages, so mine is p5_messages) with phpmyadmin.

When you have working database connection you can try:

echo "<h2>";
echo $p[0]['author']." wrote about ".$p[0]['subject']." at ".$p[0]['datestamp']."</h2>";
echo "<p>".$p[0]['body']."</p>";

at the end of the script.

print_r($p) gives you the whole array.

---
-=[ Panu ]=-
Sorry, only registered users may post in this forum.

Click here to login