
Drupal
文章平均质量分 81
for023
这个作者很懒,什么都没留下…
展开
-
D3结合Drupal8的初次尝试
接口数据D3 Force Layout动力图Javascript数据转换过程目标效果的初始数据结构最终效果接口数据平台接口返回原始的JSON数据,如下:Object = $1changed: {data_type: "list", label: "Changed", description: "The time that the entity was last edited.", list:原创 2017-12-15 15:57:48 · 370 阅读 · 0 评论 -
New hooks for theme suggestions
Change record status: Published (View all published change records)Project: Drupal coreIntroduced in branch: 8.xIntroduced in version: 8.0-ALP转载 2015-06-24 15:44:55 · 538 阅读 · 0 评论 -
Twig for Template Designers -- Annotation
This document describes the syntax and semantics of the template engine and will be most useful as reference to those creating Twig templates.Synopsis¶A template is simply a text file. It ca转载 2015-06-24 15:53:26 · 597 阅读 · 0 评论 -
How do I add classes to main menu ul and li in Drupal 8
1down votefavorite1I want to generate the html elements and their classes to fit my styling of the main menu.I'm confused by all the near-possibilities offered in the api docum转载 2015-06-24 16:07:24 · 1100 阅读 · 0 评论 -
高负载网站之Varnish与Drupal – 基本篇
varnish作为一款优秀的反向代理服务器以及缓存服务器,已经越来越流行,本文就Varnish的基本使用以及如何与drupal合作使用,做一个简要清单。安装推荐使用系统自带的源安装,比如apt或者yum。结构/etc/varnish/ 存放varnish VCL配置文件/etc/sysconfig/varnish 【CentOS】 存放varnish服务器运行的参数转载 2014-07-08 09:35:08 · 659 阅读 · 0 评论 -
Varnish构建高负载Drupal网站 – 高级篇
继上篇高负载网站之Varnish与Drupal – 基本篇后,本篇我们来深入讨论varnish的优化,缓存页面,ESI,Cookie过滤,登录用户的缓存以及与drupal的配合使用等相关话题。首先我们熟悉一下两个VCL的函数regsub(string, pattern, replacement); //正则替换regsuball(string, pattern,转载 2014-07-08 09:35:22 · 584 阅读 · 0 评论 -
Varnish的简单配置与Drupal的集成
varnish是非常不错的反向代理以及缓存服务器,高性能网站中Varnish是必不可少的一个环境。此外,用Varnish也可以自建CDN服务等。关于Varnish的原理以及基础信息,此前有博文参考。高负载网站之Varnish与Drupal – 基本篇Varnish构建高负载Drupal网站 – 高级篇鉴于之前一些朋友咨询drupal+Varnish+Apache如何配置,因转载 2014-07-08 09:37:14 · 564 阅读 · 0 评论 -
查看一个网站是否是Drupal做的?
辨别方法我总结有以下几种:1. 标题中用 | 分隔,比如 “Drupal博客 | 又一个Drupal站点”。2. 从浏览器中的源代码有generater为Drupal。比如Drupal7 http://drupal.org)" />。Drupal系统的CSS经过压缩后一般存放在/sites/default/files/css/,未经压缩的CSS文件一般会存放在模块或者主转载 2014-04-12 17:02:14 · 1224 阅读 · 0 评论 -
Drupal7做一个双语站
本文主要讲解Drupal7做一个双语站:简体中文、英文。方法同样可以应用在Drupal6和Drupal8。lixiphp drupal frontpage Drupal如何做一个双语站步骤1)建立一个Drupal站点的启用Locale 和 Content translation module模块。 2)配置Drupal站点支持多语言,包括三种语言中文简体,中转载 2014-04-12 17:07:10 · 1007 阅读 · 0 评论 -
Drupal 8 - Custom classes for menu links
0down votefavoriteHow can I add custom classes for links into main menu in Drupal 8. This is template for my main menu called menu--main.html.twig{% import _self as menus %}{{ m转载 2015-06-24 16:02:30 · 682 阅读 · 0 评论 -
为Drupal添加使用jquery框架编写的js文件
正确引入js文件的前提下,如果使用jquery的代码的话,需要用(function($) {...})(jQuery);将你的代码包裹起来,就像下面这样子!(function($) { // your jquery code$(document).ready(function() { $(".view-content").owlCarousel({转载 2016-07-11 16:07:54 · 794 阅读 · 0 评论 -
drupal drush exception 'PDOException' with message 'SQLSTATE[HY000] [2002]
解决方案:https://drupal.org/node/1651282sudo mkdir /var/mysqlsudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock转载 2016-08-26 12:10:44 · 1002 阅读 · 0 评论 -
Drupal ajax html和bootstrap dropdown button的事件机制
最近遇到一个特稀奇的一件事情,通过ajax-path获取出来的列表数据,后面自定义的链接跳转按钮无法正常跳转。总结一下,网页加载与jquery的元素绑定机制是这样的,页面(document)加载完成后,页面附带的所有jquery js文件会对页面内容进行筛选绑定各个功能,ajax获取出来的新页面需要重新绑定js事件才能进行响应,否则就会出现前面的错误,链接地址无法正常跳转。下面是修改的代码原创 2017-09-25 16:03:08 · 492 阅读 · 0 评论 -
Drupal::httpClient中post,get参数参考
$httpclient = \Drupal::httpClient()->post($url, [ 'form_params' => $post, 'headers' => [ 'Referer' => $url, 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X原创 2017-09-14 17:11:36 · 666 阅读 · 0 评论 -
PHP用正则匹配form表单中所有元素的类型和属性值
前言最近工作中遇到一个需求,需要在正则匹配页面中,所有可能存在的 form 表单的元素,可能有 input,action,select,textarea等等所有可能的元素,本文给出一个代码示例。感兴趣的朋友们可以参考学习。实例代码如下假设页面 1.html 的网页源代码是:line-height:30px;vertical-align:top;} textarea{resiz转载 2017-09-13 16:49:14 · 1347 阅读 · 0 评论 -
Retrieve Taxonomy Term by a custom field
<?php$_SERVER['REMOTE_ADDR']='localhost';// drupal bootstrap$drupal_directory = "/var/www/drupal";chdir($drupal_directory);define('DRUPAL_ROOT', getcwd());require_once './includes/bootstrap.inc'转载 2017-08-22 16:43:59 · 274 阅读 · 0 评论 -
如何禁止 网页的复制功能
在html.tpl.php 加入了一行document.oncontextmenu=new Function("event.returnValue=false");document.onselectstart=new Function("event.returnValue=false");转载 2017-08-21 17:12:32 · 492 阅读 · 0 评论 -
Drupal 中读取Excel数据再转换格式到另一个Excel
开放原码了,再有同学碰到类似问题,不会像我这样到处去找资料和翻网站,码中有什么不好或者有什么缺点的请看到的同学多多指教,好更好的更新代码。放个costsheet.info先:name = CostSheet Convert Puma description = 读取CostSheet到Puma格式 package = Ewen DIY dependencies[] = phpe转载 2017-08-07 21:59:17 · 358 阅读 · 0 评论 -
清除drupal缓存cache 查看twig主题覆写文件 的方法
清除drupal缓存的方法:最常用的就是在后台操作 The easiest way to clear the Drupal cache is to go todmin/config/development/performanceAdministration > Configuration > Development > Performance-------------还有其他的转载 2017-03-07 21:15:23 · 1612 阅读 · 0 评论 -
解决 drush PDOException: SQLSTATE[HY000] [2002]
今天在Mac OS中安装Drush时遇到一个错误。Drush command terminated abnormally due to an unrecoverable error. [error] Additional uncaught exception thrown while handling exception. Original PDOException: SQLS转载 2017-03-03 16:18:45 · 1597 阅读 · 0 评论 -
Drupal7 SEO优化必备的10个模块
Drupal7 SEO优化最有用、最流行、必备的模块。1. Meta tags,管理整站的节点metadata内容。2. Meta tags quick,管理自定义页面的metadata内容。3. Page Title,允许你设置整站的title标签。4Global Redirect,当简洁链接和Pathauto开启时,修复一些常见的URL问题。Redirect,允许重定向用户从旧网址到新转载 2014-04-12 17:03:38 · 832 阅读 · 0 评论 -
PHP 5.4 on CentOS/RHEL 6.5 and 5.10 via Yum
PHP 5.4.25 has been released on PHP.net on 6th February 2014, and is also available for CentOS/RHEL 5.10 and 6.5 at Webtatic via Yum.Update 2013-07-21 – A new package “php54w-mysqlnd” has been add原创 2014-04-08 22:40:30 · 761 阅读 · 0 评论 -
drupal-8-dev + xmapp MySQL 在Mac 10.9出现(with SQLSTATE[HY000] [2002] No such file or directory)
Drupal按照出现了with SQLSTATE[HY000] [2002] No such file or directory的错误,如下图片:下面是官方给出bug修复1. Open up php.ini (mine was in /private/etc/)2. locate this line: pdo_mysql.default_socket=/原创 2014-04-07 21:52:55 · 723 阅读 · 0 评论 -
从Drupal 6 到 Drupal 7 文件API的改变(变更)
There are three key and pervasive things that happened to the File API between Drupal 6 and Drupal 7:Any API that used to take a traditional filepath like "sites/default/files/something.txt" now m原创 2012-09-07 09:44:21 · 660 阅读 · 0 评论 -
drupal ajax demo
function dynamic_menu() { $items['dynamic'] = array( 'title' => t('Form Example Dynamic Form'), 'page callback' => 'drupal_get_form', 'page arguments' => array('dynamic_form'), 'file原创 2012-09-06 15:38:24 · 642 阅读 · 0 评论 -
将一种文本类型安全的转化为另一种类型
Secure Conversions from One Text Type to AnotherSource Format Target Format Drupal Function What It DoesPlain text HTML原创 2012-09-05 16:28:21 · 361 阅读 · 0 评论 -
Drupal 7 数据库 操作(很好,很犀利)
Drupal 7 使用 PDO 连接数据库,鉴于 PHP 6将把 PDO 做为默认数据库连接方式,这是必须的选择。实际上,Drupal 7之前的数据库抽象层,和 PDO 的某些理念一致,用相同的方法操作不同类型的数据库,减少了模块开发者的工作,也提升了程序的兼容性和可移植性。引入 PDO,相对于之前的版本,数据库接口当然有不小的变化。最显著的,db_fetch_object()、db_转载 2012-09-05 17:25:28 · 503 阅读 · 0 评论 -
drupal count condition addExpression
drupal count 使用语法:$query->addExpression('COUNT(a.tid)', 'rcount5');drupal condition 使用语法: condition('reservation_date', array($start_time, $end_time), 'BETWEEN');转载 2012-09-05 17:56:35 · 514 阅读 · 0 评论 -
一些常用日期处理代码
js 计算两个日期的间隔 兼容firefox和ie1function interval(startDate, endDate){2 var d1 = new Date(startDate.replace(/-/g, "/"));3 var d原创 2012-09-05 17:52:22 · 342 阅读 · 0 评论 -
drupal 7全局变量
drupal 7全局变量是drupal开发过程中很重要的参考api.尽快的了解它们,方便我们在drupal站点开发中恰当的使用这些变量。名称位置描述$active_dbdeveloper/globals.phpActive database connection.$base_pathdeveloper/globals.phpT原创 2012-09-05 17:40:23 · 592 阅读 · 0 评论 -
Drupal 主题、验证、提交函数的调用次序:
对于一个主题函数,假定你使用基于PHPTemplate的名为bluemarine的主题,并且你正在调用drupal_get_form('formexample_nameform')。然而,这还取决于你的hook_theme()实现。首先,如果在表单定义中将$form['#theme']设置为了'foo':1. themes/bluemarine/foo.tpl.php // Templat原创 2012-09-05 17:22:37 · 569 阅读 · 0 评论 -
Drupal 表单各构建元素属性列表
引用地址:http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7Form ControlsLegend:X = attribute can be used with this type- = attribute is not applicable to this type原创 2012-09-07 10:11:09 · 893 阅读 · 0 评论 -
The ideas and design behind Libraries API 2.x
The ideas and design behind Libraries API 2.xWARNING: Not only is this document incomplete, but the APIs it is trying to document are still in flux and subject to change. Rather than concrete API do原创 2012-09-07 18:35:38 · 262 阅读 · 0 评论 -
PHP 5.4 on CentOS/RHEL 6.5 and 5.10 via Yum
PHP 5.4 on CentOS/RHEL 6.5 and 5.10 via YumPHP 5.4.25 has been released on PHP.net on 6th February 2014, and is also available for CentOS/RHEL 5.10 and 6.5 at Webtatic via Yum.Update 2013-07-21转载 2014-03-17 11:48:35 · 693 阅读 · 0 评论 -
商品和商家行业分类
// 商家分类 $catalog = array( '商家行业' => array( '生活服务' => array('旅行社/培训/宠物/齿科/快照、冲印/家政/医院/学校/银行/婚纱摄影/婚庆服务/儿童摄影/汽车服务/停车场/加油站/更多生活服务'), '购物' => array('综合商场/食品茶酒/服饰鞋包/珠宝饰品/化妆品/运动户外/母婴儿童/数码家电原创 2013-08-19 10:10:57 · 8799 阅读 · 0 评论 -
Php发送请求参数丢失问题以及中文乱码问题
curl_setopt($ch,CURLOPT_POSTFIELDS,substr($postBodyString, 0, -1));$reponse =curl_exec($ch);发现请求到达服务端后,postBodyString的内容并没有出现在请求里,参数丢失 解决方法: 使用Header进行以下设置: $headers = array转载 2013-06-08 14:49:45 · 1138 阅读 · 0 评论 -
getCoupons: 测试错误
com.jsp.api.core.client.NoSuchPageException at com.jsp.api.core.client.PageIterator.next(PageIterator.java:167) at com.jsp.api.core.live.CouponTest.getCoupons(CouponTest.java:107) at sun.reflect.Na原创 2013-06-07 17:11:05 · 649 阅读 · 0 评论 -
Drupal Nginx伪静态设置方法
location ~ ^.*/files\/styles\/.*$ { access_log off; expires 45d; error_page 404 @drupal;}location @drupal { if (!-e $request_filename) { rewrite ^/(.*)$ /原创 2013-06-10 20:56:56 · 1480 阅读 · 0 评论 -
PHP获取当前url路径的函数及服务器变量
PHP获取当前url路径的函数及服务器变量:$_SERVER["QUERY_STRING"],$_SERVER["REQUEST_URI"],$_SERVER["SCRIPT_NAME"],$_SERVER["PHP_SELF"]1,$_SERVER["QUERY_STRING"]说明:查询(query)的字符串2,$_SERVER["REQUEST_URI"]说明:访问此页面所需原创 2012-11-24 12:03:50 · 664 阅读 · 0 评论 -
优化Drupal
Drupal的内核架构非常简洁并且非常灵活。然而,这种灵活性是有代价的。当启用的模块增 加时,处理一个请求的复杂度也会增加。这意味着将耗费更多的服务器资源,必须实现一些策略,在一个站点日渐流行同时,来保证Drupal特有的简明。通过 适当的配置,Drupal可以很容易的满足用户的需求。在本章中,我们将讨论性能(performance)和可升级性(scalability)。性能 指的是你的站点响应一转载 2012-10-30 15:16:21 · 1037 阅读 · 0 评论