Установка и настройка PHPBB3.

Переменные в шаблонах phpBB 3.x

Александр » 28 апр 2017, 20:56

Сложу здесь всю известную мне информацию о переменных, используемых в шаблонах phpBB 3.x

Перевод делать почти не стал по двум причинам:
1) Если Вы занимаетесь программированием, то чтение документации на английском должно быть для вас обыденностью — как родной язык;
2) Со временем планирую часть материалов на форуме писать на английском для.. для.. для.. пользователей интернета :ugeek:.

By convention, template variable names are always all-uppercase. Variables output to the user are enclosed in curly braces (e.g. {L_SOME_VARIABLE}) while variables in control structures are used directly.
(По соглашению имена переменных задаются в верхнем регистре. Для вывода пользователю переменная должна быть заключена в фигурные скобки (например, {L_SOME_VARIABLE}), в то время как переменные в управляющих структурах используются "как есть".)

Также действуют следующие соглашения в именовании переменных:

  • Template related variables are prefixed with "T_". These are usually pre-assigned by the phpBB3 core code.
  • Variables to be used in control structures or for form actions etc. are prefixed with "S_".
  • Variables containing URls are prefixed with "U_".
  • Language variables for output are called "L_LANGUAGE_KEY". Where "LANGUAGE_KEY is an existing language entry's key. These are assigned automatically.
  • Language variables for use in javascript are called "LA_LANGUAGE_KEY". Where "LANGUAGE_KEY is an existing language entry's key. These are assigned automatically.
  • Values for display are not prefixed.
Ну, и прежде чем начать выкладывать списки переменных, хочу напомнить, что в шаблонах phpBB 3.x существует такое понятие как блоки, скажем так, это как массивы, многомерные структуры с точечной нотацией, в общем выглядят они примерно так:
Код: Выделить всё
<div>
<!-- BEGIN somerow -->
   <ul>
      <li>{somerow.VAR1}</li>
      <li>{somerow.VAR2}</li>
   </ul>
<!-- END somerow -->
</div>

Блоки в шаблонах используют обычно для создания циклов с помощью управляющих структур.
By convention, template variable names are always all-uppercase where block names are always all-lowercase — Имена блоков в отличии от имен переменных должны быть в нижнем регистре.

Global Template Variables/Глобальные переменные шаблонов


