TinyPortal

Development => Block Codes => Topic started by: The Wizard on November 20, 2010, 06:38:30 PM

Title: Call script problem
Post by: The Wizard on November 20, 2010, 06:38:30 PM
Link to my site: http://www.tribeuniverse.com
SMF version: 2.0 RC4
TP version: 1.0 RC1
Default Forum Language: English
Theme name and version:CurveLife
Browser Name and Version: IE
Mods installed:Tiny Portal, Aeva Media
Related Error messages: None

Hello:
I'm not too good at php, but you learn as you go on that. Anyway I need a little help with the code below. I'm tryning to get it to output something like this -

Quotehttp://www.tribeuniverse.com/index.php?page=319;Z=509

Where 509 is the posted message id.

This script is intened to list all the topics in a choosen board, create the topics as links and when you click on a topic link it will take you to page 319 where the second part of this script will show you only the first post. To pull this off I need this script to send the following data - Z= and the first post id to page 319.
Any help would be usefull.
Thanks

Quoteecho '<div style="background-image:url(\'http://www.tribeuniverse.com/tribe-images/tribe-images/big_backgrounds/nature.jpg\');"> ';

require_once('SSI.php');

// Include News Board (12) and limit to 1000 topic
// by The Wizard
$news = ssi_boardNews(12, 1000, null, null, 'array');

$P = 319;

foreach ($news as $topic)
{
// Test script below //
echo ('<a href="'.$topic['href'].'">'.$topic['subject'].'</a></br>');

// Real Script //
echo('<a href=" '.$scripturl. ?page=  . $P . msg . Z=$topic['id_msg'] . ' ">'.$topic['subject'].'</a></br>');


};
echo '
</div>';
Title: Re: Call script problem
Post by: IchBin on November 20, 2010, 08:03:31 PM
Maybe something like this:
echo '<div style="background-image:url("http://www.tribeuniverse.com/tribe-images/tribe-images/big_backgrounds/nature.jpg");">';

require_once('SSI.php');

// Include News Board (12) and limit to 1000 topic
// by The Wizard
$news = ssi_boardNews(12, 1000, null, null, 'array');

$P = 319;

if (!isset($_GET['Z'])) {

foreach ($news as $topic)
{

// Real Script //
echo'<a href="'.$scripturl. '?page='. $P .';Z='. $topic['message_id'] .'">'. $topic['subject'] .'</a></br>';

}
}
else {
$postID = (int) $_GET['Z'];

$output = ssi_fetchPosts($postID, false, 'array');

        foreach ($output as $post) {
echo '<h3> ' , $post['subject'] , '</h3>
<div> ' , $post['body'] ,  '</div>';
}
}
echo '
</div>';
Title: Re: Call script problem
Post by: The Wizard on November 20, 2010, 08:33:05 PM
YES!!!! YOU THE MAN IchBin!!

This has made my day!!! Works like a dream....

Note: I'm off tomorrow, and I will post all the code then and how to use the thing. I think some other users out there will want this feature and I'm thinking that if it was cleaned up a bit and a few more options added it might make a good addition to TP as a mod or whatever. I think this might be a easy way for admins to add posts to articles, or thats my reason anyway.

Thanks again to everybody who helped!

The Wizard
Title: Re: Call script problem
Post by: IchBin on November 20, 2010, 09:47:35 PM
Glad to help. You've done pretty good on your own if you ask me. :)