Project

General

Profile

« Previous | Next » 

Revision 234

Added by ryan over 18 years ago

News mod now hides read more link if no need for it (see ticket #56)

View differences:

trunk/wb/modules/news/view.php
105 105
	}
106 106
	
107 107
	// Query posts (for this page)
108
	$query_posts = $database->query("SELECT group_id,post_id,title,link,content_short,posted_by,posted_when FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql);
108
	$query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql);
109 109
	$num_posts = $query_posts->numRows();
110 110
	
111 111
	// Create previous and next links
......
188 188
				$short = ($post['content_short']);
189 189
				$wb->preprocess($short);
190 190
				// Replace vars with values
191
				$post_long_len = strlen($post['long']);
191 192
				$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[DATE]', '[TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]');
192 193
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
193
					$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, ($post['title']), $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
194
					if($post_long_len < 9) {
195
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '');
196
					} else {
197
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
198
					}
194 199
				} else {
195
					$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, ($post['title']), $short, $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']);
200
					if($post_long_len < 9) {
201
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, '', '', '', '', '');
202
					} else {
203
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']);
204
					}
196 205
				}
197 206
				echo str_replace($vars, $values, $setting_post_loop);
198 207
			}

Also available in: Unified diff