Jump to content
Sign in to follow this  

Primitīvs foruma jaunumu skripts

Recommended Posts

/* Norādam ceļu uz galveno foruma mapi*/
require $_SERVER['DOCUMENT_ROOT'].'/init.php';
$news_id = 2; /* Noregulējam no kura foruma sadaļas izvilkt jaunumus */
$limit = 5; /* Noregulējam cik jaunumus izvada */
$news	= \IPS\Db::i()->select( '*', 'forums_topics',[ 'forum_id=?', $news_id , 'topic_hiddenposts' ,0],'tid desc', $limit  );
$news = $news->join( 'forums_posts', 'forums_posts.pid=forums_topics.topic_firstpost', 'LEFT' );
foreach( $news as $row )
$news_link_fix = str_replace("<___base_url___>", rtrim(\IPS\Settings::i()->base_url,"/"), $row['post']);

<h1><a href="<?php echo\IPS\Settings::i()->base_url.'topic/'.$row['tid'].'-'.$row['title_seo'];?>"><?php echo $row['title'];?></a></h1>
<h4>Tēmu uzsāka : <img src="<?php echo \IPS\Member::load( $row['author_id'] )->get_photo();?>" width="25px"> 
<a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['author_id'].'-'.$row['author_name'];?>"><?php echo $row['author_name'] ;?></a>
- šādā laikā: <?php echo date("Y-m-d H:i:s",$row['post_date']);?>
- tēma ir saņemusi <?php echo $row['posts'] ;?> ierakstus un <?php echo $row['views'] ;?> skatījumus.
<?php echo $news_link_fix; ?>

<h6>Pēdējo komentāru veica: <img src="<?php echo \IPS\Member::load( $row['last_poster_id'] )->get_photo();?>" width="25px"> 
<a href="<?php echo\IPS\Settings::i()->base_url.'profile/'.$row['last_poster_id'].'-'.$row['last_poster_name'];?>"><?php echo $row['last_poster_name'] ;?></a>
- šādā laikā: <?php echo date("Y-m-d H:i:s",$row['last_real_post']);?>
<?php } ?>

Demo: https://wam.lv/skripti/ipbnews.php

  • Upvote 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this