當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Topic::getAll方法代碼示例

本文整理匯總了PHP中Topic::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Topic::getAll方法的具體用法?PHP Topic::getAll怎麽用?PHP Topic::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Topic的用法示例。


在下文中一共展示了Topic::getAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: find

 static function find($search_id)
 {
     $found_topic = null;
     $topics = Topic::getAll();
     foreach ($topics as $topic) {
         $id = $topic->getId();
         if ($search_id == $id) {
             $found_topic = $topic;
         }
     }
     return $found_topic;
 }
開發者ID:umamiMike,項目名稱:promptr,代碼行數:12,代碼來源:Topic.php

示例2: question

                            <tr><td><input type="text" name="question" value="" id="second_td" style="display:none;"/></td></tr>
                            <tr>
                                <td id="first_td">Describe your Question/Problem (Min 60 characters) : </td>
                                <td><textarea id="teatarea_td" name="question" placeholder="Describe your Question/Problem (Min 60 characters)"></textarea></td>
                            </tr>
                            <tr>
                                <td id="first_td">Heading (Min 20 characters) : </td>
                                <td><input type="text" id="second_td" name="heading" placeholder="Provide an appropriate heading for your question (minimum 20 characters)"/></td>
                            </tr>
                            <tr>
                                <td id="first_td">Topic : </td>
                                <td><select id="second_td" name="topic_id">
                                        <option value="">--Select Topic--</option>
                                         <?php 
$topicObj = new Topic();
$rows = $topicObj->getAll();
foreach ($rows as $row) {
    ?>
 
                                        <option value="<?php 
    echo $row['topic_id'];
    ?>
"><?php 
    echo $row['topic'];
    ?>
</option>
                                        <?php 
}
?>
                                    </select>
開發者ID:sonaljain888,項目名稱:project-legal-lawyer-,代碼行數:30,代碼來源:Online-Legal-Advice.php

示例3: array

    return $app['twig']->render('promptr.html.twig', array('promptr' => $promptr, 'questions' => $promptr->getQuestions(), 'topic' => $topic));
});
// PROMPTRS.HTML.TWIG
// ADD PROMPTR -- adds a prompter and displays promptrs within the topic
$app->post("/promptrs", function () use($app) {
    $promptr_name = $_POST['promptr_name'];
    $topic_id = $_POST['topic_id'];
    $new_promptr = new Promptr($promptr_name, $topic_id);
    $new_promptr->save();
    return $app['twig']->render('promptrs.html.twig', array('promptrs' => Promptr::getAll(), 'topic' => $topic_id, 'topic_picked' => true));
    // flag for included template
});
$app->get("/topic/{id}", function ($id) use($app) {
    $topic = Topic::find($id);
    $promptrs = $topic->getPromptrs();
    $allT = Topic::getAll();
    return $app['twig']->render("topic.html.twig", array('topic' => $topic, 'promptrs' => $promptrs, 'all_topics' => $allT));
});
// PROMPTR.HTML.TWIG
//delete question from NEW PROMPTR route -- then displays promptr page
$app->get("promptr/{id}", function ($id) use($app) {
    $promptr = Promptr::find($id);
    $questions = $promptr->getQuestions();
    return $app['twig']->render("promptr.html.twig", array('promptr' => $promptr, 'questions' => $questions));
});
//delete question route
$app->delete("/promptr/{id}/delete_question/{qId}", function ($id, $qId) use($app) {
    $question_id = $qId;
    $promptr = Promptr::find($id);
    $topic = Topic::find($promptr->getTopicId());
    $question = Question::findById($question_id);
開發者ID:umamiMike,項目名稱:promptr,代碼行數:31,代碼來源:app.php

示例4: test_update

 function test_update()
 {
     $name = "Writing";
     $test_topic = new Topic($name);
     $test_topic->save();
     $name2 = "Interview";
     $test_topic->update($name2);
     $topics = Topic::getAll();
     $result = $topics[0]->getName();
     $this->assertEquals($name2, $result);
 }
開發者ID:umamiMike,項目名稱:promptr,代碼行數:11,代碼來源:TopicTest.php

示例5: Topic

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<?php 
require 'core/init.php';
$topic = new Topic();
$template = new Template('templates/frontpage.php');
$template->topics = $topic->getAll();
//echo '<pre>';
//var_dump($t);
//echo '</pre>';
echo $template;
開發者ID:pivnicki,項目名稱:test,代碼行數:16,代碼來源:index.php


注:本文中的Topic::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。