Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
664 views
in Q2A Core by
edited by

Question List Page

-------------------------

Question title
Question preview this area
asked 1 day ago in football by david

 

Other question title
Question preview this area
asked 2 day ago in basketball by john
 

 

 

....
----------------------

I've tried this code on qa-theme-base.php but it did not work.
 
function q_item_title($q_item)
{
$this->output(
'<DIV CLASS="qa-q-item-title">',
'<A HREF="'.$q_item['url'].'">'.$q_item['title'].'</A>',
$q_view['content'],                      <---- added this line
'</DIV>'
);


I don't want to use Mouseover Layer plug-in
Need help.
Q2A version: 1.5.2
by
Did you succeed in solving this problem? I have been trying to do the same but no success so far. If you solved it, please assist me.

3 Answers

0 votes
by

 

I fond this code in a theme called  Q2AStack... Hope this could help :) 
 
function post_meta($post, $class, $prefix=null, $separator='<BR/>')
{
if(($this->template == 'question' && $class !='qa-c-item') || $this->template == 'questions') {
   $this->output('<div CLASS="'.$class.'-meta-div">');
   $separator='</div><div CLASS="'.$class.'-meta-div-2">';
   if(isset($post['who'])) {
$post['who']['prefix'] = '<br/>';
$post['who']['data'] .= '<br/>';
   }
   if(isset($post['who_2'])) {
$post['who_2']['prefix'] = '<br/>';
$post['who_2']['data'] .= '<br/>';
   }
   if(isset($post['who']['points'])) {
$post['who']['title'] = @$post['who']['title'] . '</span>'.(isset($post['who']['title'])?'&nbsp;':'').'<span class="'.$class.'-who-points-data">'.$post['who']['points']['data'];
unset($post['who']['points']);
   }
   qa_html_theme_base::post_meta($post, $class, $prefix, $separator);
   $this->output('</div>');
}
else qa_html_theme_base::post_meta($post, $class, $prefix, $separator);
return;
$this->output('<SPAN CLASS="'.$class.'-meta">');
 
if (isset($prefix))
$this->output($prefix);
 
$order=explode('^', @$post['meta_order']);
 
foreach ($order as $element)
switch ($element) {
case 'what':
$this->post_meta_what($post, $class);
break;
 
case 'when':
$this->post_meta_when($post, $class);
break;
 
case 'where':
$this->post_meta_where($post, $class);
break;
 
case 'who':
$this->post_meta_who($post, $class);
break;
}
 
$this->post_meta_flags($post, $class);
 
if (!empty($post['when_2'])) {
$this->output($separator);
 
foreach ($order as $element)
switch ($element) {
case 'when':
$this->output_split($post['when_2'], $class.'-when');
break;
 
case 'who':
$this->output_split(@$post['who_2'], $class.'-who');
break;
}
}
 
$this->output('</SPAN>');
}
by
it didn't work.
0 votes
by
Old question, here is the answer (should work for q2a 1.5 and 1.6):

/* 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
by
Not working in snowflat
+1 vote
by

If you want question text as an excerpt than this question has been answered before couple of time. Here is the Gist Code

Instead of database query you can get question content from its array. For example $q_view['content']

...