vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Alternate First Post (https://vborg.vbsupport.ru/showthread.php?t=177709)

Digital Jedi 05-01-2008 10:00 AM

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:

<if condition="($post[postcount]=>1)"


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.

valdet 05-01-2008 10:07 AM

Is this what you are looking for..?

https://vborg.vbsupport.ru/showthread.php?t=156141



Good luck.

Digital Jedi 05-01-2008 10:21 AM

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.

Lynne 05-01-2008 03:25 PM

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:

 if ($this->forum['forumid']==xx AND $post['postid']==$this->thread['firstpostid'])
{
$this->templatename 'postbit_new';


In this example, xx is the forum I am using this in and I copied the postbit_legacy template and modified it and named it 'postbit_new'. It's very simple and works just fine.

Digital Jedi 05-03-2008 05:08 AM

I was hoping for something straightforward just like that. I'll give it a try and post back. Thanks a bunch.

Digital Jedi 05-04-2008 07:40 AM

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?

Opserty 05-04-2008 12:01 PM

Quote:

Originally Posted by Digital Jedi (Post 1507787)
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?

Use:
PHP Code:

if(in_array($this->forum['forumid'], array(XXYYZZ)) AND $post['postid'] == $this->thread['firstpostid'])
{
    
$this->templatename 'postbit_new';



Lynne 05-04-2008 03:13 PM

Quote:

Originally Posted by Digital Jedi (Post 1507787)
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

Whoops. Looks like when I copied the code from my template and erased part of it, I left an extra parenthesis in there. Sorry about that. I fixed it above. If you want it for several forums, see Opserty's post to use the array for forumids.

Digital Jedi 05-06-2008 11:35 AM

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?

Lynne 05-06-2008 01:54 PM

Quote:

Originally Posted by Digital Jedi (Post 1510300)
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?

It's possible, but what I would do is do a bit of investigation. If you get that error every time you edit, then try turning off the plugin that uses this new template and then go to edit it again (it will then be using the old template) and see if you still get the error.

Digital Jedi 05-06-2008 02:09 PM

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.

Digital Jedi 05-08-2008 07:59 PM

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.

Lynne 05-08-2008 08:20 PM

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.

Digital Jedi 05-08-2008 09:43 PM

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.)

Lynne 05-08-2008 09:53 PM

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.

Digital Jedi 05-08-2008 10:19 PM

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?

Lynne 05-08-2008 10:45 PM

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.

Digital Jedi 05-09-2008 12:04 PM

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.

tsuNami 08-01-2008 04:52 AM

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
  • Page Generation 0.01266 seconds
  • Memory Usage 1,791KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete