-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfaqPartial.php
More file actions
51 lines (40 loc) · 1.41 KB
/
faqPartial.php
File metadata and controls
51 lines (40 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require 'vendor/autoload.php';
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
use Parse\ParseClient;
use Parse\ParseSessionStorage;
$app_id = "kddcodGlyJ6DmGI7FihXt8BsXyOTS09Dgpj8UA49";
$rest_key = "ryU6g6D37JtDqIAnPbTq4SLNmihEIy8kSNPZxlhj";
$master_key = "Fm9X40ewplSIEDTOmYxVdCEN7ge31vgfFwScYr3y";
ParseClient::initialize( $app_id, $rest_key, $master_key );
try {
$query = new ParseQuery("FAQ_Category");
$query->each(function($category) {
$questions = $category->getRelation("Questions");
echo "<h4>".$category->get("Text")."</h4>";
echo "<ul>";
$questions->getQuery()->each(function($qa) {
echo "<li>Question: ".$qa->get("Text")."</li>";
echo "<li>Answer: ".$qa->get("AnswerText")."</li>";
echo "<form action='rmvQuestion.php' method='post'>";
echo "<input type='hidden' name='questionId' value='".$qa->getObjectId()."'>";
echo "<button type='submit' class='btn btn-sm btn-danger'>Delete</button>";
echo "</form>";
echo "<br/>";
});
echo "</ul>";
});
} catch (ParseException $error) {
// The login failed. Check error to see why.
echo $error->getMessage();
}
?>