Question2Answer: Get excerpt of the question to display on the question list. Make sure your q2a function should get post id in array otherwise this code won't work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pid = $q_item['raw']['postid']; | |
$query = qa_db_query_sub("SELECT postid, content, format FROM ^posts WHERE postid = $pid"); | |
$cont = qa_db_read_one_assoc($query); | |
$blockwordspreg = qa_get_block_words_preg(); | |
$text=qa_viewer_text($cont['content'], $cont['format'], array('blockwordspreg' => $blockwordspreg)); | |
$text=qa_shorten_string_line(qa_html($text), 200); //200 is the length | |
$this->output('<p class="your-class-for-text">',$text,'</p>'); //you can remove 'p' if you don't want | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and where need to add this code? some help ...