View Full Version : Easy way to create nice looking news page.
KieuTuan
10-25-2005, 04:45 AM
If you want a news module with the feature of:
- Flexible image display in front page,
- Nice looking when you see full article
- Attached image with article and it will display at desired position and layout (left , right , center …)
- Image will show for certain group of people, other group only see the text.
…
Ok, follow me:
1. Add 2 new template:
adv_portal_shownewsbit
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class = "tcat">
<span class="smallfont"> <strong>$vba_style[portal_blockbullet] $post[title] </strong></span></td>
</tr>
</thead>
<tbody id="collapseobj_shownews" style="$collapseobj_shownews">
<tr>
<td class="$getbgrow">
$post[message]
</td>
</tr>
<tr valign="middle" class="alt2">
<td>
<span style="float:right">
<if condition="$show['editbutton']">
<a href="$vboptions[bburl]/editpost.php?$session[sessionurl]do=editpost&p=$news[postid]"><img alt="$vbphrase[edit_this_post]" border="0" src="$stylevar[imgdir_button]/edit.gif" /></a>
</if>
<if condition="$show['replybutton']">
<a href="$vboptions[bburl]/newreply.php?$session[sessionurl]do=newreply&t=$news[threadid]"><img alt="$vbphrase[reply_to_this_post]" border="0" src="$stylevar[imgdir_button]/reply_small.gif" /></a>
</if>
<a href="$vboptions[bburl]/printthread.php?$session[sessionurl]t=$news[threadid]"><img alt="" border="0" src="$stylevar[imgdir_button]/printer.gif" title="$vbphrase[show_printable_version]" /></a>
</span>
</td>
</tr> </tbody>
</table>
<br />
And
adv_portal_shownews
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - $threadinfo[title]</title>
<meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" />
<meta name="generator" content="vBulletin $versionnumber" />
<style type="text/css">
<!--
td, p, li, div
{
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
.smallfont
{
font-size: 11px;
}
.tborder
{
border: 1px solid #808080;
}
.thead
{
background-color: #EEEEEE;
}
.page
{
background-color: #FFFFFF;
color: #000000;
}
-->
</style>
</head>
<body class="page">
$postbits
<br />
</body>
</html>
2. In the adv_portal_newsbits:
replace
<a href="$vboptions[bburl]/showthread.php?t=$news[threadid]">$news[title]</a></b></td>
With
<a href="$vboptions[bburl]/shownews.php?t=$news[threadid]">$news[title]</a></b></td>
And delete following line;
<if condition="$news['attachment']">
<span style="float: left; margin: $stylevar[cellpadding]px $stylevar[cellpadding]px $stylevar[cellpadding]px 0px">
$news[attachment]
</span>
</if>
3. Add two more custome BB code;
Subject : Image left.
Tag : AIMGL
Replacement : <img src="attachment.php?attachmentid={param}" align="left" width = "{option}px" border="0" hspace="6" vspace="3" alt=""/>
Example : attachmentid
Use {option} : Yes.
And
Subject : Image left.
Tag : AIMGR
Replacement : <img src="attachment.php?attachmentid={param}" align="right" width = "{option}px" border="0" hspace="6" vspace="3" alt=""/>
Example : attachmentid
Use {option} : Yes.
4. Upload the attach shownews.php to forum location, (where the showthread.php locate, not in module folder);
That all, now if you want to make a new just post a message, attach the image to the post. To display the attached image to message with right alignment just type in xxx, or xxx to align image on the left. Where xxx is image attachment id and 150 is width of image.
I just begin with vBulletin and php for less than a month, so if you have any comment, suggestion please let me know.
pennylessz28
10-25-2005, 05:11 PM
That looks really sharp. I like it. And I will probably make use of this.
e-steki
10-25-2005, 05:40 PM
Ermmm, what does this do exactly? I can't tell from the screenshots... :o
vbusers11
10-25-2005, 08:48 PM
can we see a live demo? link please?
KieuTuan
10-26-2005, 01:02 AM
Ermmm, what does this do exactly? I can't tell from the screenshots...
My approach is:
1. Add one module to show fresh news, I just modified from printthread module.
2. Disable feature show attachment in news module. I control it manually.
3. Modified the link to showthread.php into shownews.php code
4. Add new BB codes to upload and control images. Now we just need the attachment id of the attachment and put it at any location you want. Example if you want to show image with attachment id = 50 on the right of paragrapth and image width=150
just insert 50
can we see a live demo? link please?
Currently we use as intranet in our company so I can't give you a ink. If you stuck in any step let me know I will help you.
vbusers11
10-26-2005, 01:28 AM
ok, I'll try it and see what happens, thanks
Azuma
10-27-2005, 09:20 PM
Very nice, thanks!
Itworx4me
10-28-2005, 11:21 PM
Anyway to make this work with 3.5.0???
ashokforums
11-01-2005, 06:06 PM
Didnt work for me.. Currently using Vbulletin 3.5 Gold.. Image doesnt get displayed at all.. Can u please solve my problem..I actually liked ur modification but didnt work :(
KieuTuan
11-03-2005, 12:31 AM
I don't have VBB 3.5, but I think my approach must work. Also you have to make sure that:
- You have correctly added 2 news BB code,
- You have input correct attachmentid in the [AIMGR] or [AIMGL] tag
ashokforums
12-29-2005, 05:03 PM
Works great on 3.5.2.. awesome thanks a lot :)
web-rocket
01-03-2006, 06:30 AM
Ok I have something like this running on one of my old sites but I cant find the hack... It actually creates a thumbnail and places it in the top left corner. Anyone know what hack this is. Example www.unitethecows.com
bitHacker
03-03-2006, 01:54 PM
I have a bit of a problem with it, It works fine, but for some reason, only logged in users can see the picture, how come ?
jaffa
07-07-2006, 12:24 PM
check the usergroups can view the attachment
Garrylawton
07-07-2006, 11:38 PM
Where do I find these files to reconfigure them
Not sure which directories to look in
alexradoo
07-26-2006, 07:55 PM
Ok I have something like this running on one of my old sites but I cant find the hack... It actually creates a thumbnail and places it in the top left corner. Anyone know what hack this is. Example www.unitethecows.com
it doesn't work for me :( i don't know where is the problem, but i think is when i edit the adv_portal_newsbits
what did u do to work on a vB 3.5.x ?
the code that should be edit, from KieuTuan's post (adv_portal_newsbits), doesn't match with the code from adv_portal_newsbits vB 3.5.2
soletrader
08-05-2006, 10:49 PM
Can you upgrade for 3.6 gold?
soletrader
08-10-2006, 05:52 AM
bump
kazido
08-15-2006, 07:57 AM
Ditto !!! :)
alexradoo
08-15-2006, 09:16 AM
it's work fine for me :) i had a few problems, but now is ok. thanks
soletrader
08-17-2006, 10:39 PM
Alexradoo, will you be willing to help me set this hack up? Thank you
alexradoo
08-18-2006, 05:27 AM
yes, i can help you. first of all check how you put the AImgL tag. should be like this: picsid not picsid
Try this, if it doesn't work leave a reply :)
soletrader
08-18-2006, 07:33 AM
I can not find the codes for the adv_portal_newsbits, to replace and add.
Alexradoo, do you think you can post your vdv_portal_newsbits code here? I would really appreciate it. Thank you
alexradoo
08-18-2006, 08:17 AM
<if condition="!$mod_options['portal_news_legacy']">
<tr>
<td class="thead"><if condition="$mod_options['portal_news_showicon']">$vba_style[portal_blockbullet]</if> <a href="$vboptions[bburl]/shownews.php?t=$news[threadid]">$news[title]</a></td>
</tr>
</if>
<tr>
<td class="<if condition="$mod_options['portal_news_legacy']">thead<else />alt2</if>">
<if condition="$mod_options['portal_news_showrating'] AND $news['votenum']">
<span style="float:$stylevar[right]"><img alt="" src="$stylevar[imgdir_rating]/rating_$news[rating].gif" title="<phrase 1="$news[votenum]" 2="$news[voteavg]">$vbphrase[thread_rating_x_votes_y_average]</phrase>" /></span>
</if>
$news[dateposted] - <phrase 1="$vboptions[bburl]/member.php?$session[sessionurl]u=$news[postuserid]" 2="$news[postusername]">$vbphrase[by_x]</phrase>
</td>
</tr>
<tr>
<td align="$stylevar[left]" class="alt1" valign="top">
<if condition="$news['avatarpath']">
<img align="$stylevar[left]" style="padding:6px" alt="" border="0" src="$news[avatarpath]" title="$news[postusername]'s $vbphrase[avatar]" />
</if>
$news[message]
<if condition="$show['signature']">
<div>__________________<br />
$news[signature]</div>
</if>
</td>
</tr>
<tr class="alt2" valign="middle">
<td valign="middle">
<span style="float:right">
<if condition="$show['editbutton']">
<a href="$vboptions[bburl]/editpost.php?$session[sessionurl]do=editpost&p=$news[postid]"><img alt="$vbphrase[edit_this_post]" border="0" src="$stylevar[imgdir_button]/edit.gif" /></a>
</if>
<if condition="$show['replybutton']">
<a href="$vboptions[bburl]/newreply.php?$session[sessionurl]do=newreply&t=$news[threadid]"><img alt="$vbphrase[reply_to_this_post]" border="0" src="$stylevar[imgdir_button]/reply_small.gif" /></a>
</if>
<if condition="$mod_options['portal_news_showsendfriend']">
<a href="$vboptions[bburl]/sendmessage.php?$session[sessionurl]do=sendtofriend&t=$news[threadid]"><img alt="" border="0" src="$stylevar[imgdir_button]/sendtofriend.gif" title="$vbphrase[send_to_friend]" /></a>
</if>
<if condition="$mod_options['portal_news_showprintable']">
<a href="$vboptions[bburl]/printthread.php?$session[sessionurl]t=$news[threadid]"><img alt="" border="0" src="$stylevar[imgdir_button]/printer.gif" title="$vbphrase[show_printable_version]" /></a>
</if>
</span>
<span class="smallfont">
<if condition="$mod_options['portal_news_allowreplies']">$news[replycount] <if condition="$news['reply_noformat'] == 1">$vbphrase[reply]<else />$vbphrase[replies]</if> | </if> $news[views] $vbphrase[views]</span>
</td>
</tr>
here's the code for adv_portal_newsbits :)
soletrader
08-18-2006, 09:04 AM
Thank you Alexradoo. I am however stuck on the custom BB codes. Do I add a module under my vbadvanced CMPS?
alexradoo
08-18-2006, 09:08 AM
no ! u already have the NEWS module that should be added to your CMPS page
soletrader
08-18-2006, 09:18 AM
Hi,
Im not too sure what adding a custom BB code means. Could you please tell me where I can add this BB code? Thank you Alexradoo.
alexradoo
08-18-2006, 09:28 AM
:D well... go to the forum control panel. u will find "Custom BB Codes". expand this and click "Add New BB Code" link. now you shoud follow KieuTuan's post to add the BB code
soletrader
08-18-2006, 09:50 AM
Ok.... where do I find the attachment ID number? All attachements have a different number?
soletrader
08-18-2006, 10:00 AM
I have created the custom bb code, fixed the adv_portal_newsbits.
Do I put: jpg for example in the custom BB?
Also do I need to put jpg into my posting? Thank you
alexradoo
08-18-2006, 10:09 AM
http ://yoursite/forum/attachment.php?attachmentid=5&d=1155839058 - this is the link for attachement (an example)
5&d=1155839058 - is the attachment id
u need to put id in your post
in my example will be 5&d=1155839058
soletrader
08-18-2006, 12:27 PM
yesss!!!! OMG thank you sooo much alexradoo. You literally just made my week!!!! :) Thank you thank you thank you thank you
soletrader
08-18-2006, 12:44 PM
Looks like it doesnt work on firefox? Would you know what the problem is by any chance?
alexradoo
08-18-2006, 02:46 PM
Looks like it doesnt work on firefox? Would you know what the problem is by any chance?
i realy don't know :confused: i use opera and it's work fine :)
Kseki
08-22-2006, 01:32 PM
so... this will this work with vb3.6.0 gold?
HackL0ves
08-23-2006, 04:59 PM
Warning: main(./includes/functions_bbcodeparse.php) [function.main]: failed to open stream: No such file or directory in /shownews.php on line 41
Fatal error: main() [function.require]: Failed opening required './includes/functions_bbcodeparse.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hackl0ves/ublic_html/teen/forum/shownews.php on line 41
error Help me
succo
08-23-2006, 08:02 PM
on vb 3.6 the only thing that doesn't work is the shownews.php (the syntax has changed a lot since 3.0.x)
i did change all the functions/variables, but still have an 'invalid page specified' when clicking on the name of a news, i guess because there is no 'pageid' defined in shownews.php
may someone help?
rutch
08-24-2006, 06:10 AM
Nice THX
popac
09-06-2006, 10:46 AM
on vb 3.6 the only thing that doesn't work is the shownews.php (the syntax has changed a lot since 3.0.x)
i did change all the functions/variables, but still have an 'invalid page specified' when clicking on the name of a news, i guess because there is no 'pageid' defined in shownews.php
may someone help?
Anyone solve problem with vB 3.60?
Code in old versions is compatibile with new version ?
Tnx in advance!
succo
09-10-2006, 05:40 AM
this can be simply solved by adding a custom page called shownews to your vba pages, but still can't have the posts show in their correct order in the shownews page nor the links (edit/reply) work as they should
i'm trying to work on it :)
spjeff69
10-05-2006, 01:43 AM
Does this still work? If so, are there updated instructions?
chkdg8
10-29-2006, 04:16 AM
Does this still work? If so, are there updated instructions?
I agree. Is there a way to update the instructions being that this is the only one of it's kind. Also, can this be implemented on 3.5.4?
it would be nice for 3.6.2!!!
Can anyone modify?
alstoryal
11-08-2006, 07:40 PM
Example if you want to show image with attachment id = 50 on the right of paragrapth and image width=150
how do i find the attachment id
killaja
11-11-2006, 01:51 PM
This sounds like exactly what I am looking for. Does it work with 3.5.4?
mIRCnet
11-23-2006, 01:16 PM
Nice mode, how do I make it work for VB 3.6.x ??
mlotziii
12-08-2006, 08:53 PM
This worked great for displaying and aligning images in my threads but the image is not showing up on my vbadvanced portal?
any help?
vothanhcam
12-26-2006, 03:20 AM
as vietnames ..Tuan PM Y!M : m0_0o
forum of Tuan >?
chkdg8
12-26-2006, 03:43 AM
I'm on 3.6.4 but I forgot where I found this hack.
Go to your BB Code Manager in your Admin CP and Add New BB Code.
Title: Image tag with Alignment
Tag: imga
Replacement: <img src="{param}" align="{option}" border="0" alt="" style="padding:7px;" />
Example: http://www.seka.org.uk/uploads/images/SBone.gif
Description: The above example will left align the image. Valid options are left | right
Use {option}: Yes
Save and you're done. See some of my news examples by clicking my sig.
Brad^
01-08-2007, 07:16 AM
Bump!!
How do i this for 3.6.3?:confused:
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.