function render_paragraphs($dbc, $db_name, $title) { $keywords = mysql_escape_string($title); $query = "select * from resource where title = '{$keywords}'"; //echo $title; $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query); while ($row = mysqli_fetch_array($result)) { $id = trim($row["id"]); $description = trim($row["description"]); echo "<div class='row'>"; echo "<div class='col-sm-8'>"; $keywords = get_keywords($dbc, $id); $predicates = get_predicates($dbc, $id); $description = preprocess_description($db_name, $description, $keywords, $predicates); echo $description; echo "</div>"; echo "<div class='col-sm-4'>"; if (count($keywords) != 0) { echo '<small>相关概念:</small>'; foreach ($keywords as $keyword) { //echo '<p>' . $keyword . ": " . $def . '</p>'; echo '<button type="button" class="btn btn-xs btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-content="' . get_def($dbc, $keyword) . '">'; echo $keyword; echo '</button> '; } echo '<small> '; render_relations($dbc, $id); echo '</small>'; } echo "</div>"; echo "</div>"; } }
<li class="active"><a href="#view" data-toggle="tab">查看古籍原文</a></li> <li><a href="#edit" data-toggle="tab">编辑古籍原文</a></li> </ul> <br> <p class="lead"><font face="微软雅黑"><?php echo '医学纲目 / ' . get_title($title); ?> </font></p> <div class="tab-content"> <div class="tab-pane active" id="view"> <div class="panel" style="height:600px; overflow-y:auto;"> <?php $keywords = get_keywords($dbc, $text_id); $predicates = get_predicates($dbc, $text_id); echo preprocess_description($db_name, $description, $keywords, $predicates); ?> </div> </div> <div class="tab-pane" id="edit"> <form role="form" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" class="form-horizontal" enctype="multipart/form-data"> <div class="container"> <input type="hidden" id="db_name" name="db_name" value = "<?php if (isset($db_name)) { echo $db_name; } ?>