PDA

View Full Version : Change Style of First Post


Admin
02-17-2002, 10:00 PM
This is a rather old hack I did some time ago for someone, but never really released it as a full hack. :)

Very simple, this hack lets you change the template the first post is using (in either all forums or only one), so it can look differently.
Great for article and review forums. :D

Before installing the hack, create a new template named "postbit_first" from the current "postbit" template. After you're done, you can edit that template and it will control the first post in the threads.

Everything else you need is in the attached file, have fun! :)

Chen

Lesane
02-18-2002, 11:56 AM
Great for my reviews forum, thank you Firefly. Well done :up:

MarkB
02-18-2002, 11:59 AM
That 'someone' was me :D You can see it on my forums in the 'zine' section. Definitely a great addition to my board, and still my favourite hack :)

snyx
02-18-2002, 01:56 PM
creepy, I needed this very hack yesterday....
none the less, excelent job!! now I get to us it! :D

dost
02-18-2002, 03:12 PM
is anyone else getting a parse error in showthread.php? i just installed it on my win32 test server.

Bald Bouncer
02-18-2002, 08:29 PM
Im trying to get it working on 2.2.0, anyone had any luck Im getting a parse error in showthread :(


$postbits = getpostbit($post,iif($counter==1 and $pagenumber==1, 'postbit_first', 'postbit'));


if I change the line in showthread to the above I dont get the error but it doesnt show the first post?

Psychdrone
02-19-2002, 12:47 AM
could I seee a pic, pleas anyone?

Ambex Net
02-19-2002, 01:39 AM
Yes can we have a picture of this in action please :D

X-Fan
02-19-2002, 04:28 AM
Originally posted by Bald Bouncer
Im trying to get it working on 2.2.0, anyone had any luck Im getting a parse error in showthread :(

I was getting that too, but all that's needed is a closing bracket after $pagenumber==1

Chen, this is an absolutely brilliant hack for my forums as I have a sponsor and needed to get my sponsor's ads in the faces of people who clicked through to my news articles from other sites. With this hack, I can do that with ease!

THANKS!!!!!!!!!

X-Fan
02-19-2002, 05:11 AM
Screen Shot!

I've edited the left column (the one that usually contains username, registered date, # posts, etc) in the postbit_first template to include basic information about the poster (as they're staff) and an iframe with my sponsor's ad in it.

Of course, the great thing about this hack is it's completely customizable. You can edit the postbit_first to look however you want it to!

dost
02-19-2002, 08:57 AM
Originally posted by X-Fan
I was getting that too, but all that's needed is a closing bracket after $pagenumber==1Thanks for the help but then I start getting this error:Warning: Missing argument 2 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 3 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 2 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 3 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 2 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 3 for iif() in ./admin/functions.php on line 569

Warning: Missing argument 2 for iif() in ./admin/functions.php on line 569

X-Fan
02-20-2002, 01:10 AM
Sorry dost, but I'm no hacker. I just stumbled across that fix by accident and it worked for me.

SirSteve
02-20-2002, 05:55 AM
And I got this:

Missing argument 2 for getpostbit() in /usr/www/users/gandalf/starwarsguide.com/forums/admin/functions.php on line 57

Line 57 is this:

function getpostbit($post,$templatename) {

also, my showthread.php has this:

$postbits = getpostbit($post);

(notice no period in front of the equal sign?)

but I still replaced it with:
$postbits .= getpostbit($post,iif($counter==1 and $pagenumber==1, 'postbit_first', 'postbit'));

Using 2.2.2

SirSteve
02-20-2002, 04:00 PM
* gentle bump *

:pleased:

Admin
02-20-2002, 04:49 PM
Reinstall the hack SirSteve. :) Trust me...

SirSteve
02-20-2002, 05:18 PM
Originally posted by FireFly
Reinstall the hack SirSteve. :) Trust me...

I bow down... ;)

I even did it twice last night! I guess one shouldn't do hacks late at night! :D

Thaks FireFly!

SirSteve
02-20-2002, 06:17 PM
Any way to make it not include the other stuff like Forum Jump, Rate Thread, Author text, New Thread/Post Reply and Forum Rules? I basically don't want my News section to look like the forums.

dost
02-21-2002, 10:18 PM
Are you sure that this hack is working FireFly?

SirSteve
02-21-2002, 10:37 PM
It is working. Look here:
http://www.sirstevesguide.com/forums/showthread.php?s=&threadid=3963

Now I just need to get rid of all that other "Forum" stuff so it looks more like a News page!

:)

SirSteve
02-22-2002, 12:13 PM
Well, now I am getting this error:

Warning: Missing argument 2 for getpostbit() in /usr/www/users/gandalf/starwarsguide.com/forums/admin/functions.php on line 57

Guess what line 57 is?

