i want to show a list of recent topics/posts on my site through the templates.
like this:
IMG Tags And %20 Together Won't Work...
posted by: Paul_RS1date: Mon 21 Aug, 2006 18:19
and so on.
if it can't be done then its ok i will try something else by using rss script but i would whether use the forum system before i use javascript
SOLVED How Could I Go About Showing A List Of Recent Posts
Subject: Re: How Could I Go About Showing A List Of Recent Posts
What about recent posts block?
you find it in cms
you find it in cms
Subject: Re: How Could I Go About Showing A List Of Recent Posts
nope won't work check out my site http://www.animenewsinc.net/ you will see what i mean.
i am wanting to add through template variables or so on how to show recent posts as a list not just a number. i already figured out how to show the numbers of total posts and topics now i want to show recent posts/topics.
my site is using tpl files but the main part doesn't have the over_all files included. which means it doesn't show the forum as part of it
i am wanting to add through template variables or so on how to show recent posts as a list not just a number. i already figured out how to show the numbers of total posts and topics now i want to show recent posts/topics.
my site is using tpl files but the main part doesn't have the over_all files included. which means it doesn't show the forum as part of it
Subject: Re: How Could I Go About Showing A List Of Recent Posts
From memory, it's recent_topics block either static or scrolling - narrow or wide. :?:
Subject: Re: How Could I Go About Showing A List Of Recent Posts
thanks mort i will look at it and the php and tpl file. it seems like you seem to know what i am talking about LOL.
how do i get this to work properly i can't figure out how to get it to show. it doesn't have the template vars and i am confused with how to get it to work.
- if(!function_exists('cms_block_recent_topics'))
- {
- function cms_block_recent_topics()
- {
- global $db, $cache, $config, $template, $user, $lang, $block_id, $cms_config_vars;
- $template->_tpldata['recent_topic_row.'] = array();
- $except_forums = build_exclusion_forums_list();
- $current_time = time();
- $extra = "AND t.topic_time <= $current_time";
- $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, u.user_active, u.user_color
- FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
- WHERE t.forum_id NOT IN (" . $except_forums . ")
- AND t.topic_status <> 2
- AND p.post_id = t.topic_last_post_id
- AND p.poster_id = u.user_id
- $extra
- ORDER BY p.post_time DESC
- LIMIT " . $cms_config_vars['md_num_recent_topics'][$block_id];
- $result = $db->sql_query($sql);
- $number_recent_topics = $db->sql_numrows($result);
- $recent_topic_row = array();
- while ($row1 = $db->sql_fetchrow($result))
- {
- $recent_topic_row[] = $row1;
- }
- $db->sql_freeresult($result);
- if($cms_config_vars['md_recent_topics_style'][$block_id])
- {
- $style_row = 'scroll';
- }
- else
- {
- $style_row = 'static';
- }
- $template->assign_block_vars($style_row, '');
- for ($i = 0; $i < $number_recent_topics; $i++)
- {
- $recent_topic_row[$i]['topic_title'] = censor_text($recent_topic_row[$i]['topic_title']);
- // Convert and clean special chars!
- $topic_title = htmlspecialchars_clean($recent_topic_row[$i]['topic_title']);
- $template->assign_block_vars($style_row . '.recent_topic_row', array(
- 'U_TITLE' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'],
- 'L_TITLE' => $topic_title,
- 'L_BY' => $lang['By'],
- 'L_ON' => $lang['POSTED_ON'],
- 'S_POSTER' => colorize_username($recent_topic_row[$i]['user_id'], $recent_topic_row[$i]['username'], $recent_topic_row[$i]['user_color'], $recent_topic_row[$i]['user_active']),
- 'S_POSTTIME' => create_date_ip($config['default_dateformat'], $recent_topic_row[$i]['post_time'], $config['board_timezone'])
- )
- );
- }
- }
- }
- $block_variables = array(
- array('Number of recent topics', 'number of topics displayed', 'md_num_recent_topics', '', '', '1', 'recent_topics', '10'),
- array('Recent Topics Style', 'choose static display or scrolling display', 'md_recent_topics_style', 'Scroll,Static', '1,0', '3', 'recent_topics', '1')
- );
how do i get this to work properly i can't figure out how to get it to show. it doesn't have the template vars and i am confused with how to get it to work.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
Sucking something out of the CMS would be a lot of work I would imagine. :(
Here's a stand-alone you could clean up and play with.
Copy the script to myrecent.php, edit the vars at the top and put it in the root.
And of course the mark-up is pretty basic. :mryellow:
Here's a stand-alone you could clean up and play with.
Copy the script to myrecent.php, edit the vars at the top and put it in the root.
Spoiler: [ Show ]
And of course the mark-up is pretty basic. :mryellow:
Subject: Re: How Could I Go About Showing A List Of Recent Posts
alright but how would i go about showing that in my footer of my main site? i figured that works but what i am looking for is how to add the code to my php file that i already have set up for the tpl file.
what i am wanting is like a list that will show in my footer under recent posts.
if you look at my site you will see what i am looking for. http://www.animenewsinc.net/ look at footer at the recent post section.
when i try to include the file and echo out the results i get this error. i don't know how to fix it either i tried putting in the info for the mysql myself but then i get table doesn't exist.
when i enter the details alone.
what i am wanting is like a list that will show in my footer under recent posts.
if you look at my site you will see what i am looking for. http://www.animenewsinc.net/ look at footer at the recent post section.
- Icy Phoenix Debug] PHP Notice: in file /top.php on line 14: mysql_connect() [function.mysql-connect]: Access denied for user 'devildo2'@'localhost' (using password: NO)
- Unable to select server.
when i try to include the file and echo out the results i get this error. i don't know how to fix it either i tried putting in the info for the mysql myself but then i get table doesn't exist.
when i enter the details alone.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
Change the top of the file (With your paths) to:
Add this to your .tpl file where you want it to appear.
<?php
include "myrecent.php";
?>
That's what I did. ;)

