vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Miscellaneous Hacks - Add "Post Excerpt" to search results (https://vborg.vbsupport.ru/showthread.php?t=232538)

RustedBucket 01-07-2010 10:00 PM

Add "Post Excerpt" to search results
 
1 Attachment(s)
This mod is will add a post excerpt to the search results when searching for posts (like it was in VB 3.x).

What do I need to do?
There are two parts to this mod.
  • First step adds the post excerpt to the search_results_postbit template. This will make the excerpt display if you're using the Find All Threads by "User" In User Profile.
    Requires 1 template edit.
  • Second step modifies the Advanced Search to add a check box to select whether or not to show the excerpt when using global search.
    Requires 2 template edits

Installation

PART 1
AdminCP -> Styles & Templates -> Style Manager -> *YOUR STYLE* - I used the Default Style -> Search Templates -> SEARCH _RESULTS_POSTBIT

FIND:
Code:

<vb:if condition="$show['inlinemod']">
<!-- fourth block -->
<label class="threadimod td">
<input type="checkbox" id="post_imod_checkbox_{vb:raw post.postid}" name="imodcheck[{vb:raw post.postid}]" />
</label>
</vb:if>

ADD BELOW:
Code:

<div style="clear:both; border:1px dashed #c4c4c4; padding:10px; margin:10px 5px 5px 5px; background-color:#fefdf2;">
{vb:raw post.pagetext}
</div>

SAVE

* Yes I hardcoded the styling, the assumption being this will get added back to the core.
** If you don't care about having the excerpt show when using the global advanced search you can stop here. Otherwise continue..

PART 2
AdminCP -> Styles & Templates -> Style Manager -> *YOUR STYLE* - I used the Default Style -> Search Templates -> SEARCH_COMMON

FIND:
Code:

        <vb:if condition="$show['nocache']">
        <div class="blockrow">
                <label for="cb_nocache">
                        <input type="checkbox" name="nocache" value="1" id="cb_nocache" {vb:raw nocachechecked}/>&nbsp;{vb:rawphrase do_not_use_cached_results}
                </label>
        </div>
        </vb:if>

ADD ABOVE
Code:

        <vb:if condition="!$show['searchthread']">
        <div class="blockrow">
                <label for="cb_postexcerpt">Show post excerpt &nbsp;
                        <input type="checkbox" name="showposts" value="1" id="cb_postexcerpt" {vb:raw showpostschecked} />
                </label>       
        </div>
        </vb:if>

SAVE

AdminCP -> Styles & Templates -> Style Manager -> *YOUR STYLE* - I used the Default Style -> Search Templates -> SEARCH_INPUT_POST

FIND:
Code:

        <vb:if condition="$show['nocache']">
        <div class="blockrow">
                <label for="cb_nocache">
                        <input type="checkbox" name="nocache" value="1" id="cb_nocache" {vb:raw nocachechecked}/>{vb:rawphrase do_not_use_cached_results}
                </label>
        </div>
        </vb:if>

ADD ABOVE

Code:

        <vb:if condition="!$show['searchthread']">
        <div class="blockrow">
                <label for="cb_postexcerpt">Show post excerpt &nbsp;
                        <input type="checkbox" name="showposts" value="1" id="cb_postexcerpt" {vb:raw showpostschecked} />
                </label>       
        </div>
        </vb:if>

SAVE

And that is it - Job Done !

Please click "Installed" and rate this Thread.

Thank You.

RustedBucket 01-08-2010 02:07 PM

Reserved

baghdad4ever 02-26-2010 12:04 PM

thank you verymuch

baghdad4ever 02-27-2010 10:31 AM

it is working with 4.0.2 pl1

http://www.baghdad4ever.net/dros/vbulletin4/search6.JPG

Addams 03-29-2010 10:00 AM

Aw, thanks! This is really useful ^^

How can I made it checked by default? :) Thanks!

Sorry for my english.

sKippah 03-31-2010 06:45 PM

Absolutly nice. Tagged ;)

Is there a way to get this also for 2 languages? I am running a german/english board, and it would be nice if the sentence "Show post excerpt" changes, when someone is changing the board language. Thanks a lot

Muniesa 05-11-2010 10:33 AM

Thanks for the mod. Not as streamline as in vb3, but for a user mod it's great work!

For those interested in making the search tick the box by default, just insert

Code:

checked="checked"
anywhere in the input type tag in steps 2 & 3.

E.g. I wrote had it as:

Code:

<input type="checkbox" name="showposts" checked="checked"
    value="1" id="cb_postexcerpt" {vb:raw showpostschecked} />


Welshy2008 06-11-2010 11:51 AM

Installed and working well on vB4.0.3 PL1 - Thank You.

Welshy2008 08-17-2010 12:09 PM

Is this confirmed as woring on vB4.0.5 and 4.0.6, Please?

Welshy2008 09-24-2010 07:44 AM

Didn't work on my 4.0.6. :(

By The way, in vB4.0.6 the following codes are replaced with the code shown underneath...


OP's original code in: (SEARCH _RESULTS_POSTBIT)

Code:

<vb:if condition="$show['inlinemod']">
<!-- fourth block -->
<label class="threadimod td">
<input type="checkbox" id="post_imod_checkbox_{vb:raw post.postid}" name="imodcheck[{vb:raw post.postid}]" />
</label>
</vb:if>

In 4.0.6 it's replaced with:

Code:

                        <vb:if condition="$show['inlinemod']">
                        <span class="nodecontrols">
                                <input type="checkbox" id="post_imod_checkbox_{vb:raw post.postid}" name="imodcheck[{vb:raw post.postid}]" />
                        </span>
                        </label>
                        </vb:if>

OP's Original code in: (SEARCH_COMMON)

Code:

        <vb:if condition="$show['nocache']">
        <div class="blockrow">
                <label for="cb_nocache">
                        <input type="checkbox" name="nocache" value="1" id="cb_nocache" {vb:raw nocachechecked}/>&nbsp;{vb:rawphrase do_not_use_cached_results}
                </label>
        </div>
        </vb:if>

In 4.0.6 it's replaced with:

Code:

                <vb:if condition="$show['nocache']">
                <div class="blockrow">
                        <label for="cb_nocache" class="rightcol">
                                <input type="checkbox" name="nocache" value="1" id="cb_nocache" tabindex="1" {vb:raw nocachechecked}/>&nbsp;{vb:rawphrase do_not_use_cached_results}
                        </label>
                </div>
                </vb:if>


OP's original code in: (SEARCH_INPUT_POST)


Code:

        <vb:if condition="$show['nocache']">
        <div class="blockrow">
                <label for="cb_nocache">
                        <input type="checkbox" name="nocache" value="1" id="cb_nocache" {vb:raw nocachechecked}/>{vb:rawphrase do_not_use_cached_results}
                </label>
        </div>
        </vb:if>

In 4.0.6 it's replaced with:

Code:

                <vb:if condition="$show['nocache']">
                <div class="blockrow">
                        <label for="cb_nocache" class="rightcol">
                                <input type="checkbox" name="nocache" value="1" id="cb_nocache" tabindex="1" {vb:raw nocachechecked}/> {vb:rawphrase do_not_use_cached_results}
                        </label>
                </div>
                </vb:if>



All times are GMT. The time now is 11:57 PM.

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.01184 seconds
  • Memory Usage 1,758KB
  • 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
  • (14)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete