Login

Lost Password?

Register

Register
YourArcadeScript Forum
YAS Staff Members:
jason of Jasminrocks and etc
royal of Flash Pilot


If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Latest topics - mostviewed - latestposts
03-14-2015, 05:43 AM (This post was last modified: 03-20-2015 09:30 AM by Davie.)
Post: #1
Latest topics - mostviewed - latestposts
Here is latest topics for left or right column.

Make a php file and copy this code.
PHP Code:
<div class="nav_box"><div class="nav">Latest Topics</div>
<
div class="nav_box2">
<?
php
$query 
yasDB_select("SELECT id,date,subject,name FROM forumtopics order by id desc limit 5");
while(
$row $query->fetch_array(MYSQLI_ASSOC)) {
$subject $row['subject'];
$date $row['date'];
$name $row['name'];
if (
$setting['seo'] == 'yes') {
$topiclink $setting['siteurl'].'forumtopics/'.$row['id'].'/1.html';
} else {
$topiclink $setting['siteurl'] . 'index.php?act=forumtopics&id='.$row['id'];
}
?>
<a href="<?php echo $topiclink;?>"><?php echo $subject;?></a><br /><?php echo $name;?> - <?php echo $date;?><br>
<?php
}
$query->close();
?>
</div>
</div> 

mostviewed.php
PHP Code:
<div class="nav_box"><div class="nav">Most Viewed Topics</div>
<
div class="nav_box2">
<?
php
$query 
yasDB_select("SELECT id,subject,views,date,name FROM forumtopics ORDER BY views DESC LIMIT 5");
while (
$row $query->fetch_array(MYSQLI_ASSOC)) {
$id $row['id'];
$subject $row['subject'];
$date $row['date'];
$name $row['name'];
if (
$setting['seo'] == 'yes') {
$topiclink $setting['siteurl'].'forumtopics/'.$row['id'].'/1.html';
} else {
$topiclink $setting['siteurl'] . 'index.php?act=forumtopics&id='.$row['id'];
}
echo
'<a href="'.$topiclink.'">'.$subject.'</a><br />' $name ' - '$date .'<br>';
}
$query->close();
?>
</div>
</div> 

latest_posts.php
PHP Code:
<div class="nav_box"><div class="nav">Latest Posts</div>
<
div class="nav_box2">
<?
php
$query 
yasDB_select("SELECT * FROM forumposts");
if (
$query->num_rows == 0) {
    echo 
'<center><h3>We have no posts yet!</h3></center>';
}
else { 
    
$query yasDB_select("SELECT forumtopics.id, forumtopics.subject, forumposts.date, forumposts.name FROM forumtopics INNER JOIN forumposts ON forumposts.topic = forumtopics.id ORDER BY forumposts.id DESC LIMIT 5");
while(
$row $query->fetch_array(MYSQLI_ASSOC)) {
    
$id $row['id'];
    
$subject $row['subject'];
    
$date $row['date'];
    
$name $row['name'];
    if (
$setting['seo'] == 'yes') {
        
$topiclink $setting['siteurl'].'forumtopics/'.$id.'/1.html';
        } else {
        
$topiclink $setting['siteurl'] . 'index.php?act=forumtopics&id='.$id;
    }
?>
<a href="<?php echo $topiclink;?>"><?php echo $subject;?></a><br /><?php echo $name;?> - <?php echo $date;?><br>
<?php }
}
$query->close();
?>
</div>
</div> 

Add this code to forum.php
PHP Code:
<div class="boxheader">Latest Posts</div>
<
div class="middlewrapperbox">
<
table width="100%" cellpadding="4" cellspacing="1">
<
tr>
<
td width="25%" align="left">Topic</td>
<
td width="25%" align="left">Post</td>
<
td width="25%" align="left">User</td>
<
td width="25%" align="left">Date</td>
</
tr>
<?
php
$query 
yasDB_select("SELECT * FROM forumposts");
if (
$query->num_rows == 0) {
    echo 
'<center><h3>We have no posts yet!</h3></center>';
}
else { 
    
$query yasDB_select("SELECT forumtopics.id, forumtopics.subject, forumposts.text, forumposts.date, forumposts.name FROM forumtopics INNER JOIN forumposts ON forumposts.topic = forumtopics.id ORDER BY forumposts.id DESC LIMIT 5");
while(
$row $query->fetch_array(MYSQLI_ASSOC)) {
    
$rowurl $row['text'];
    
$rowurl str_replace(" ""-"$rowurl);
    
$rowurl str_replace("'""_"$rowurl);
    
$rowurl str_replace('"'"_"$rowurl);
    
$rowurl str_replace('/'"_"$rowurl);
    
$rowurl str_replace("\\""_"$rowurl);
    
$rowurl rawurlencode($rowurl);$row['text'] = stripslashes($row['text']);
    if ( 
strlen($row['text']) > 10) {
        
$row['text'] = substr($row['text'], 025)."...";
    }
    
$id $row['id'];
    
$subject $row['subject'];
    
$text $row['text'];
    
$date $row['date'];
    
$name $row['name'];
    if (
$setting['seo'] == 'yes') {
        
$topiclink $setting['siteurl'].'forumtopics/'.$id.'/1.html';
        } else {
        
$topiclink $setting['siteurl'] . 'index.php?act=forumtopics&id='.$id;
    }
?>
<tr>
<td width="25%" align="left">
<a href="<?php echo $topiclink;?>"><?php echo $subject;?></a>
</td>
<td width="25%" align="left">
<?php echo $text;?>
</td>
<td width="25%" align="left">
<?php echo $name;?>
</td>
<td width="25%" align="left">
<?php echo $date;?><br>
</tr>
<?php }
}
$query->close();
?>
</td>
</table>
</div> 

open rightcolumn.php and add this code before the "else" word } else {
PHP Code:
elseif ($_GET['act'] == 'forumtopics') {
    include (
"templates/$setting[theme]/rightcolumn/membersmenu.php");
    include (
"templates/$setting[theme]/rightcolumn/latest_topics.php");
        include (
"templates/$setting[theme]/rightcolumn/latest_posts.php");
    include (
"templates/$setting[theme]/rightcolumn/mostviewed.php");
} elseif (
$_GET['act'] == 'forumcats') {
    include (
"templates/$setting[theme]/rightcolumn/membersmenu.php");
    include (
"templates/$setting[theme]/rightcolumn/latest_topics.php");
        include (
"templates/$setting[theme]/rightcolumn/latest_posts.php");
    include (
"templates/$setting[theme]/rightcolumn/mostviewed.php");


Or just add these lines.
PHP Code:
include ("templates/$setting[theme]/rightcolumn/latest_topics.php");
include (
"templates/$setting[theme]/rightcolumn/mostviewed.php");
include (
"templates/$setting[theme]/rightcolumn/latest_posts.php"); 

Need help with css please ask,anything else don't......
Reply
03-15-2015, 08:55 PM (This post was last modified: 03-15-2015 09:23 PM by royal.)
Post: #2
RE: Latest topics - mostviewed - latestposts
fix

PHP Code:
$query yasDB_select("SELECT * FROM forumposts INNER JOIN forumtopics ON forumposts.id=forumtopics.id ORDER by forumposts.id ASC limit 5"); 

[Image: 2ive7ac.jpg]
Reply
03-16-2015, 10:01 AM
Post: #3
RE: Latest topics - mostviewed - latestposts
I tried your sql but its not the correct one.

This is the way it should show

topic = subject forumtopics
name + date name and date are from forumposts

When a post is made in a topic it should show you the output above ^
so all we want is the name and date from that post and the name of the topic it was made in.

I don't know about you but am scratching me head with this one.

Need help with css please ask,anything else don't......
Reply
03-20-2015, 05:20 AM
Post: #4
RE: Latest topics - mostviewed - latestposts
I have updated this topic with new code for latest posts also made for forum.php.

   
   

Need help with css please ask,anything else don't......
Reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)


Powered By MyBB, © 2002-2017 MyBB Group.
Theme designed by Marvel (Sidebar created by Yaldaram - Yaldaram.com)
Copyright © 2017 YourArcadeScript Home - All rights reserved.