mediawiki:使用类别为每篇文章分配唯一的引用

问题描述

我想在每篇文章中创建一个唯一的参考。这是通过将类别与以下模板结合使用来完成的,该模板使用主题前缀扩展了PageID。

{{Category:{{{{ReferenceID|Item}}}
}{{PAGEID}}}}

我已经将其整合到这样的文章

{{1}}

模板的文本可以正确显示,但是Mediawiki不能将其识别为类别,并且也不会显示在特殊页面“所需的类别”上。

怎么了?可能还有其他选择

解决方法

为页面分配类别的语法为[[Category:{{{Category:{{{{ReferenceID|Item}}}}{{PAGEID}}}}}{{PAGEID}}]],而不是ReferenceID

Wiki代码ReferenceID仅在具有{{ReferenceID|Item}}参数的模板中才有意义。上面的模板没有添加类别。

如果{{{ReferenceID|Item}}}是上面模板的名称,则将其插入为:#redirect [[(full page name)]],而不是(theme prefix)/(page id)

为每个页面创建类别的想法很奇怪。如果希望每个页面都可以通过唯一ID进行访问,请在标题mysql -u <dbuser> -p -e "delete from <dbname>.theme where theme_path ='<Vendorname>/<themename>' AND area ='frontend' limit 1" 下创建类似于#include <iostream> #include <string> #include<Windows.h> #include<string.h> #include<ctype.h> #include<conio.h> #include<fstream> #include<vector> #include<sstream> using namespace std; void gotoxy(int x,int y) { COORD c; c.X = x; c.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c); } class textgame { private: int count,power2x,power3x,score,point1,point2,point3,life,x,y; string ans,name,result,namescore,temp; vector<string> victor; public: textgame() { y = 0; x = 0; count = 0; point1 = 100; point2 = 200; point3 = 300; power2x = point2 * 2; power3x = point3 * 3; life = 3; score = 0; }; ~textgame() { system("cls"); ofstream scoreBoard; scoreBoard.open("scoreboard.txt",ofstream::app); gotoxy(50,0); cout << "GAME OVER"; gotoxy(50,2); cout << "ENTER YOUR NAME:"; cin.ignore(); getline(cin,ans); scoreBoard <<score << " " << ans << endl; scoreBoard.close(); gotoxy(50,4); cout << "PRESS ANY KEY TO GO BACK TO MAIN MENU"; while (1) { if (_kbhit()) { game_menu(); } } } void game_menu() { system("cls"); gotoxy(50,2); cout << "PLAY RIDDLES [1]"; gotoxy(50,4); cout << "SCOREBOARDS [2]"; gotoxy(50,6); cout << "Exit [3]"; gotoxy(52,8); cout << ">"; cin >> ans; cin.ignore(); count = ans.length(); if (count == 1 && ans == "1") { ingame(); } else if (count == 1 && ans == "2") { scores(); } else if (count == 1 && ans == "3") { exit(0); } else { game_menu(); } } void ingame(){ system("cls"); score = 0; life = 3; do { gotoxy(50,0); cout << "||||LEVEL 1||||"; gotoxy(80,0); cout << "SCORE:" << score; if (life >0) { gotoxy(25,0); cout << "LIFE:" << life; } gotoxy(40,2); cout << "WHAT GETS WETTER THE MORE IT DRIES?"; gotoxy(53,4); cout << "_ _ W _ L"; gotoxy(50,6); cout << "GUESS THE WORD BOI:>"; cin >> ans; if (ans =="towel"|| ans == "Towel"||ans=="TOWEL") { gotoxy(45,8); cout << "NICE ONE,THATS THE CORRECT ANSWER!"; score += point1; gotoxy(45,10); cout << "PRESS ANY KEY TO CONTINUE"; while (1) { if (_kbhit()) { break; } } } else { system("cls"); gotoxy(45,8); cout << "YOU GOTTA STEP UP YOUR GAME! "; life = life - 1; score -= point1; } } while (ans != "towel" && ans != "Towel"&&ans!="TOWEL"&&life>0); system("cls"); if (life > 0) { do { gotoxy(50,0); cout << "||||LEVEL 2||||"; gotoxy(80,0); cout << "SCORE:" << score; if (life > 0) { gotoxy(25,0); cout << "LIFE:" << life; } gotoxy(40,2); cout << "WHAT IS SO FRAGILE THAT WHEN YOU SAY IT,IT BREAKS"; gotoxy(53,4); cout << "S _ _ E _ C _"; gotoxy(50,6); cout << "GUESS THE WORD BOI:>"; cin >> ans; if (ans == "silence" || ans == "Silence" || ans == "SILENCE") { gotoxy(45,THATS THE CORRECT ANSWER!"; score += power2x; gotoxy(45,10); cout << "PRESS ANY KEY TO CONTINUE"; while (1) { if (_kbhit()) { break; } } } else { system("cls"); gotoxy(45,8); cout << "YOU GOTTA STEP UP YOUR GAME! "; life -= 1; score -= point2; } } while (ans != "silence" && ans != "Silence" && ans != "SILENCE" && life > 0); } system("cls"); if (life > 0) { do { gotoxy(50,0); cout << "||||LEVEL 3||||"; gotoxy(80,2); cout << "I never was,am always to be,/No one ever saw me,nor ever will"; gotoxy(35,4); cout << "And yet I am the confidence of all / To live and breathe on this terrestrial ball."; gotoxy(53,6); cout << "T _ M _ _ _ O _ "; gotoxy(50,8); cout << "GUESS THE WORD BOI:>"; cin >> ans; if (ans == "tomorrow" || ans == "Tomorrow" || ans == "TOMORROW") { gotoxy(45,THATS THE CORRECT ANSWER!"; score += power3x; gotoxy(45,10); cout << "PRESS ANY KEY TO CONTINUE"; while (1) { if (_kbhit()) { break; } } } else { system("cls"); gotoxy(45,10); cout << "YOU GOTTA STEP UP YOUR GAME! "; life -= 1; score -= point3; } } while (ans != "tomorrow" && ans != "Tomorrow" && ans != "TOMORROW" && life > 0); } } void scores() { system("cls"); ifstream scoreBoard; scoreBoard.open("scoreboard.txt"); while (!scoreBoard.eof()) { getline(scoreBoard,namescore); if (scoreBoard.eof()) { break; } victor.push_back(namescore); x++; } scoreBoard.close(); for (int i = 0; i < x; i++) { for (int j = i + 1; j < x; j++) { if (victor[j]<victor[i]) { temp = victor[i]; victor[i] = victor[j]; victor[j] = temp; } } } for (int i = 0; i < x; i++) { gotoxy(50,0); cout << "SCOREBOARDS"; gotoxy(50,i + 2); cout << victor[i]; y = i + 2; } gotoxy(50,y + 2); cout << "Go back to Main menu[1]"; gotoxy(50,y + 4); cout << "EXIT[2]"; cin >> ans; count = ans.length(); if (count == 1 && ans == "1") { game_menu(); } else if (count == 1 && ans == "2") { exit(0); } else { game_menu(); } } }; int main() { textgame obj; obj.game_menu(); return 0; } 的重定向。您可能需要将这些重定向存储在单独的命名空间中。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...