View Full Version : Thank you firefly
amykhar
11-25-2001, 03:54 PM
You are responsible for this
http://www.eaforums.com/t6418.html
I had to dig long and hard to find it, but it's your hack. :)
Amy
Admin
11-25-2001, 04:04 PM
That's my hack? :stupid:
Wait... let me guess. It's a very modified version of something I posted a long time ago, to change the look of the first post in a thread? :D
Thanks. :)
Hooper
11-25-2001, 04:18 PM
Uhh Amy,
What hack is this? I wouln't mind trying this one out. Actually if it's heavily modified I wouldn't mind trying your version out. ;)
Thanks
amykhar
11-25-2001, 04:40 PM
the only modification I made is to hardcode in the specifc forums that the hack should apply to. Oh, and I also passed the thread id to the function so that my comment link in the first post would work.
Here's the link Hooper:
http://vbulletin.com/forum/showthread.php?s=&threadid=27828&highlight=first+post
Amy
Hooper
11-25-2001, 04:47 PM
Hi Amy,
Thank you. Very much appreciated. My search wasn't going to well in here... :D
amykhar
11-25-2001, 04:49 PM
yeah. It's on the WRONG board. :D (hint firefly)
Amy
Hooper
11-25-2001, 04:51 PM
After reading your post Amy as well as FireFly's above, I'm getting the feeling that what you have on your site with this hack isn't much like what Chen posted it to be. When you said "to hardcode" I just thought maybe you were saying that you did quite a bit of change to get the output you did. When you applied the code to specific forums was that too terribly difficult?
I noticed someone say that they had a problem with subforums. I have Announcements and News
Announcements
SiteNews
etc...
Basically subforums. The forums that I will most want to use this for is for SiteNews.
I'm sure I can get this to work. I really like what you've done with it. Very nice.
amykhar
11-25-2001, 05:26 PM
No. To make it for specific forums, I did it the lazy way. In the showthread part, I modified this:
if ($counter==1 and $pagenumber==1) {
$postbits .= getpostbit($post,1);
} else {
$postbits .= getpostbit($post);
}
to this:
if ($counter==1 and $pagenumber==1 and (($thread['forumid']==72)or($thread['forumid']==76))) {
$postbits .= getpostbit($post,1, $thread['threadid']);
} else {
$postbits .= getpostbit($post,0,$thread['threadid']);
}
In functions.php, I changed:
function getpostbit($post,$isfirst=0) {
to
function getpostbit($post,$isfirst=0,$threadid) {
everything else is template mods.
Hope that helps.
Amy
Hooper
11-25-2001, 05:38 PM
Oh,
Thank You. This is the info I need. I just tried hacking what was in the thread and ended up with 2 parsing errors. :(
I'll try again with what you have here.
Thanks
Hooper
11-25-2001, 05:48 PM
Amy,
Did you also change what he wrote on the bottom of the hack?
and also replace
PHP:--------------------------------------------------------------------------------
// do posts from ignored users
if (!$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
--------------------------------------------------------------------------------
with
PHP:--------------------------------------------------------------------------------
// do posts from ignored users and create first post
if ($isfirst and !$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit_first")."\";");
} elseif (!$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
Thanks
Hey Chen.... This is an awsome hack.. Maybe we could do a clean up of the hack in these forums?
amykhar
11-25-2001, 06:08 PM
Mine is different than his because I have the hidden posts hack installed.
However, if you don't have that installed, what Chen did should work for you.
Amy
Hooper
11-25-2001, 06:16 PM
ok,
Well...It's installed and I created a template called postbit_first as he explained. I left it blank and went to check the forums posts that I pointed the new code too, it was also blank. So I must be on the right track correct?
I don't even have my posts showing up. There isn't anything in there at all.
Now do I copy and alter my postbit template and add that to the postbit_first?
Thanks Amy.
amykhar
11-25-2001, 06:18 PM
You tested the same way I did. :D
Yes, I copied my postbit template in there, and then modified the hell out of it. :D
Amy
Hooper
11-25-2001, 06:21 PM
Ok, I did just what I wrote above and copied my postbit to the newly created postbit_first template. Now everything looks as usual. So the hack is using postbit_first template for the desired forumID's I told it to look at.
Now I thought that I would just have a space above my posts for an article. Should I install the space into the newly created postbit_first template?
I usually just try these things but with the hack a we bit scattered I thought I'de be on the more cautious side this time. ;)
Update this post: We were posting at the same time or there abouts. That is funny what you just wrote.
Hooper
11-25-2001, 06:23 PM
[QUOTE]Originally posted by amykhar
You tested the same way I did. :D
Yes, I copied my postbit template in there, and then modified the hell out of it. :D
Amy
amykhar
11-25-2001, 06:24 PM
so when are you going to show off your handy work?
I am dying to see what you do with it.
Amy
Hooper
11-25-2001, 06:28 PM
As soon as you send me your template so I can figure out what I'm doing..... :D
Read the previous post. I have tears in my eye.
amykhar
11-25-2001, 06:42 PM
oops. :Blush:
I'll email you my template. Give me a sec.
Amy
Hooper
11-25-2001, 06:59 PM
Sent you my site link. .... OhBoy. :D
amykhar
11-25-2001, 07:01 PM
want my showthread template too? :D
Amy
Hooper
11-25-2001, 07:04 PM
Don't think we can do that. Policy I think. ... :D
What changes on the showthread can I do to make this work any different than yours?
amykhar
11-25-2001, 07:08 PM
I think we can exchange templates. People post styles all the time.
It handles that table alignment problem and stuff that you're still having.
Amy
Hooper
11-25-2001, 07:10 PM
[QUOTE]Originally posted by amykhar
I think we can exchange templates. People post styles all the time.
It handles that table alignment problem and stuff that you're still having.
Amy
Bald Bouncer
11-25-2001, 08:15 PM
nice work...shame I couldnt get it too work with 2.2.0 though :(
amykhar
11-25-2001, 08:18 PM
Bald Bounce, I am using 2.20
Amy
tubedogg
11-26-2001, 04:21 AM
As long as both of you have licenses you are free to exchange program files. You may not exchange or give them to unlicensed individuals, however.
Hooper
11-26-2001, 04:23 AM
Ok. Thanks Kevin. Can I have all of your files now? :D
tubedogg
11-26-2001, 04:27 AM
Trust me you don't want my files. :p
Hooper
11-26-2001, 04:30 AM
I believe it. :D
Hey Kevin, what $call do I make to the db to get number of responses to a given thread?
This is for........ Comments ($number of comments)
Thanks
tubedogg
11-26-2001, 04:33 AM
SELECT replycount FROM thread WHERE threadid='xxx';
Replace xxx with the threadid.
Hooper
11-26-2001, 04:38 AM
Hmmm. No easy way like "$responses [to this thread]"
Lol..... :D
I get the idea but I have no idea where to place the code your talking about. This is for what the topic of the thread is about. I have this hack installed and loving it (Thanks to the Wonderful Amy's help). But I just wanted to have the number of replies posted within the postbit_first template.
tubedogg
11-26-2001, 04:42 AM
Nope, fraid not. :(
Hooper
11-26-2001, 04:47 AM
:mad:
*Hooper pouts to no avail*
Admin
11-26-2001, 11:47 AM
[QUOTE]Originally posted by amykhar
[...] Oh, and I also passed the thread id to the function so that my comment link in the first post would work.
[...]
Amy
Hooper
11-26-2001, 07:01 PM
Why doesn't $thread[replycount] work? within the postbit_first template?
Any Ideas?
amykhar
11-26-2001, 08:20 PM
Now you tell me Chen :)
Amy
Hooper
11-26-2001, 08:21 PM
Hey Amy,
Will what he wrote help us if we change some code?
Admin
11-27-2001, 11:48 AM
Hooper, I e-mailed you anyway with what you need before seeing this post.
Anyway, adding $thread to the list of global vars is enough.
Hooper
11-27-2001, 04:32 PM
Wow that was easy. I added the $thread to the functions.php and had it working in 1 minute.
Thank you very much Chen.
Amy,
I forwarded the info to you for your page if you would like it. :)
Crinos
11-27-2001, 06:13 PM
Uhm, anyone wanna compile this one and make it easier for us who wanna do it too? The whole process is scattered in two boards. Thanks :D
Hooper
11-27-2001, 06:16 PM
. :rolleyes: ...Ugh... ok. You asked for it.
.
.
<?
require('Hooperslongwindedpostandexplaination.php' );
require('Crinoslongwindedbinarysigthatneedsdeciphe red.php');
}
//Start long winded post on my experience. God I love this. ;)
//.
//.
print"
News Style Postbit Hack- by FireFly
Status of version: (Opinion is beta. No official release by FireFly.
I know of only 2 others at this point besides myself that have it installed. It works and I haven't found any glitches up to this point. If a version number gets assigned to this FirFly himself will be doing it. Use this hack at your own risk of course.)
What it does: Adds the ability to design a news type post_bit template that will be used when called to. This new template redirect adds ability to gain a new news style thread display while allowing users to post to such. You can set forumID variables for specific forums.
Additional Note: Please read this post completely before attempting this hack.
Difficulty: The hack itself is not very hard in complexity for your average experienced hack installer. But the template changes require an experienced level of expertice to get the desired output (look and feel) you desire. Overall: I would reccomend this hack to advanced users (At the least advanced in the template altering arena). This hack can quite possibly fubar your schtuff in Netscape when you alter the templates if not careful. Be sure to test with both browsers.)
Support:
This is an unofficial hack as mentioned. I'm sure others will help where they can but few are using this as of now. This is the first post that brings together an experienced installation as well as the original posting by FireFly at vBulletin. Link is below.
Examples:
My site is off limits at this point. Amy's site is posted in this thread. If she gives permission I will edit this post and add her site link here.
Files to change (2)
Showthread.php
Functions.php (admin dir)
Templates to change (2)
1 new one = postbit_first
1 old=showthread
Original hack design located here.
http://vbulletin.com/forum/showthread.php?s=&threadid=27828&highlight=first+post
--------------------------------------------------------------------------------
//Start Hack
Do:
In showthread.php, replace
$postbits .= getpostbit($post);
with:
if ($counter==1 and $pagenumber==1 and (($thread['forumid']==72)or($thread['forumid']==76))) {
$postbits .= getpostbit($post,1, $thread['threadid']);
} else {
$postbits .= getpostbit($post,0,$thread['threadid']);
}
Note: Line 1 is the forums that will be using the postbit_first template. Set the forums you wish to use with the new postbit_first there.
Now, in functions.php
replace:
function getpostbit($post) {
with:
function getpostbit($post,$isfirst=0) {
Also in functions.php
replace:
// do posts from ignored users
if (!$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
with:
// do posts from ignored users and create first post
if ($isfirst and !$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit_first")."\";");
} elseif (!$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
Still in functions PHP find:
// global options
global $showdeficon,$displayemails,$enablepms,$allowsigna tures,$wordwrap,$dateformat,$timeformat,$logip,$re placewords,$postsperday,$avatarenabled,$registered dateformat,$viewattachedimages;
and replace with:
// global options
global $showdeficon,$displayemails,$enablepms,$allowsigna tures,$wordwrap,$dateformat,$timeformat,$logip,$re placewords,$postsperday,$avatarenabled,$registered dateformat,$viewattachedimages,$threadid;
(Note: All you did here is add $threadid to the list of global options. You may find it easier to just add $threadid;
to the end of the global.)
CREATE A NEW STYLE (Example:news)
Now create a dupicate of your style by downloading and reuploading if you like. Remame it to news or what have you.
NOTE: To keep from gettting two duplicate names of your styles confused on import, if you download your normal style to your hard disk, open it up, look at the three names between the ///// name/////name/////name.... at the top of the style, you can rename the style here before reupping it to the CP. This allows you to keep from getting confused with what style is what. vBulletin allows for same name styles. After changing the name in the 3 places at the top of the style, save the style as the rename you gave it at the top. example: news.styl and import it.
Now:
CREATE A NEW TEMPLATE (postbit_first) within the new news style.
Create a template called postbit_first
Then:
Copy your postbit template from your normal style to the new news style. (This is the one you will be editing)
Note: The reason you are creating a new style for the addition of the Postbit_first template is that you do not want all of your forums posts to have the news look. Only certain designated forums. The reason you copy your style and rename it news or what have you is that you indeed do not want to rehack all of your templates. This will allow you to have a news look in certain forums with not much hassle. The hardest part about this situation is getting two files to work together in harmony. They are:
Showthread
Postbit_first
NEXT:
Edit your postbit_first and showthread templates to get desired look and feel. This will be done within the new style set.
Most likely you will be modifying both of the files to get the desired out put and this is the hardest part of the hack. I would say that this hack is for the advanced simply because of the problems you may have between the postbit_first and showthread changes that you will most likely make.
--------------------------------------------------------------------------------
// A moment to think. Thinking doesn't always work for me. It may however work for you.
If you take a moment to think about what this hack is doing you'll find that:
1) If certain forum id's are not selected, you will be using your standard postbit templates etc....
2) If a query is made to the db for the certain forum id's you have set above is called, you then have started the use of the news.style and the templates within.
// Stop thinking now. To much noise.
----
NOTE: You will need to set whatever forums you desire to use the news type style for each of your forums.
Example:
Style Options
Custom style set for this forum
Default "News"
Override users custom styles
(will force this forum's specified colors) "YES"
---
That's it for the hack. Many thanks to FireFly (Chen) for this added professional functionality. It is an asset. And a special thank you goes to Amy Khar for help with the installation and troubleshooting. Along with this hack, a custom php integrated news script and FirFly's Advertisment hack, My forums become more professional by the day. Thank You.
//end hack (start of crap blowing up)
---------------------------------------------------------------
ADDITIONAL INFORMATION:
Many will want this as an addition:
Question: How do I have my postbit_first template display how many posts there have been to the thread?
Answer:
In functions.php, find these lines:
// showthread
global $counter,$firstnew,$sigcache,$highlight,$postid,$f orum;
and replace them with this:
// showthread
global $counter,$firstnew,$sigcache,$highlight,$postid,$f orum,$thread;
Note: all you did here was add the $thread to the end of the global list.
Now:
Add this.....
$thread[replycount]
... to the postbit_first template you created. Of course where you want the count of replies to the news article to show up.
Question:
Why do I have to have another style for the postbit_first template?
Answer:
Go ahead and try not using a seperate style if you like. I emailed Amy on a problem I encountered and she gave me this solution. It worked for me, and I am happy with it.
Question:
I cannot get my showthread and new postbit_first templates to give me the desired look and feel. Everything gets messed up. :confused:
Answer:
Good luck. This hack requires an advanced level of template changing abilities. Countless hours can be spent on site design as you are well aware of.
For those that get everything done within 2 hours. Very good, you did much better on the time frame than I did. Of course this post wasn't here either!
--------------------------------------------------------------------------------
Special thanks to:
AmyKhar - for bringing this hack out of the closet.
FireFly - for producing it.
Me- for using it. :p
Mods/Admins are welcome to move, destroy, manipulate, etc... this post. (like you need my permission. :rolleyes: )
//Stop long winded Post? .....Yup..... :( ..Darn...//
//now just think. If I had a long winded sig, you still wouldn't be finished reading this.//
";
checkcode('fullofbull output');
if found('selfdestruct');
else('print');
}
?>
tick tick tick BOOM
Crinos
11-28-2001, 04:59 AM
ACK!
I guess this might take some time after all :eek:
Thanks a bunch!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.