Example #1
0
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>&nbsp;&nbsp;';
            }
            echo '<small> ';
            render_relations($dbc, $id);
            echo '</small>';
        }
        echo "</div>";
        echo "</div>";
    }
}
Example #2
0
                <br>
                <!-- Tab panes -->
                <div class="tab-content">
                    <div class="tab-pane active" id="home">
                        <div class="panel"  style="height:600px; overflow-y:auto;">
                            <?php 
render_entities($dbc, $id);
?>
                      
                        </div>
                    </div>
                    <div class="tab-pane" id="profile">
                        <div class="panel"  style="height:600px; overflow-y:auto;">
                            <ul class="nav nav-pills"> 
                                <?php 
render_relations($dbc, $id);
?>
                      
                            </ul>
                        </div>

                    </div>

                </div>


            </div>

        </div>
    </div>
    <hr>