Results 1 to 1 of 1

Thread: Show latest attachments with 'News' module

  1. #1
    Join Date
    Aug 2005
    Durham, UK

    Default Show latest attachments with 'News' module

    After a bit of messing around, I've managed to show the latest posts just as attachments on the CMPS front page, using the 'News' module. I'll show you how, but if anyone can come up with a better way, I'd be grateful! I'm not a programmer, so please, please back up your files before you do this!

    First, edit the 'News' module. Make sure 'Enable Attachments' is set to 'Yes, First Attachment Only'. Make sure all of the other options are set to 'No', except 'Enable [ATTACH] BB Code Tags'.

    I run a downloads site, and basically wanted to show just the image attachments from them, so I edited the 'adv_portal_newsbits' and changed it to this:

    <vb:if condition="!$mod_options['portal_news_legacy']">
    <div class="<vb:if condition="$mod_options['portal_news_legacy']">blocksubhead<vb:else />blockrow</vb:if>">
    <div class="blockrow">
    <center><a href="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw news}}">{vb:raw news.title}</a></center>
    	<div<vb:if condition="$mod_options['portal_news_showrating'] AND $news['rating']"> class="vba_rating{vb:raw news.rating}"</vb:if>>
    		<vb:if condition="$news['subscribed'] AND $mod_options['portal_news_showsubscribed']">
    			<img alt="" class="inlineimg" src="{vb:stylevar imgdir_misc}/subscribed.gif" title="{vb:rawphrase you_are_subscribed_to_this_thread}" />
    	<vb:if condition="$show['paperclip']">
    		<span style="float:{vb:stylevar right}">
    			<a href="#" onclick="vba_attach_win({vb:raw news.threadid}); return false"><img class="inlineimg" src="{vb:stylevar imgdir_misc}/paperclip.gif" border="0" title="{vb:rawphrase x_attachments, {vb:raw news.attach}}" alt="" /></a>
    	<table width="100%">
    			<td valign="top">
    				<vb:if condition="$news['avatarpath']">
    					<img align="{vb:stylevar left}" style="padding: 0 {vb:math {vb:stylevar padding}/2} {vb:math {vb:stylevar padding}/2} 0" alt="{vb:rawphrase xs_avatar, {vb:raw news.postusername}}" border="0" src="{vb:raw news.avatarpath}" />
    	<vb:if condition="$show['signature']">
    		<div>__________________<br />{vb:raw news.signature}</div>
    <vb:if condition="$news['attachment']">
    			<vb:each from="news[attachment]" value="attachment">
    				<vb:if condition="$attachment['hasthumb']">
    			<center>		<a href="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw news}}"><img src="{vb:raw vboptions.bburl}/attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;stc=1&amp;thumb=1&amp;d={vb:raw attachment.thumbnail_dateline}" class="thumbnail" border="0" alt="Click image to view {vb:raw news.title}" width="150"></a></center>
    				<vb:else />
    					<center>	<img class="inlineimg" src="{vb:stylevar imgdir_attach}/{vb:raw attachment.attachmentextension}.gif" alt="{vb:rawphrase file_type_x, {vb:raw attachment.attachmentextension}}" width="16" height="16" border="0" style="vertical-align:baseline" /> <a href="{vb:raw vboptions.bburl}/attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}">{vb:raw attachment.filename}</a></center>
    						({vb:raw attachment.filesize}, {vb:rawphrase x_views, {vb:raw attachment.counter}})
    <div class="postbit vba_news">
    	<div class="postfoot" style="white-space: nowrap">
    		<div class="textcontrols floatcontainer">
    			<span class="postcontrols">
    				<vb:if condition="$mod_options['portal_news_showsendfriend']">
    					<span class="seperator">&nbsp;</span>
    					<a href="{vb:raw vboptions.bburl}/sendmessage.php?{vb:raw session.sessionurl}do=sendtofriend&amp;t={vb:raw news.threadid}" rel="nofollow" style="padding: 0"><img alt="" border="0" src="{vb:stylevar imgdir_button}/sendtofriend.gif" title="{vb:rawphrase send_to_friend}" style="position: relative" /></a>
    			<span class="postlinking">
    				<vb:if condition="$mod_options['portal_news_allowreplies']">
    					{vb:raw news.replycount} <vb:if condition="$news['reply_noformat'] == 1">{vb:rawphrase reply}<vb:else />{vb:rawphrase replies}</vb:if>
    				<vb:if condition="$mod_options['portal_news_showviews'] AND $mod_options['portal_news_allowreplies']"> | </vb:if>
    				<vb:if condition="$mod_options['portal_news_showviews']">
    					{vb:raw news.views} {vb:rawphrase views}
    Then I moved the module to the side of the page and changed the name to 'Latest Downloads' so it looks like this:

    Please note that this is just a temporary fix until someone cleverer than me comes up with a better way, and there's still that problem of guests not being able to see the attachments which I'm still waiting for someone to resolve.

    Anyway, I hope this helps someone.
    Last edited by angeljs; 01-12-2012 at 06:12 PM.
    Sim Fans UK - Sims downloads and discussion

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 15
    Last Post: 05-03-2013, 03:56 PM
  2. Show latest attachments
    By angeljs in forum "How Do I..." Questions
    Replies: 0
    Last Post: 09-13-2011, 08:05 PM
  3. News module and attachments.
    By neverstop in forum "How Do I..." Questions
    Replies: 1
    Last Post: 03-07-2008, 11:02 AM
  4. Attachments in news module
    By zand in forum Bugs From 3.0 RC1
    Replies: 4
    Last Post: 05-23-2007, 07:11 PM
  5. Attachments don't show in News
    By Kseki in forum Troubleshooting & Problems
    Replies: 2
    Last Post: 12-22-2005, 12:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts