l

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/common.inc, строка 1394

Версии
5
l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)
6
l($text, $path, $options = array())

Оформляет ссылки. Эта функция корректно работает с синонимами путей, а также позволяет темам корректно подсвечивать ссылки на текущую страницу, поэтому все ссылки, по возможности, должны генерироваться этой функцией.

Параметры

$text Текст ссылки.

$path Путь, на который ссылаемся (например, 'admin/content/node'). Конечная ссылка генерируется с помощью url(), поэтому путь может быть как внутренней ссылкой, так и внешним URL-ом:

  • Если подается полный URL, будет создана внешняя ссылка.
  • Если подается только путь (т.е. 'admin/content/node'), создается внутренняя ссылка (без 'http://'). Подаваемый путь может быть как внутренним путем Друпала (т.е. 'node/123'), так и синонимом.

$attributes Ассоциативный массив HTML атрибутов тега ссылки. К примеру, для открытия ссылки в новом окне можно использовать: $options=array('attributes'=>array('target'=>'_blank'));

$query GET парметры ссылки строкой (без '?').

$fragment Якорный фрагмент ссылки (то, что идет после '#').

$absolute Принудительное создание внешней ссылки (начинается с 'http://') (полезно, если вы создаете ссылку, которая будет показываться вне сайта (например, в RSS ленте)).

$html Присутствует ли HTML в тексте ссылки. Например, если вы хотите вставить в ссылку рисунок, эту опцию следует установить в TRUE, иначе HTML в тексте отфильтруется (см. check_plain()).

Возвращаемое значение

HTML код ссылки.

Связанные темы

▾ 105 функции вызывают l()

