localhost Posted August 2, 2006 Share Posted August 2, 2006 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 typesType 1 = ThreadType 2 = PostNote: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 itwhile ($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 Link to comment https://forums.phpfreaks.com/topic/16308-help-with-tpl-files-and-php/ Share on other sites More sharing options...
localhost Posted August 2, 2006 Author Share Posted August 2, 2006 Anyone please? This is fairly disappointing that I haven't gotten a response. Link to comment https://forums.phpfreaks.com/topic/16308-help-with-tpl-files-and-php/#findComment-68209 Share on other sites More sharing options...
hitman6003 Posted August 2, 2006 Share Posted August 2, 2006 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. Link to comment https://forums.phpfreaks.com/topic/16308-help-with-tpl-files-and-php/#findComment-68211 Share on other sites More sharing options...
localhost Posted August 3, 2006 Author Share Posted August 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/16308-help-with-tpl-files-and-php/#findComment-68215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.