function getpostbit($post,$templatename) {

However, the hack IS working on the specified forum but this is not one of them!

Help!

Tim Wheatley
02-24-2002, 09:32 PM
Problem.

All my old posts are working fine.

But NEW posts made into the specific forum all have an invisible first post??

The post IS still in the database, because you see it at the bottom of the page when you reply...

Any ideas??

New Post with invisible:
http://forum.racesimcentral.com/showthread.php?s=&threadid=24433
Old post visible:
http://forum.racesimcentral.com/showthread.php?s=&threadid=21590

Tim Wheatley
02-24-2002, 09:36 PM
SirSteve

If I remember rightly there's two VERY similar lines in functions.php, one has a . (dot), one doesn't. You're editing the line without a dot. So it's trying to call the script in an area it can't. You have to edit the EXACT line the hack readme tells you to.

(from memory) you edited function getpostbit($post, the readme says to edit function .getpostbit($post - notice a dot? :)

Tim Wheatley
02-24-2002, 09:53 PM
Hmm...! It seems that only the user I've setup in coranto to post news is able to post threads correctly. This is fine and I'll create a sub forum for users to post their news. :)

SirSteve
02-24-2002, 10:21 PM
Well, I can't remember what I edited but no errors since so I'll leave it alone until one pops up. I still want to get rid of other stuff that looks like the forums (Forum Jump, Rate Thread, Author text, New Thread/Post Reply and Forum Rules)!

Tim Wheatley
02-24-2002, 11:02 PM
Yuck... Firefly it's still doing this to me:
http://forum.racesimcentral.com/showthread.php?s=&threadid=24445

SirSteve
02-24-2002, 11:39 PM
Click contract all.

Admin
02-25-2002, 05:13 AM
Are you sure you created a new postbit_first template?

Tim Wheatley
02-25-2002, 06:25 PM
Hmm... it seems to be working now that people have replied...

SirSteve
02-27-2002, 02:55 AM
I guess there is no hope to get the other "Forum" parts (as described in an earlier post) removed from this first page... :(

samtha25
03-01-2002, 06:39 AM
Originally posted by SirSteve
I guess there is no hope to get the other "Forum" parts (as described in an earlier post) removed from this first page... :(

Can't you just edit the template to remove whatever you don't want?

Tim Wheatley
03-02-2002, 10:48 AM
There is definately a bug with this of some sort, it's that to see the 1st post on my board, you have to click 'contract all' :)

So I just have to edit my template. Maybe you could mention this in your first post Firefly? :) Thanks to the guy who said about this ;)

SirSteve
03-02-2002, 02:24 PM
I have the same hack installed (contract/expand) and mine works just fine. I do have another bug though...

Warning: Missing argument 2 for getpostbit() in /usr/www/users/gandalf/starwarsguide.com/forums/admin/functions.php on line 57

amykhar
03-02-2002, 04:04 PM
Gang, this is a very easy hack to do but it can take hours of work to get the templates right - depending on what you want to do with it. If these directions aren't quite right, check out the original instructions on vbulletin.com.

Amy

SirSteve
03-02-2002, 04:19 PM
Originally posted by amykhar
Gang, this is a very easy hack to do but it can take hours of work to get the templates right - depending on what you want to do with it. If these directions aren't quite right, check out the original instructions on vbulletin.com.

Amy

Can you provide the direct link? Thanks.

Tim Wheatley
03-02-2002, 06:06 PM
Thanks Amy. :) It took me a while to figure out that the invisble post was because it was 'minimised', to only visible when I clicked expand all. Then I had to setup the template to counter this. Once I did it now works like a dream. :)

Tim Wheatley
03-02-2002, 06:17 PM
If anyone wants the template I've used to make this:
http://www.racesimcentral.com/images/news.gif

Use and modify this: (NOTE: this uses the expand/contract hack!)
<table bgcolor="{pagebgcolor}" width="90%" cellpadding="0" cellspacing="0" border="0"><tr><td width="10"><img width="10" height="1" src="{imagesfolder}/space.gif" alt=""></td><td width="100%"><!-- spacer -->

<table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>
<DIV id="p$post[postid]h" style="display:$ph">
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
<td bgcolor="$post[backcolor]" valign="top" nowrap><nobr>$plusimg <normalfont>This news item was posted at <a href="http://www.racesimcentral.com" target="_blank">Racesim Central</a> or <a href="http://www.gplea.org" target="_blank">GPLEA.org</a> at
$post[posttime] $post[postdate]</nobr></td>
</tr>
</table>
</DIV>