aggregator_block in modules/aggregator/aggregator.module
Реализация hook_block().
aggregator_form_category_submit in modules/aggregator/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
aggregator_form_feed_submit in modules/aggregator/aggregator.module
Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.
aggregator_view in modules/aggregator/aggregator.module
block_admin_display in modules/block/block.module
Generate main block administration form.
blogapi_blogger_edit_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Модифицирует указанную ноду блога.
blogapi_blogger_new_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Вставляет новую запись блога как ноду.
blog_block in modules/blog/blog.module
Реализация hook_block().
blog_form in modules/blog/blog.module
Реализация hook_form().
blog_page_user in modules/blog/blog.module
Показывает страницу Друпал с последними записями в блоге данного пользователя.
blog_user in modules/blog/blog.module
Реализация hook_user().
book_admin_edit_submit in modules/book/book.module
book_admin_overview in modules/book/book.module
Возвращает административный краткий обзор всех книг.
book_render in modules/book/book.module
Menu callback; prints a listing of all books.
book_tree_recurse in modules/book/book.module
This is a helper function for book_tree()
chameleon_comment in themes/chameleon/chameleon.theme
chameleon_node in themes/chameleon/chameleon.theme
chameleon_page in themes/chameleon/chameleon.theme
comment_admin_overview in modules/comment/comment.module
Конструктор формы; генерирует форму с кратким содержанием комментариев для администратора.
comment_admin_overview_submit in modules/comment/comment.module
Execute the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.
comment_save in modules/comment/comment.module
Сохраняет новый или измененный комментарий.
confirm_form in modules/system/system.module
Вывод формы подтверждения какого-либо действия.
contact_admin_categories in modules/contact/contact.module
Categories/list tab.
contact_admin_edit_submit in modules/contact/contact.module
Process the contact category edit page form submission.
db_status_report in includes/database.mysql.inc
Возвращает отчёт о состоянии базы данных.
fileupload_view in developer/examples/fileupload.module
Implementation of hook_view.
filter_admin_format_form in modules/filter/filter.module
Generate a filter format form.
filter_admin_overview in modules/filter/filter.module
Displays a list of all input formats and which one is the default
forum_block in modules/forum/forum.module
Реализация hook_block().
forum_overview in modules/forum/forum.module
Returns an overview list of existing forums and containers
help_links_as_list in modules/help/help.module
hook_requirements in developer/hooks/install.php
Check installation requirements that need to be satisfied.
menu_edit_item_form in modules/menu/menu.module
Present the menu item editing form.
menu_edit_item_save in modules/menu/menu.module
Save changes to a menu item into the database.
menu_get_active_breadcrumb in includes/menu.inc
Получает хлебные крошки для текущей страницы, определенные активным путем.
menu_overview_tree in modules/menu/menu.module
Present the menu tree, rendered along with links to edit menu items.
menu_overview_tree_rows in modules/menu/menu.module
node_add in modules/node/node.module
Present a node submission form or a set of links to such forms.
node_admin_nodes in modules/node/node.module
node_feed in modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
node_form_submit in modules/node/node.module
node_overview_types in modules/node/content_types.inc
Displays the content type admin overview page.
node_preview in modules/node/node.module
Generate a node preview.
node_revision_overview in modules/node/node.module
Generate an overview table of older revisions of a node.
node_title_list in modules/node/node.module
Gather a listing of links to nodes.
node_type_form_submit in modules/node/content_types.inc
Implementation of hook_form_submit().
path_overview in modules/path/path.module
Return a listing of all defined URL aliases.
phptemplate_comment in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_comment function to be passed into a pluggable template engine.
poll_page in modules/poll/poll.module
profile_admin_overview in modules/profile/profile.module
Menu callback; display a listing of all editable profile fields.
profile_block in modules/profile/profile.module
Реализация hook_block().
profile_field_delete_submit in modules/profile/profile.module
Process a field delete form submission.
profile_field_form_submit in modules/profile/profile.module
Process profile_field_form submissions.
profile_view_field in modules/profile/profile.module
search_view in modules/search/search.module
Menu callback; presents the search form and/or search results.
statistics_access_log in modules/statistics/statistics.module
statistics_node_tracker in modules/statistics/statistics.module
statistics_recent_hits in modules/statistics/statistics.module
Menu callback; presents the 'recent hits' page.
statistics_top_visitors in modules/statistics/statistics.module
Menu callback; presents the 'top visitors' page.
statistics_user_tracker in modules/statistics/statistics.module
system_admin_by_module in modules/system/system.module
Menu callback; prints a listing of admin tasks for each installed module.
system_get_module_admin_tasks in modules/system/system.module
system_requirements in modules/system/system.install
Test and report Drupal installation requirements.
system_themes in modules/system/system.module
Menu callback; displays a listing of all themes.
tablesort_header in includes/tablesort.inc
Format a column header.
taxonomy_form_term in modules/taxonomy/taxonomy.module
taxonomy_form_term_submit in modules/taxonomy/taxonomy.module
Accept the form submission for a taxonomy term and save the result.
taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.module
Accept the form submission for a vocabulary and save the results.
taxonomy_overview_terms in modules/taxonomy/taxonomy.module
Display a tree of all the terms in a vocabulary, with options to edit each one.
taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.module
List and manage vocabularies.
theme_admin_block_content in modules/system/system.module
Функция форматирует контент административного блока.
theme_admin_page in modules/system/system.module
Форматирует административную страницу для отображения.
theme_aggregator_block_item in modules/aggregator/aggregator.module
Format an individual feed item for display in the block.
theme_aggregator_feed in modules/aggregator/aggregator.module
Format a news feed.
theme_aggregator_page_item in modules/aggregator/aggregator.module
Format an individual feed item for display on the aggregator page.
theme_book_admin_table in modules/book/book.module
theme_book_navigation in modules/book/book.module
Prepares the links to children (TOC) and forward/backward navigation for a node presented as a book page.
theme_comment in modules/comment/comment.module
theme_comment_block in modules/comment/comment.module
Returns a formatted list of recent comments to be displayed in the comment block.
theme_comment_folded in modules/comment/comment.module
theme_filter_tips_more_info in modules/filter/filter.module
theme_forum_display in modules/forum/forum.module
Format the forum body.
theme_forum_list in modules/forum/forum.module
Format the forum listing.
theme_forum_topic_list in modules/forum/forum.module
Format the topic listing.
theme_forum_topic_navigation in modules/forum/forum.module
Format the next/previous forum topic navigation links.
theme_links in includes/theme.inc
Возвращает темизированный набор ссылок.
theme_locale_admin_manage_screen in includes/locale.inc
Theme the locale admin manager form.
theme_menu_item_link in includes/menu.inc
Генерирует HTML, представляющий заданный ID пункта меню.
theme_menu_links in includes/menu.inc
Returns the themed HTML for primary and secondary links. Note that this function is overridden by most core themes because those themes display links in 'link | link' format, not from a list. Also note that by default links rendered with...
theme_pager_link in includes/pager.inc
Форматирует ссылку на определенную запрошенную страницу.
theme_upload_attachments in modules/upload/upload.module
Отображение прикрепленных файлов в виде таблицы.
theme_username in includes/theme.inc
Форматирует имя пользователя.
theme_user_admin_new_role in modules/user/user.module
theme_user_picture in modules/user/user.module
tracker_page in modules/tracker/tracker.module
Menu callback. Prints a listing of active nodes on the site.
user_admin_access in modules/user/user.module
Menu callback: list all access rules
user_admin_account in modules/user/user.module
user_authenticate in modules/user/user.module
user_auth_help_links in modules/user/user.module
user_login_block in modules/user/user.module
user_register_submit in modules/user/user.module
watchdog_event in modules/watchdog/watchdog.module
Menu callback; displays details about a log message.
watchdog_overview in modules/watchdog/watchdog.module
Menu callback; displays a listing of log messages.
_locale_string_seek in includes/locale.inc
Perform a string search and display results in a table
_statistics_link in modules/statistics/statistics.module
It is possible to adjust the width of columns generated by the statistics module.

Код

<?php
function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
  if (($path == $_GET['q']) || ($path == '<front>' && drupal_is_front_page())) {
    if (isset($attributes['class'])) {
      $attributes['class'] .= ' active';
    }
    else {
      $attributes['class'] = 'active';
    }
  }
  return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему