Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
2.1k views
in Q2A Core by
I want to show summery of question in list page, right after the title.

please help me.
Q2A version: latest
by
Required advance theme or plugin. In fact this is in my plugins dev list.
by
great stuff! love the jquery thing :)

@gidgreen: Btw, we need this for improving the search. A snippet from the text where the search term is found. see also n°4 in http://www.question2answer.org/qa/18173/improving-the-search-search-algorithm-q2a-things-do-better

3 Answers

+4 votes
by
selected by
 
Best answer

Here is the PHP solution.

Make sure you have installed mouseover layer. open 'qa-mouseover-layer.php' in plugin folder

then replace line 54 t0 62 with this one:

                    foreach ($q_list['qs'] as $index => $question) {
                        $thispost=@$postinfo[$question['raw']['postid']];
                        
                        if (isset($thispost)) {
                            $text=qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                            $text=qa_shorten_string_line($text, $maxlength);
                            $q_list['qs'][$index]['content']='<SPAN >'.qa_html($text).'</SPAN>';
                        }
                    }

and go to your advance theme file, open it and inert this :

 

        function q_item_main($q_item)
        {
            $this->output('<DIV CLASS="qa-q-item-main">');
            
            $this->view_count($q_item);
            $this->q_item_title($q_item);
            $this->q_item_content($q_item);

            $this->post_avatar_meta($q_item, 'qa-q-item');
            $this->post_tags($q_item, 'qa-q-item');
            $this->q_item_buttons($q_item);
                
            $this->output('</DIV>');
        }

by
edited by
This is better solution than jQuery.
by
Yes you are right, I am also using this
by
Can you explain what the "advanced theme file" is?

Thanks,
B
+2 votes
by
OK, you can use jQuery, Here:

    jQuery('div.qa-q-item-title').each(function(){
        var excerpt = jQuery(this).find('span').attr('title');
        var div_text = jQuery('<p class="excerpt"></p>').text(excerpt);
        jQuery(this).append(div_text);
        //alert(excerpt);
    });
0 votes
by
/* Question Content below Question Title */

function q_item_title($q_item) {

    $blockwordspreg = qa_get_block_words_preg();
    $maxlength = qa_opt('mouseover_content_max_len');
    
    $result=qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $q_item['raw']['postid']);
    $postinfo=qa_db_read_all_assoc($result, 'postid');
    $thispost=@$postinfo[$q_item['raw']['postid']];
    
    $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
    $text = strip_tags($text); // removes all img, p, etc. tags
    $text = qa_shorten_string_line($text, $maxlength);
    $q_preview = '<p>'.qa_html($text).'</p>'; // for full question content use: $thispost['content']

    $this->output(
        '<div class="qa-q-item-title">
        <a href="'.$q_item['url'].'">'.$q_item['title'].'</a>'
        .$q_preview.
        '</div>'
    );
}

Hope that helps ;)
Kai
...