![]() |
Alternate First Post
When trying to change the HTML of the fist post so you get a different look for the initial post (like they do for the mods section here), I've been using:
PHP Code:
But I don't think that's the best way to do this. And I've been searching for hours now, but postbit is such a common term here, that I can't really make any headway. What's the best way to achieve the look that they use here on vb.org? I'm using an alternate style to accomplish this. But I want the first post to be the only thing different. |
|
Perhaps even more then I was looking for. Didn't expect to find something that kept the post on every page. Thanks. I'll consider it.
But, I was hoping to be able to do the editing manually. Something more along the lines of some basic <if> conditionals and where to put them. |
I'm playing with this on my test site. I only wanted to change the first post for one of my forums though. I created a plugin at "postbit_display_complete" and put in:
PHP Code:
|
I was hoping for something straightforward just like that. I'll give it a try and post back. Thanks a bunch.
|
Hrm, seems I get one of those repetitive Parse error: syntax error, unexpected '{' in FILE PATH/includes/class_postbit.php(296) : eval()'d code on line 207 at the top of the page. No changes either. Should I have made a file edit to postbit.php as well?
EDIT: Hrm, it appears there was a parenthesis missing in the plugin code. At the very least, changing this [firstpostid]) to this [firstpostid])) took care of my problem. <perplexed> :D --------------- Added 04 May 2008 at 05:20 --------------- Another quick question, if you don't mind. Do I need to create a separate plugin for each forum ID, or can I separate forum IDs in the plugin code just by separating them with a comma? |
Quote:
PHP Code:
|
Quote:
|
Heheh, that's okay. Seems to be working perfectly for me. Many thanks to both of you. I created a template called postbit_articles with the custom HTML, and it's working just the way I had hoped. The only minor little thing I ran into is a small null is not an object error after editing a post in the full editor. Is it possible I left something out in the recreation of the postbit?
|
Quote:
|
I did indeed try that. But no error when saved when inactive. I can actually recreate the error by linking you to the same page you get after editing: http://www.cogonline.net/forums/show...025#post351025
I may just have to go through my HTML with a fine tooth comb. --------------- Added 06 May 2008 at 12:51 --------------- Hrm, I think I know what was wrong. I think I was missing the $post[scrolltothis] variable. Just a guess, but I'm not getting the error now. |
If I might ask an additional question related to this, I thought I was being pretty smart here, but apparently, reality is determined to prevent that from ever happening.
What I was trying to do was change the first post in the thread using this plugin, then I made the forum I was using it in use a child style. I pasted in the postbit code into postbit_legacy of the child style, and set the plugin to include that forum. The intention, was to keep the rest of my forum in postbit_legacy, have the specific forum use the postbit layout AND alter the first post of threads in that forum. Well, it works. Problem is, I get one of those dreaded repetative errors at the top of the page. Warning: Unexpected character in input: ''' (ASCII=39) state=1 in forum/path/forums/includes/class_postbit.php(296) : eval()'d code on line 224. I've managed to use the plugin several times with no problems and with different postbit designs. Is the child style my problem now? Maybe there's was a simpler way to go about what I was trying? EDIT: And if I might add, the posts look kind of funky. The content is off center. |
Let me see if I understand what you've done.
You have a site with several forums. One forum, x, you want to have shown with a new template as the first post and the rest of the posts in the thread show the postbit template. For all the other forums, you want the postbit_legacy template to be used. So, you have postbit_legacy set to be the post template used, then you created a new style, a child of your main one, and replaced the postbit_legacy template with the postbit template. You set this style as the default forum style for that forum in the Forum Manager. And, you have a plugin that says when in forum x, use a new template for the firstpost in the thread. The way you have done it *should* work. However, there seems to be a problem with another plugin you have that uses the postbit_display_complete hook (executed on line 296 of class_postbit.php as shown in your error.) You may want to try disabling any other product using that hook and see if you get that error. |
You got it. That's exactly what I was trying to do.
Okay, strange happenings. I didn't realize the error was site wide. Some forums wouldn't show at all. Disabling each one using that hook didn't have any effect. So I turned off the forced style in the Forum Manager, to no effect. I deleted the child style, and still kept getting the error. So I just decided to delete the plugin and try again... And it's working okay now. :confused: Is it possible that when I first saved the plug, it didn't save right? Can a plugin be corrupted somehow? I quadruple checked the code to make sure it was correct the first time. (DJ's school of coding. When all else fails, delete everything.) |
Do you have any other plugins using that hook? I wonder if two plugins are conflicting with each other.
What about, are you sure your new postbit is correct? Maybe try testing it out on a test site or on a style that only you have access to and see if it is your postbit causing the error. |
I did try that, but continued to receive the error until I deleted the plugin altogether. But like I said, it's working fine now. The solution seemed to require me to delete the plugin and make it again. The thing is, I'm sure the code was correct the first time. I resaved it four times. But making it over seemed to be only thing that helped. I guess it was corrupted, or maybe my steps where in the wrong order?
|
For some reason I missed that line that said it was working OK now. (I swear I had my glasses on, but.....). Anyway, I'm glad it is cuz I really couldn't think of why it would not work for you.
|
Anything like that happens to me, and I blame it on either the absence or deficiency of caffeine related products. :)
In any case, many thanks for sharing the plugin with me. It has been the means to a great many ideas that I previously didn't know how to implement. |
thank you, Lynne.
your solution works like a charm for my board! :) regards. |
All times are GMT. The time now is 06:01 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|