Jump to content

Archived

This topic is now archived and is closed to further replies.

localhost

Help with tpl files and php

Recommended Posts

I am makign a forum display that needs to use a while statement to list all the threads, although it is fairly messed up because I cannot get it inside of the forumdisplay.tpl file!

code:
[code=php:0]
<?php
/*---------------------------------------------------+
| [dotOmega 0.1.0 Beta] Community System
+----------------------------------------------------+
| Copyright © 2006 Robert Playford
| http://dotomega.com
+----------------------------------------------------+
| Filename: forumdisplay.php - 07-28-2006 - 08:55AM
| File written by: Dan La Manna (Copernicus)
+----------------------------------------------------*/

// Require necessary file(s)
require_once "inc/global.php";
require_once "inc/config.php";
require_once "inc/class_template.php";

ini_set('error_reporting', E_ALL);

/*
Forum table types

Type 1 = Thread
Type 2 = Post

Note:
Threads have a tid of 0 ALWAYS
*/

$FID = secureGet($_GET['fid']);

// Find out the forum name!
$forum_name = query("SELECT `title` FROM `" . $config['table_prefix'] . "forums` WHERE `type` = '2' AND `id` = '$FID'");
$fetchname = fetch_array($forum_name);
$forum_title = $fetchname['title'];


// Select all threads that exist within the forum id $FID
$sel_threads = query("SELECT * FROM `" . $config['table_prefix'] . "posts` WHERE `type` = '1' AND `fid` = '$FID' ORDER BY `id` ASC");
$num_threads = num_rows($sel_threads);

// Query failed error message
if(!$sel_threads) {
echo 'Could not query threads list.';
}

$tplObj = new tplSys("./");
    $tplObj->getFile( array(
        'forum_display' => 'templates/default/forum_display.tpl' )
    );

// Display it all!
    $tplObj->varRef( "forum_display", array(
"TITLE" => '.Omega Development Forums',
"FORUM" => "$forum_title",
"BOARDNAME" => ".Omega Development Forums",
"NEWTHREAD" => "<a href=\"newthread.php?fid=$FID\"><img src=\"images/newthread.gif\" border=\"0\"></a>"

)
    );


    $tplObj->parseDynamic("forum_display");

// Loop to fetch thread info and display it
while ($fetch_thread_info = fetch_array($sel_threads)) {
$thread_title = $fetch_thread_info['title'];
$thread_id = $fetch_thread_info['id'];
$thread_poster = $fetch_thread_info['poster'];

$tplObj = new tplSys("./");
    $tplObj->getFile( array(
        'forum_threads' => 'templates/default/forum_threads.tpl' )
    );

$tplObj->varRef( "forum_threads", array(
"THREADNAMEANDSTARTER" => "<A href=\"showthread.php?fid=$FID&tid=$thread_id\">$thread_title</a><br>by <a href=\"viewprofile.php?u=$thread_poster\">$thread_poster</a>",
"LASTPOST" => "Not implemented",
"REPLYCOUNT" => "x",
"VIEWCOUNT" => "x"
)
);

$tplObj->parseDynamic("forum_threads");

}



?>
[/code]

And this is what I get!
http://system.dotomega.com/forumdisplay.php?fid=2

Share this post


Link to post
Share on other sites
It would appear to be an error in the templating system.  It isn't doing the regular expression match/replace correctly.  You may want to reference the template creator's website and documentation.

Share this post


Link to post
Share on other sites
I made the template, and it shows everything, I just need the while loop to be within {LISTTHREADS}

This has put a big halt on development and I really need this solved now.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.