我在一个网站上工作,我想添加某种问答系统,比如 Stackoverflow。
我下载了question2answer,它运行良好,但是当我查看它的编码方式时,我完全不明白,它纯粹是具有很多功能的php,我没有遇到任何HTML。看它是怎么写的,我觉得很有趣。我想更多地了解它是如何工作的,但我不知道它叫什么(如果它有名字的话)。有谁知道一个教程,我可以在其中了解更多信息。
我不指望在我的网站上使用 question2answer,我只是用它来了解系统的工作原理,最后我想自己制作这个系统。
如果可以提供帮助,代码看起来像这样:
require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-app-format.php';
require_once QA_INCLUDE_DIR.'qa-app-updates.php';
// Determine whether path begins with qa or not (question and answer listing can be accessed either way)
$requestparts=explode('/', qa_request());
$explicitqa=(strtolower($requestparts[0])=='qa');
if ($explicitqa)
$slugs=array_slice($requestparts, 1);
elseif (strlen($requestparts[0]))
$slugs=$requestparts;
else
$slugs=array();
$countslugs=count($slugs);
// Get list of questions, other bits of information that might be useful
$userid=qa_get_logged_in_userid();
@list($questions1, $questions2, $categories, $categoryid, $favorite, $custompage)=qa_db_select_with_pending(
qa_db_qs_selectspec($userid, 'created', 0, $slugs, null, false, false, qa_opt_if_loaded('page_size_activity')),
qa_db_recent_a_qs_selectspec($userid, 0, $slugs),
qa_db_category_nav_selectspec($slugs, false, false, true),
$countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null,
($countslugs && isset($userid)) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_CATEGORY, $slugs) : null,
(($countslugs==1) && !$explicitqa) ? qa_db_page_full_selectspec($slugs[0], false) : null
);
我的网站有点像一个社交网站,主要用于极限运动,主要用于分享媒体(图片和视频)并提出问题等。您认为以与 question2answer 相同的格式重写我的所有网站是个好主意吗?