Variable/Переменная Type/Тип Description /Описание
A_COOKIE_SETTINGS Type: String Cookie settings with single quotes, double quotes and backslashes escaped.
BOARD_URL Type: URL Board URL.
CURRENT_TIME Type: Language string Current time.
DEBUG_OUTPUT Type: Language string Debug output.
LAST_VISIT_DATE Type: Language string Last visit date.
LAST_VISIT_YOU Type: Language string Last visit date.
LOGGED_IN_USER_LIST Type: Language string List of logged in users.
L_INDEX Type: Language string Board index
L_LOGIN_LOGOUT Type: Conditional language string Returns <em>Login</em> or <em>Logout [ Username ]</em> based on the user's logged in status.
L_ONLINE_EXPLAIN Type: Language string Who is online time span.
PAGE_TITLE Type: Language string Current page title.
PRIVATE_MESSAGE_INFO Type: Language string Total number of new messages. Private messages are considered "new" until the user views his inbox.
PRIVATE_MESSAGE_INFO_UNREAD Type: Language string Total number of unread messages.
RECORD_USERS Type: Language string Record number of most users ever online.
ROOT_PATH Type: URL Path to the phpBB root.
RUN_CRON_TASK Type: Image Used for board cron tasks such as pruning.
SCRIPT_NAME Type: String Current script (p, p, p, etc.) with its file extension removed.
SESSION_ID Type: String User's session ID. Unlike {_SID}, {SESSION_ID} will always return a value.
SID Type: String Session ID parameter. The actual session value will only be appended to the parameter if the user does not have cookies enabled on his browser.
SITENAME Type: String Site name.
SITE_DESCRIPTION Type: String Site description.
SITE_LOGO_IMG Type: Image Board logo.
S_AUTOLOGIN_ENABLED Type: Boolean Returns true if autologin is enabled.
S_BOARD_DISABLED Type: Boolean Returns true if the board is disabled.
S_CONTENT_DIRECTION Type: String Language direction -- ltr or rtl.
S_CONTENT_ENCODING Type: String Content encoding.
S_CONTENT_FLOW_BEGIN Type: String Beginning of language direction (left to right in this case).
S_CONTENT_FLOW_END Type: String End of language direction (left to right in this case).
S_DISPLAY_MEMBERLIST Type: Boolean Returns true if the user has access to the member list.
S_DISPLAY_ONLINE_LIST Type: Boolean Returns true if the "Who is online" feature is enabled.
S_DISPLAY_PM Type: Boolean Returns true if the PM system is enabled, the user is registered and is allowed to read or send private messages.
S_DISPLAY_SEARCH Type: Boolean Returns true if the user has permission to use the search system.
S_ENABLE_FEEDS Type: Boolean Returns true if the ATOM feeds feature is enabled.
S_ENABLE_FEEDS_FORUMS Type: Boolean Returns true if per-forum feeds are enabled.
S_ENABLE_FEEDS_NEWS Type: Boolean Returns true if the news feed is enabled.
S_ENABLE_FEEDS_OVERALL Type: Boolean Returns true if the board-wide feed is enabled.
S_ENABLE_FEEDS_TOPICS Type: Boolean Returns true if per-topic feeds are enabled.
S_ENABLE_FEEDS_TOPICS_ACTIVE Type: Boolean Returns true if the active topics feed is enabled.
S_FORUM_ID Type: Integer Forum ID.
S_IS_BOT Type: Boolean Returns true if the current user is a bot.
S_LOAD_UNREADS Type: Boolean Returns true if searching for unread posts is enabled, and the user is registered or read/unread status storage is enabled for guests.
S_LOGIN_ACTION Type: URL Login form action.
S_LOGIN_REDIRECT Type: String Login form redirect.
S_NEW_PM Type: Boolean Returns true if the current user has new private messages. Private messages are considered "new" until the user views his inbox.
S_REGISTERED_USER Type: Boolean Returns true if the user is registered.
S_REGISTER_ENABLED Type: Boolean Returns true if registration is enabled.
S_TIMEZONE Type: Language string User's time zone. The guest time zone is defined by the anonymous user's settings.
S_TOPIC_ID Type: Integer Topic ID.
S_USERNAME Type: String Current user's username.
S_USER_BROWSER Type: String Current user's browser agent.
S_USER_LANG Type: String Current user's board language.
S_USER_LOGGED_IN Type: Boolean Returns true if the current user is logged in.
S_USER_NEW Type: Boolean Returns true if the current user was registered while having the <em>Set Newly Registered Users group to default</em> setting enabled, <em>New member post limit</em> set to a number greater than 0 (settings do not apply to users retroactively), and user is still in the <em>Newly registered users</em> group.
S_USER_NEW_PRIVMSG Type: Boolean Total number of new private messages. Private messages are considered "new" until the user views his inbox.
S_USER_PM_POPUP Type: Boolean Returns true if the user prefers a window to pop up when a new private message is received.
S_USER_UNREAD_PRIVMSG Type: Integer Total number of unread private messages.
TOTAL_USERS_ONLINE Type: Language string Current number of registered users and guests online.
TRANSLATION_INFO Type: Language string Translation info.
T_AVATAR Type: String Uploaded avatars directory.
T_AVATAR_GALLERY Type: String Avatar gallery directory.
T_AVATAR_GALLERY_PATH Type: URL Path to the avatar gallery directory.
T_AVATAR_PATH Type: URL Path to the uploaded avatars directory.
T_ICONS Type: String Topic icons directory.
T_ICONS_PATH Type: URL Path to the topic icons directory.
T_IMAGES Type: String Images directory.
T_IMAGESET_LANG_NAME Type: String Language imageset directory.
T_IMAGESET_LANG_PATH Type: URL Path to the language imageset directory for the imageset currently in use.
T_IMAGESET_NAME Type: String Parent directory for the imageset currently in use.
T_IMAGESET_PATH Type: URL Path to the imageset directory for the imageset currently in use.
T_IMAGES_PATH Type: URL Path to the board's images directory.
T_RANKS Type: String Ranks directory.
T_RANKS_PATH Type: URL Path to the ranks directory.
T_SMILIES Type: String Smilies directory.
T_SMILIES_PATH Type: URL Path to the smilies directory.
T_STYLESHEET_LINK Type: URL Stylesheet link.
T_STYLESHEET_NAME Type: String Theme currently in use.
T_SUPER_TEMPLATE_NAME Type: String Parent directory for the template from which the current template in use is inheriting from.
T_SUPER_TEMPLATE_PATH Type: URL Path to the template directory from which the current template in use is inheriting from.
T_TEMPLATE_NAME Type: String Parent directory for the template currently in use.
T_TEMPLATE_PATH Type: URL Path to the directory for the template currently in use.
T_THEME_NAME Type: String Parent directory for the theme currently in use.
T_THEME_PATH Type: URL Path to the directory for the theme currently in use.
T_UPLOAD Type: String Attachment storage directory.
T_UPLOAD_PATH Type: URL Path to the attachment storage directory.
UA_POPUP_PM Type: URL Private message notification pop-up window URL with single quotes, double quotes and backslashes escaped.
U_ACP Type: URL View the Administration Control Panel.
U_DELETE_COOKIES Type: URL Delete all board cookies.
U_FAQ Type: URL Frequently Asked Questions.
U_FEED Type: URL View the board's ATOM feed.
U_INDEX Type: URL Board index page.
U_LOGIN_LOGOUT Type: URL Login or Logout.
U_MEMBERLIST Type: URL Member list.
U_MODCP Type: URL Main page of the Moderator Control Panel.
U_POPUP_PM Type: URL Private message notification pop-up window URL.
U_PRIVACY Type: URL Privacy policy.
U_PRIVATEMSGS Type: URL Private message inbox folder.
U_PROFILE Type: URL User Control Panel.
U_REGISTER Type: URL Board registration page.
U_RESTORE_PERMISSIONS Type: URL Restore own permissions after testing another user's.
U_RETURN_INBOX Type: URL Private message inbox folder.
U_SEARCH Type: URL Advanced search.
U_SEARCH_ACTIVE_TOPICS Type: URL Search active topics.
U_SEARCH_NEW Type: URL Search new posts since last visit.
U_SEARCH_SELF Type: URL Search own posts.
U_SEARCH_UNANSWERED Type: URL Search unanswered posts.
U_SEARCH_UNREAD Type: URL Search unread posts.
U_TEAM Type: URL The team page.
U_TERMS_USE Type: URL Terms of use.
U_VIEWONLINE Type: URL Detailed who is online page.
_SID Type: String User's session ID. A value will only be returned if the user does not have cookies enabled on his browser. See {SESSION_ID} if looking for a persistent return.
Александр
 
Сообщения: 207
Зарегистрирован: 20 мар 2014, 17:05

Вернуться в Форум PHPBB (PHP Bulleting Board)

cron