<?php
// ############ Edit below ########################################
$topic_length = '30'; // length of topic title
$topic_limit = '5'; // limit of displayed topics
$special_forums = '0'; // specify forums ('0' = no; '1' = yes)
$forum_ids = ''; // IDs of forums; separate them with a comma
$config_path = './../forum/'; // path to config.php
$root_path = '/forum/'; // link path
// ############ Edit above ########################################
$path = dirname(__FILE__);
include($config_path .'config.php');
mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Unable to select server.');
mysql_select_db($dbname) OR die('Unable to select database.');
// ############## output ##############
// ############ Edit below ########################################
$topic_length = '30'; // length of topic title
$topic_limit = '5'; // limit of displayed topics
$special_forums = '0'; // specify forums ('0' = no; '1' = yes)
$forum_ids = ''; // IDs of forums; separate them with a comma
$config_path = './../forum/'; // path to config.php
$root_path = '/forum/'; // link path
// ############ Edit above ########################################
$path = dirname(__FILE__);
include($config_path .'config.php');
mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Unable to select server.');
mysql_select_db($dbname) OR die('Unable to select database.');
// ############## output ##############
Add this to your .tpl file where you want it to appear.
<?php
include "myrecent.php";
?>
That's what I did. ;)

Subject: Re: How Could I Go About Showing A List Of Recent Posts
still mysql error.
i use to use this:
i tried your new way but it isn't working.
mind you i don't have inlcude overall_ files on my site. i am using the custom pages for ip to show my main pages.
i use to use this:
i tried your new way but it isn't working.
mind you i don't have inlcude overall_ files on my site. i am using the custom pages for ip to show my main pages.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
It's supposed to be stand-alone and not require any IP files other than config.php.
put myrecent.php in the root of your forum and call it up.
http://blah/myrecent.php and it should come up - let me know if it works? :mrviolet:
Just a minute - It appears that you have IP in the root of your public folder, so this part of the path is not required.
forum/
put myrecent.php in the root of your forum and call it up.
http://blah/myrecent.php and it should come up - let me know if it works? :mrviolet:
Just a minute - It appears that you have IP in the root of your public folder, so this part of the path is not required.
forum/
Subject: Re: How Could I Go About Showing A List Of Recent Posts
oh i am looking for a way to include it into my file by putting the code into my custom page file and put the template vars into the tpl. i am not looking for a standalone version LOL.
but that can come in handy tho so thanks for that part.
but what i am wanting is like a blog roll or blog post list but with the recent posts or topics. either one will work. i just to put something so when visitors come to my site they see the recent posts/topics and can click on the title or link and read more of it.
pretty much it's like wordpress recent topic list widget but instead of it being wordpress it does the recent posts/topics from the icyphoenix.
but that can come in handy tho so thanks for that part.
but what i am wanting is like a blog roll or blog post list but with the recent posts or topics. either one will work. i just to put something so when visitors come to my site they see the recent posts/topics and can click on the title or link and read more of it.
pretty much it's like wordpress recent topic list widget but instead of it being wordpress it does the recent posts/topics from the icyphoenix.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
That's what it does. ?
I imagine that you could create a function for that code and put it in your .php file along with creating a template vars array for the VARS in these strings and paste the vars into your template rather than have php echo the html.
juggalo_master wrote: [View Post]
That's what it does. ?
I imagine that you could create a function for that code and put it in your .php file along with creating a template vars array for the VARS in these strings and paste the vars into your template rather than have php echo the html.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
tried that i got nothing LOL. i might of putten it in a wrong way but i will try again.
Subject: Re: How Could I Go About Showing A List Of Recent Posts
Here's some script I modified for IP. :P
And if this doesn't work, then one of us is doing something wrong. :LOL:
recent.php:
recent.tpl
And if this doesn't work, then one of us is doing something wrong. :LOL:
recent.php:
Spoiler: [ Show ]
recent.tpl
Spoiler: [ Show ]
Subject: Re: How Could I Go About Showing A List Of Recent Posts
Smart way to solve it mort. :LOL:
There is another way, which is using an RSS parser, so you can include recent posts directly from RSS... you can find plenty on the web.
There is another way, which is using an RSS parser, so you can include recent posts directly from RSS... you can find plenty on the web.
Page 1 of 2
You cannot post new topicsYou cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events
This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by Icy Phoenix based on phpBB
Generation Time: 0.0834s (PHP: 27% SQL: 73%)
SQL queries: 11 - Debug Off - GZIP Enabled