<DIV id="p$post[postid]e" style="display:$pe">
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
<td bgcolor="$post[backcolor]" valign="top" nowrap>
<p align="left">
<a name="post$post[postid]"></a>
$post[firstnewinsert] <nobr>$minusimg <normalfont>This news item was posted at <a href="http://www.racesimcentral.com" target="_blank">Racesim Central</a> or <a href="http://www.gplea.org" target="_blank">GPLEA.org</a> at
$post[posttime] $post[postdate]</nobr>
<p align="center"><nobr> </normalfont></nobr></p>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><normalfont><b>News:</b></normalfont></td></tr><tr><td style="BORDER: #000000 1px solid; COLOR: black; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D0D0D0;"><normalfont>$post[message]</normalfont></td></tr></table>
<p align="center"><br><smallfont>News Item: $usertherdcoun | Forum News Views: $personal<br>
<b>ADMIN:</b> <smallfont><a href="http://www.racesimcentral.com/news.html" target="_blank">POST RSC</a> | <a href="http://gplea.racesimcentral.com/news.html" target="_blank">POST GPLEA</a> | <a href="editpost.php?s=$session[sessionhash]&amp;action=editpost&amp;postid=$post[postid]">EDIT</a>
$post[iplogged]<br><b>USERS:</b> <a href="http://forum.racesimcentral.com/newthread.php?s=$session[sessionhash]&action=newthread&forumid=122" target="_blank">SUPPLY RSC NEWS</a> | <a href="mailto:kotr@gmx.net">SUPPLY GPLEA NEWS</a> | <a href="search.php?s=$session[sessionhash]&amp;action=finduser&amp;userid=$post[userid]">SEARCH</a>&nbsp;|
<a href="newreply.php?s=$session[sessionhash]&action=newreply&postid=$post[postid]">QUOTE</a></p>
</td>

</tr>
</table>
</DIV>
</td></tr></table>

<!-- spacer --></td><td width="10"><img width="10" height="1" src="{imagesfolder}/space.gif" alt=""></td></tr></table>

SirSteve
03-02-2002, 07:27 PM
Is your style still showing the other forum options like Author, New Thread and Post/Reply buttons?

Tim Wheatley
03-03-2002, 01:10 PM
Yes it is - but I need it to anyway :D

SirSteve
03-03-2002, 01:14 PM
Do you see a way of getting rid of it?

Tim Wheatley
03-16-2002, 05:01 PM
No because the first post hack this is just edits what's shown on my screenshot, and then only on the first post. But what you want to do can be done (VERY EASILY).

Create another set of templates, edit the showthread and postbit templates, then under 'Forums & Moderators' click modify, then edit the forum you want to use those templates, and simply under 'Style Options' select the style you want it to use then 'yes' to 'Override users custom styles'...

There ya go. ;)

I'm sure someone with a bigger talkin tongue can type this out for more of an explanation. ;)

mas404
03-18-2002, 06:31 AM
it is not working
same problem wich SirSteve had !!!

also i have expand/contract hack installed .. what i should do now?

Tim Wheatley
03-18-2002, 07:30 AM
HOW is it not working? SOME details might help :)

For example, if it's showing no post, and just showing the reply/post bars above and below where the post should be then your postbit_first template needs to be expanded due to the expand/contract hack. So just redo the template. If that's not your problem, give us some info :)

TECK
05-01-2002, 07:33 PM
great hack. thanks firefly. i needed exacly this.

The Piper
06-04-2002, 02:47 AM
I was trying to do as SirSteve suggested, to remove the Author/Thread/New Thread/Post Reply bit in the beginning of the post, and to have it only after the first post. So, I thought I could modify showthread.php like this:

Original Code:

eval("dooutput(\"".gettemplate("showthread")."\");");


Modified Code:

if ($counter==1 and $pagenumber==1 and ($thread['forumid']==6 or $thread['forumid']==7 or $thread['forumid']==8 or $thread['forumid']==4)) {
eval("dooutput(\"".gettemplate("showthread_first")."\");");
} else {
eval("dooutput(\"".gettemplate("showthread")."\");");
}


Then I created a template called showthread_first which did not have that table cell with such things as author, thread, etc.

Unfortunately, that didn't work. I'm a newbie in PHP, but that seemed to have been a good solution for what I was trying to achieve. I'd appreciate any input on this...

Thanks a lot!

Paulo

hamoe
07-27-2002, 01:22 AM
For those who had a problem like this one:

Warning: Missing argument 2 for getpostbit() in /usr/www/users/gandalf/starwarsguide.com/forums/admin/functions.php on line 57


It is an easy fix. and maybe firefly can update his hack with this if he feels like it :). He has you change the following:

function getpostbit($post) {

To the following:

function getpostbit($post,$templatename) {

How about instead of that, you change it to the following:

function getpostbit($post,$templatename='postbit') {

That makes it so that second argument is optional, and if its not used, it defaults its value to postbit. That means that if any other calls are made to getpostbit() expecting the unhacked version of the function, they will operate as expected :)

P45.net
11-03-2002, 04:27 PM
Cool.... added this for a book review section on my architecture site...

Ian Cunningham
09-02-2003, 07:21 PM
Is there any way to get this to work on 2.3.2?

Hooper
04-05-2005, 05:08 AM
Has anything like this been released for vB3?

Hooper
04-05-2005, 05:30 AM
Something else I thought might work would be to allow the first post to use the postbit vb3 while the rest use legacy postbit. This would be sufficiant. Anything like this?

index
04-11-2005, 07:57 PM
Hi There,

also I liked this hack a lot and I want to know if there's a hack like this made for 3.0.7 ?

waiting a reply

Thanks a lot

Destroyed Soul
04-12-2005, 09:27 PM
Do we have to make our own postbit for it? are there any that people would like to donate?