Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 2
Goto page 1, 2  Next
 
Reply with quote Download Post 
Post How Could I Go About Showing A List Of Recent Posts 
 
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
 



 
juggalo_masterSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
What about recent posts block?
you find it in cms
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.  
 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.

Code: [Download] [Hide]
  1. if(!function_exists('cms_block_recent_topics')) 
  2.     function cms_block_recent_topics() 
  3.     { 
  4.         global $db, $cache, $config, $template, $user, $lang, $block_id, $cms_config_vars; 
  5.  
  6.         $template->_tpldata['recent_topic_row.'] = array(); 
  7.  
  8.         $except_forums = build_exclusion_forums_list(); 
  9.  
  10.         $current_time = time(); 
  11.         $extra = "AND t.topic_time <= $current_time"; 
  12.  
  13.         $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 
  14.             FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u 
  15.             WHERE t.forum_id NOT IN (" . $except_forums . ") 
  16.                 AND t.topic_status <> 2 
  17.                 AND p.post_id = t.topic_last_post_id 
  18.                 AND p.poster_id = u.user_id 
  19.                 $extra 
  20.             ORDER BY p.post_time DESC 
  21.             LIMIT " . $cms_config_vars['md_num_recent_topics'][$block_id]; 
  22.         $result = $db->sql_query($sql); 
  23.         $number_recent_topics = $db->sql_numrows($result); 
  24.         $recent_topic_row = array(); 
  25.  
  26.         while ($row1 = $db->sql_fetchrow($result)) 
  27.         { 
  28.             $recent_topic_row[] = $row1; 
  29.         } 
  30.         $db->sql_freeresult($result); 
  31.  
  32.         if($cms_config_vars['md_recent_topics_style'][$block_id]) 
  33.         { 
  34.             $style_row = 'scroll'; 
  35.         } 
  36.         else 
  37.         { 
  38.             $style_row = 'static'; 
  39.         } 
  40.  
  41.         $template->assign_block_vars($style_row, ''); 
  42.  
  43.         for ($i = 0; $i < $number_recent_topics; $i++) 
  44.         { 
  45.             $recent_topic_row[$i]['topic_title'] = censor_text($recent_topic_row[$i]['topic_title']); 
  46.  
  47.             // Convert and clean special chars! 
  48.             $topic_title = htmlspecialchars_clean($recent_topic_row[$i]['topic_title']); 
  49.             $template->assign_block_vars($style_row . '.recent_topic_row', array( 
  50.                 'U_TITLE' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&amp;' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'], 
  51.                 'L_TITLE' => $topic_title, 
  52.                 'L_BY' => $lang['By'], 
  53.                 'L_ON' => $lang['POSTED_ON'], 
  54.                 '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']), 
  55.                 'S_POSTTIME' => create_date_ip($config['default_dateformat'], $recent_topic_row[$i]['post_time'], $config['board_timezone']) 
  56.                 ) 
  57.             ); 
  58.         } 
  59.     } 
  60. $block_variables = array( 
  61.     array('Number of recent topics', 'number of topics displayed', 'md_num_recent_topics', '', '', '1', 'recent_topics', '10'), 
  62.     array('Recent Topics Style', 'choose static display or scrolling display', 'md_recent_topics_style', 'Scroll,Static', '1,0', '3', 'recent_topics', '1') 
  63. ); 
  64.  


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.
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.

Spoiler: [ Show ]


And of course the mark-up is pretty basic.  
 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.

Code: [Download] [Hide]
  1. 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) 
  2. Unable to select server. 
  3.  


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.

Code: [Download] [Hide]
  1. SQL Statement Error: Table 'devildo2_phpb362.topics' doesn't exist 


when i enter the details alone.
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
Change the top of the file (With your paths) to:

Code: [Download] [Hide] [Select]
<?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 ##############


Add this to your .tpl file where you want it to appear.

<?php
include "myrecent.php";
?>

That's what I did.

 untitled_1
 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
still mysql error.

i use to use this:
Code: [Download] [Hide]
  1. <!-- PHP -->include("/home/devildo2/public_html/top.php"); <!-- ENDPHP --> 
  2.  


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.
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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?

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/
 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
juggalo_master wrote: [View Post]
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.


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.

Code: [Download] [Hide] [Select]
                       <td valign="top" nowrap="nowrap">'. $topic_type .'<a href="'. $topic_url .'">'. $topic_title .'</a></td>
                    </tr>
                    <tr>
                        <td><a href="'. $forum_url .'">'. $line[$i]['forum_name'] .'</a>: '. $last_url .' '. $last_time .'</td>
                    </tr>';

 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
juggalo_masterSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
Here's some script I modified for IP.    

And if this doesn't work, then one of us is doing something wrong.  

recent.php:

Spoiler: [ Show ]


recent.tpl

Spoiler: [ Show ]

 



 
Edited by mort, Sat 15 Sep, 2012 13:01: Upgrade the template function
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Could I Go About Showing A List Of Recent Posts 
 
Smart way to solve it mort.

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.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 2
Goto page 1, 2  Next


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You 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