Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top.php update to use templates instead of hardcoded HTML #5348

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion top.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@

$forumList = implode(',', $forum->getForumPermList('view'));

$sc = e107::getScBatch('view', 'forum');
$sc->wrapper('newforumposts_menu/main');

$qry = "
SELECT
t.*, u.user_name, ul.user_name AS user_last, f.forum_name
t.*, u.user_name, ul.user_name AS user_last, f.forum_name, f.forum_sef
FROM `#forum_thread` as t
LEFT JOIN `#forum` AS f ON f.forum_id = t.thread_forum_id
LEFT JOIN `#user` AS u ON u.user_id = t.thread_user
Expand All @@ -74,6 +77,53 @@

if ($sql->gen($qry))
{
// var_dump($sql);

if ($template = e107::getTemplate('forum','newforumposts_menu','main'))
//if (1 == 2)
{
// $tp = e107::getParser();
// if($results = $sql->gen($qry))
// {
// var_dump($sql);
// $sql1 = $sql;
// $sc = e107::getScBatch('view', 'forum');
// var_dump($sql);
// $sc->wrapper('newforumposts_menu/main');
// var_dump($sql);
// var_dump($sql1);

$text = $tp->parseTemplate($template['start'], true);

/// var_dump($sql);
while($row = $sql->fetch())
{
$row['thread_sef'] = $forum->getThreadSef($row);
$row['post_id'] = $row['thread_id'];
$row['thread_lastuser_username'] = $row['user_last'];
$row['thread_user_username'] = $row['user_name'];
// var_dump($row);
// var_dump(e107::getUrl()->create('forum/forum/view', array('id' => $row['thread_forum_id'])));
// $fsef = $sql->gen('forum_sef', '(*)', 'WHERE `thread_parent` = 0');
// var_dump($fsef);
$sc->setScVar('postInfo', $row);
$sc->setVars($row);
$text .= $tp->parseTemplate($template['item'], true, $sc);

++$total_topics;
$total_views += $row['thread_views'];
$total_replies += $row['thread_total_replies'];
}

$TOTALS = array('TOTAL_TOPICS'=>$total_topics, 'TOTAL_VIEWS'=>$total_views, 'TOTAL_REPLIES'=>$total_replies);

$text .= $tp->parseTemplate($template['end'], true, $TOTALS);
// }
$ns->tablerender(LAN_7, $text, 'nfp');
}
else
{
// var_dump($sql);
$text = "<div>\n<table style='width:auto' class='table fborder'>\n";
$gen = e107::getDate();

Expand Down Expand Up @@ -126,6 +176,7 @@
$parms = "{$ftotal},{$view},{$from},".e_SELF.'?[FROM].active.forum.'.$view;
$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}").'</div>';
$ns->tablerender(LAN_7, $text, 'nfp');
}
/*
require_once (e_HANDLER.'np_class.php');
$ftotal = $sql->db_Count('forum_thread', '(*)', 'WHERE 1');
Expand Down
Loading