在详情页面添加分享按钮
当前theme为bartik
\themes\bartik\templates 下 node.tpl.php
<?php/*** @file* Bartik's theme implementation to display a node.** Available variables:* - $title: the (sanitized) title of the node.* - $content: An array of node items. Use render($content) to print them all,* or print a subset such as render($content['field_example']). Use* hide($content['field_example']) to temporarily suppress the printing of a* given element.* - $user_picture: The node author's picture from user-picture.tpl.php.* - $date: Formatted creation date. Preprocess functions can reformat it by* calling format_date() with the desired parameters on the $created variable.* - $name: Themed username of node author output from theme_username().* - $node_url: Direct URL of the current node.* - $display_submitted: Whether submission information should be displayed.* - $submitted: Submission information created from $name and $date during* template_preprocess_node().* - $classes: String of classes that can be used to style contextually through* CSS. It can be manipulated through the variable $classes_array from* preprocess functions. The default values can be one or more of the* following:* - node: The current template type; for example, "theming hook".* - node-[type]: The current node type. For example, if the node is a* "Blog entry" it would result in "node-blog". Note that the machine* name will often be in a short form of the human readable label.* - node-teaser: Nodes in teaser form.* - node-preview: Nodes in preview mode.* The following are controlled through the node publishing options.* - node-promoted: Nodes promoted to the front page.* - node-sticky: Nodes ordered above other non-sticky nodes in teaser* listings.* - node-unpublished: Unpublished nodes visible only to administrators.* - $title_prefix (array): An array containing additional output populated by* modules, intended to be displayed in front of the main title tag that* appears in the template.* - $title_suffix (array): An array containing additional output populated by* modules, intended to be displayed after the main title tag that appears in* the template.** Other variables:* - $node: Full node object. Contains data that may not be safe.* - $type: Node type; for example, story, page, blog, etc.* - $comment_count: Number of comments attached to the node.* - $uid: User ID of the node author.* - $created: Time the node was published formatted in Unix timestamp.* - $classes_array: Array of html class attribute values. It is flattened* into a string within the variable $classes.* - $zebra: Outputs either "even" or "odd". Useful for zebra striping in* teaser listings.* - $id: Position of the node. Increments each time it's output.** Node status variables:* - $view_mode: View mode; for example, "full", "teaser".* - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser').* - $page: Flag for the full page state.* - $promote: Flag for front page promotion state.* - $sticky: Flags for sticky post setting.* - $status: Flag for published status.* - $comment: State of comment settings for the node.* - $readmore: Flags true if the teaser content of the node cannot hold the* main body content.* - $is_front: Flags true when presented in the front page.* - $logged_in: Flags true when the current user is a logged-in member.* - $is_admin: Flags true when the current user is an administrator.** Field variables: for each field instance attached to the node a corresponding* variable is defined; for example, $node->body becomes $body. When needing to* access a field's raw values, developers/themers are strongly encouraged to* use these variables. Otherwise they will have to explicitly specify the* desired field language; for example, $node->body['en'], thus overriding any* language negotiation rule that was previously applied.** @see template_preprocess()* @see template_preprocess_node()* @see template_process()*/
?>
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>><?php print render($title_prefix); ?><?php if (!$page): ?><h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2><?php endif; ?><?php print render($title_suffix); ?><?php if ($display_submitted): ?><div class="meta submitted"><?php print $user_picture; ?><?php print $submitted; ?></div><?php endif; ?><div class="content clearfix"<?php print $content_attributes; ?>><?php// We hide the comments and links now so that we can render them later.hide($content['comments']);hide($content['links']);print render($content);?><!-- 添加这个判断,是为了防止分享出现在摘要模式上, -->
<?php if ($page): ?>
<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
<a class="bds_tsina"></a>
<a class="bds_qzone"></a>
<a class="bds_tqq"></a>
<a class="bds_renren"></a>
<a class="bds_t163"></a>
<a class="bds_tuita"></a>
<a class="bds_share189"></a>
<a class="bds_tqf"></a>
<a class="bds_tieba"></a>
<span class="bds_more">更多</span>
<a class="shareCount"></a>
</div>
<div class="clearfix"></div> <!--防止后面的内容紧跟分享的按钮 -->
<script type="text/javascript" id="bdshare_js" data="type=tools&uid=0" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->
<?php endif; ?></div><?php// Remove the "Add new comment" link on the teaser page or if the comment// form is being displayed on the same page.if ($teaser || !empty($content['comments']['comment_form'])) {unset($content['links']['comment']['#links']['comment-add']);}// Only display the wrapper div if there are links.$links = render($content['links']);if ($links):?><div class="link-wrapper"><?php print $links; ?></div><?php endif; ?><?php print render($content['comments']); ?></div>
在详情页面添加分享按钮相关推荐
- 微信小程序—页面内分享按钮用图标代替
微信小程序-页面内分享按钮用图标代替 前言 代码 效果图 前言 张小龙不知道出于什么原因将打开客服会话.触发用户转发.打开授权设置页.打开"意见反馈"页面等功能全都挂载到butto ...
- 网站添加“分享按钮”
站长基本上都会给自己网站添加"分享按钮" 1.http://www.bshare.cn/ 和 2.http://www.jiathis.com/ 3.百度分享:(推荐) http: ...
- 仿天猫 购物车(Android studio 仿天猫 详情页面 添加购物车选择 颜色 尺寸demo)
这是我第一次编写博客,有不好的地方请发邮件或留言告知. 注*请勿转载-转载需博主同意 1.首先就是设计页面了–先效果图 2.现在开始看代码,没有啥好说的 这是布局文件 MainActivity 里面的 ...
- 如何在网页添加分享按钮
经常在网页上看到这样的图片分享 这样的划词分享 这样视频分享: 这样书签 这样的侧边分享 更有这样 这样 这样 这样 这样等等分享按钮.可以把想要分享的东西分享给别人.要怎么做到呢?下面听 ...
- 如何在安卓APP中添加分享按钮?
最近想给一个APP添加分享屏幕截图的功能,就尝试找了一圈相关的Package,最后找倒是没找到,倒是在StackOverflow找到了一个解决方法. 布局及相关权限 AndroidManifest.x ...
- html添加分享按钮,分享按钮-jQuery之家-自由分享jQuery、html5、css3的插件库
Overview: To list social accounts or share any page with 46 icons. 点击按钮开始分享: 选中下面红色的文字就会出现分享按钮: Hi! ...
- Ionic创建页面以及页面之间跳转、页面添加返回按钮、新增底部页面
场景 Ionic介绍以及搭建环境.新建和运行项目: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/106308166 在上面搭建起 ...
- 由于业务需求,我是如何在需要页面添加悬浮按钮进行切换并添加水印的
背景:APP页面位置有限,列表形式展示,需要做一个悬浮按钮进行切换列表,并给切换的列表添加水印便于区分. 孙叫兽,前端全栈程序员,java程序员,微信公众号:电商程序员 目录 悬浮按钮的实现: 水印功 ...
- 如何在html中添加分享按钮
效果如图所示: 第一步,搜索"百度产品中心 站长与开发者服务中心 百度分享",进入百度分享页面. 第二步,登录百度分享,点击获取代码. ...
最新文章
- Oracle数据库知识小结
- JVM_03 运行时数据区 [ 方法区]
- pthread 线程退出时自动释放资源
- C#跨平台物联网通讯框架ServerSuperIO(SSIO)
- 与众不同 windows phone (14) - Media(媒体)之音频播放器, 视频播放器, 与 Windows Phone 的音乐和视频中心集成...
- cron表达式 每天0点10分和30分_揭开考研阅卷的内幕,注意这些多得20分!
- 安卓平台OpenGL ES的调用
- 2020年春季计算机网络考试,国家开放大学2020年春季学期电大考试《计算机网络》精选考试题及答案...
- noip模拟赛 czy的后宫
- 《微软:DirectShow开发指南》第三章 Programming DirectShow Applications
- matlab俄罗斯方块说明,俄罗斯方块MATLAB版的代码
- LocalDate获取时间戳
- 【学习笔记】《网络安全态势感知》第三章:网络安全数据采集与融合
- PulseAudio安装流程
- ubuntu安装搜狗拼音输入法
- 北京办理互联网经营许可证(ICP证)的要求
- Mac 命令行关闭和打开蓝牙
- Pygame小游戏:无敌斗牛士
- 42. 通俗易懂大数据实时计算Storm教程
- ISCC 2022 wp