٩٩٤
تعديل
[مراجعة منقحة] | [مراجعة منقحة] |
لا ملخص تعديل |
لا ملخص تعديل وسم: مسترجع |
||
سطر ٢٣: | سطر ٢٣: | ||
<!-- يمكنك إضافة المزيد من البطاقات حسب الحاجة --> | <!-- يمكنك إضافة المزيد من البطاقات حسب الحاجة --> | ||
</div> | </div> | ||
{{#widget:Php | |||
| code = ' | |||
<?php | |||
$wiki_api_endpoint = "https://your-wiki-domain.com/w/api.php"; | |||
$category_name = "Your_Category_Name"; | |||
$params = array( | |||
"action" => "query", | |||
"format" => "json", | |||
"list" => "categorymembers", | |||
"cmtitle" => "Category:" . $category_name, | |||
"cmlimit" => 1, | |||
"cmprop" => "title", | |||
"cmtype" => "page", | |||
"cmsort" => "timestamp", | |||
"cmdir" => "desc", | |||
); | |||
$url = $wiki_api_endpoint . "?" . http_build_query($params); | |||
$data = json_decode(file_get_contents($url), true); | |||
if (isset($data["query"]["categorymembers"]) && count($data["query"]["categorymembers"]) > 0) { | |||
$last_article_title = $data["query"]["categorymembers"][0]["title"]; | |||
echo "<h2>Last Article in $category_name Category:</h2>"; | |||
echo "<p>$last_article_title</p>"; | |||
} else { | |||
echo "<p>No articles found in the $category_name category.</p>"; | |||
} | |||
?>' | |||
}} |