Php
红石榴
这个作者很懒,什么都没留下…
展开
-
thinkphp OR 的使用
$map = array() ;$map['name'] = '1' ;$map['age'] = '11'; $map['_logic'] = 'or';原创 2014-01-10 15:46:13 · 184 阅读 · 0 评论 -
drupal 评论统计 , 文章浏览量统计 数据库表
node_comment_statistics(评论模块)[2009-06-10 22:02]node_comment_statistics(评论模块)这个表维护了节点和评论发布的统计,用来显示“新”和“已更新”标记名字 类型 空 默认值 描述nid int, unsigned No 0 汇编的统计信息所针对的{node}.nidlast_comment_timestamp int转载 2012-05-09 17:20:39 · 424 阅读 · 0 评论 -
drupal7 增 删 改 查
增$item['mlid'] = db_insert('menu_taxonomy_rel') ->fields(array( 'mlid' => $item['mlid'], 'tid' => $tid_str, )) ->execute();删db_delete('menu_taxonomy_rel')原创 2012-05-09 16:15:23 · 1019 阅读 · 0 评论 -
PHPExcel 导出 'Exception' with message 'Column string index cannot be empty.' in 问题
$objActSheet->setCellValue($char, $value['a_card_money']); // 检查中$char 是否为空,$char 是Excel 的列数,如A1、B5 ··原创 2012-05-09 15:28:20 · 410 阅读 · 0 评论 -
PHPExcel 导入时间格式的转换
PHPExcel 导入时间时,出现了21542这样的数字,而得不到正确的日期格式。这里只要把时间进行转换就可以了。function excelTime($date, $time=false){if(is_numeric($date)){ $jd = GregorianToJD(1, 1, 1970); $gregorian = JDToGregorian($jd+intval原创 2012-05-09 15:23:07 · 309 阅读 · 0 评论 -
ThinkPhp Ajax提交表单。
public dosubmit(){ ThinkAjax.sendForm('form1','__URL__/insert/',addHandle,'result');}原创 2012-05-09 14:54:31 · 198 阅读 · 0 评论 -
PHP 数组和字符串长度计算。
1.数组count($array);2.字符串strlen($str);原创 2012-05-09 14:50:15 · 194 阅读 · 0 评论 -
drupal常用的轮播模块
* Content Glider – Another jQuery plugin for image slider, very easy to use.* Rotor banner -The Rotor Banner module allows you to create blocks with ‘rotating’ content. This can be very useful for a转载 2012-05-10 13:45:32 · 251 阅读 · 0 评论 -
vtiger 编辑默认视图的 header
如图:怎么快速改变默认视图(全部)的表头 ?1、打开数据库表:vtiger_customview ,找到相关模块 viewname 为 “ALL” 的那条数据,2、修改数据为: 其中 All3 为任意名,只要非 "ALL" 就行。 这时候,默认视图就可以变为可编辑状态,我们只需在页面编辑表头即可。原创 2012-05-10 13:43:36 · 229 阅读 · 0 评论 -
vtiger 开发笔记
1、//判断是调用 vtlib_setvalue_from_popup 还是 set_return_specific 方法。文件:outStock.php : var $popup_fields = Array('outstockno'); 注释则是调用 set_return_specific 方法。2、设置 popup.php 文件 “convertmode” 的地方?原创 2012-05-09 17:50:55 · 238 阅读 · 0 评论 -
php 调用websevice (wsdl 文件)
Php 调用webservice 可以通过两种方式 :$wsdl_url = "http://xxxxxxx/xxx?wsdl";1、 使用 php5自带的 soapclient 连接 try { $client = new SoapClient($wsdl_url,array('trace' => true,'encoding'=>'原创 2012-05-09 18:11:38 · 324 阅读 · 0 评论 -
php stdClass Object 读取方法
foreach($array as $value){ echo( $value->string);}原创 2012-05-10 13:39:50 · 301 阅读 · 0 评论 -
ecmall 中,添加一个富文本 和 图片批量上传功能。
一、添加编辑条:1、初始化所见所得 (app function) /* add by tb 2012.02.22 所见即所得编辑器 */ $this->assign('build_editor_tbtest', $this->_build_editor(array( 'name' =原创 2012-05-11 11:01:04 · 213 阅读 · 0 评论 -
drupal 根路径 和 主题路径
drupal 获得根路径方法echo base_path() ; //http://localhost/example/drupal 获得主题方法echo theme_path() ; //http://localhost/example/sites/all/themes/mytheme/原创 2012-05-11 10:45:00 · 236 阅读 · 0 评论 -
drupal7 主菜单 和 二级 菜单
template.php 文件中,写获得二级菜单的方法: function get_second_links(){ //print_r( variable_get('menu_main_links_source', 'main-menu')); // $second_links = menu_navigation_links(variable_get('menu_main_links_原创 2012-05-11 10:42:37 · 497 阅读 · 0 评论 -
drupal 使用全站搜索, 新添加的文章搜索不到!
后台: 配置——Cron——运行Cron 就可以了。原创 2012-05-11 10:41:49 · 274 阅读 · 0 评论 -
drupal 常用的一些方法
node_load($nid);user_load($uid);user_load_by_name($node->name);taxonomy_get_tree($vid);taxonomy_get_parents(tid);taxonomy_term_load(tid); // 所有的内容类型node_type_get_types(); // 权限下所有的内原创 2012-05-11 10:44:49 · 183 阅读 · 0 评论 -
vtiger 模块名.php 文件内容
下面以 product(产品) 模块为例:1、/** Mandatory table for supporting custom fields.*/ var $customFieldTable = Array('vtiger_productcf','productid'); // 'vtiger_productcf':product模块自定义字段表。2、// This原创 2012-05-10 13:44:01 · 226 阅读 · 0 评论 -
drupal7 启用简洁链接
example.com/user 的链接地址替换类似example.com/?q=user 的使用。 1、确保 apache httpd.conf 文件中 mod_rewrite模块 已经开启。把“#”号去掉。# LoadModule rewrite_module modules/mod_rewrite.so TO LoadModule rewrite_module mod原创 2012-05-10 13:42:37 · 224 阅读 · 0 评论 -
drupal 7 js 引用
找到 includes\common.inc 文件中的 drupal_add_js 方法在方法中添加 js /* add js --- */ 'sites/all/themes/neg_cn_themes/js/DD_belatedPNG_0.0.8a-min.js' => array( 'data' => 'sites/all/themes/neg_cn_原创 2012-05-10 13:41:51 · 161 阅读 · 0 评论 -
thinkphp 使用 $this->success("...") 时 怎么跳转 到 新的 链接
$this->assign('jumpUrl',__URL__."/gobackindex"); //重新设置新路径$this->success("成功!");原创 2012-05-10 13:40:38 · 317 阅读 · 0 评论 -
drupal 7 模板文件中,要嵌套另一个模板文件。
在 page.tpl.php 中 要嵌套 a.tpl.php 文件。1、同级文件夹下面:include('a.tpl.php');2、template/block 下面:include('block/b.tpl.php');原创 2012-05-09 17:28:25 · 147 阅读 · 0 评论 -
drupal 7 node 部分 匹配方法
通过 devel 工具,找到具体node 值,到主题里面根据 node 值命名,如node--12 注意,在代码中推荐的名称为 node__12 (下划线),我们应该改为 node--12. 创建了新 node 模板后,清楚缓存。原创 2012-05-09 17:18:24 · 93 阅读 · 0 评论 -
drupal 内容分页模块。
drupal 6 可以用 paging 模块下载地址: http://drupal.org/project/paging到drupal 7 就已经改为 Smart Paging 模块了下载地址: http://drupal.org/project/smart_paging原创 2012-05-10 13:44:33 · 336 阅读 · 0 评论 -
thinkphp下ckeditor+ckfinder的图片上传配置 【转】
开源网页编辑软件FCKEditor在09年发布更新到3.0,并改名为CKEditor。改进后的ckeditor更加模块话,配置更加灵活,和以前的fckeditor使用方式上也有所不同。在我的mvc项目中由于要用到 ckeditor,特意研究了下它的使用方法,写下来和大家分享。最新发布的CKFinder 1.4版 已经提供了对CKEditor3.0的支持CKFinder 1.4 下载地址:htt转载 2012-05-10 13:41:21 · 253 阅读 · 0 评论 -
Yii 开发笔记
1、必填项的翻译。2、文本翻译链接:r=user/translation/admin 3、服务器数据库密码:4、导入其他model、类 : Yii::import('application.modules.friendship.models.YumFriendship');5、获得当前用户Id : $id = Yii::app()->user->id;6、菜单权限设置 $原创 2012-05-09 17:51:44 · 93 阅读 · 0 评论 -
drupal 自定义模块权限设置
$items['admin/module_name/search/%'] = array( 'title' => 'Search', 'page callback' => 'function_1', 'page arguments' => array(1,2,3,4), 'weight' => 1, 'file' => 'users_center.pages原创 2012-05-09 17:40:34 · 164 阅读 · 0 评论 -
drupal 添加自动填充功能 user/autocomplete
如图:添加代码:$form['reporter'] = array( '#type' => 'fieldset', '#access' => user_access('administer nodes'), '#title' => t('记者 信息'), '#collapsible' => TRUE, '#collapsed' => TRUE,原创 2012-05-09 17:34:37 · 167 阅读 · 0 评论 -
drupal 7 page--front.tpl.php 使用
1、复制一份 page.tpl.php 将其命名为 page--front.tpl.php 。2、清楚缓存。3、关掉浏览器,重新打开网站。原创 2012-05-09 17:27:42 · 325 阅读 · 0 评论 -
PHPExcel 导出设置背景颜色
1.首先设置某一个列的样式(字体、背景色、边框样式···)。2.获得设置列的样式,假设设置的是 A4 列。$objStyleA5 = $objActSheet->getStyle('A4'); 3.设置从某个单元个到某个单元格引用 A4 列的样式。$objActSheet->duplicateStyle($objStyleA5, 'A1:G9'); //设置原创 2012-05-09 15:25:47 · 639 阅读 · 0 评论 -
ThinkPhp <if condition="" 标签使用时注意问题
使用ThinkPhp 标签时,condition里面访问变量,不能用点的形式,应该用['']的形式访问。 // . 是错误的。 // [''] 是正确的。原创 2012-05-09 15:16:35 · 416 阅读 · 0 评论 -
PHP 分割数组 array_chunk()
$arr = array(8) {[0] => string(1) "M"[1] => string(1) "N"[2] => string(1) "O"[3] => string(1) "P"[4] => string(1) "Q"[5] => string(1) "R"[6] => string(1) "S"[7] => string(1) "T"}把数组$arr原创 2012-05-09 15:14:11 · 132 阅读 · 0 评论 -
PHP 数字与字符与ASICC码之间的转换。
1.数字转字符ASICC码。$a = 79;$b = chr($a);$b = 'O'; //结果为字符'O';2.字符转数字ASICC码。$a = 'O';$b = ord($a);$b = 79; //结果为数字 79;原创 2012-05-09 15:12:15 · 192 阅读 · 0 评论 -
vtiger 模块间建立联系
1、新建文件:2、文件内容:include_once('vtlib/Vtiger/Module.php');//模块关联$moduleInstance = Vtiger_Module::getInstance('Products');$accountsModule = Vtiger_Module::getInstance('Vendors');$moduleInstance->s原创 2012-05-10 13:43:47 · 288 阅读 · 0 评论 -
drupal 7 主题路径
global $theme; $theme_path = drupal_get_path('theme', $theme);echo $theme_path ;---------------------- sites/all/themes/mytheme global $theme_path;echo $theme_path;----------------------原创 2012-05-10 13:44:22 · 194 阅读 · 0 评论 -
Ecmall findAll 使用
$orders = $model_order->findAll(array( 'conditions' => "buyer_id=" . $this->visitor->get('user_id') . "{$conditions}", 'fields' => 'this.*', 'count'原创 2012-05-10 13:44:46 · 261 阅读 · 0 评论 -
drupal 在 add content 页面,添加自己的链接。
打开 node 模块下面的 node.page.inc 文件,找到其中:node_add_page 方法,此防范就是加载 内容类型,并输出到添加内容页面。在 node_add_page 方法中 function node_add_page() { $item = menu_get_item(); $content = system_admin_menu_block($i原创 2012-05-09 17:29:50 · 209 阅读 · 0 评论 -
thinkphp 验证码无法显示
如果无法显示验证码,请检查: 1、PHP是否已经安装GD库支持; 在 php.ini 中去掉extension=php_gd2.dll前的注释。 重启web服务器后phpinfo函数能看到gd库的相关信息。 (pnp.ini 的位置是:/etc/php5/apache2) 2、输出之前是否有任何的输出(尤其是UTF8的BOM头信息输出);原创 2012-05-09 17:00:28 · 77 阅读 · 0 评论 -
php 生成数字 [0-9] 的所有 的 5 位数 排列组合
$num = '00000'; $arr [] = $num; while(strlen($num)==5 & $num<99999){ $num=$num+1; if(strlen($num)<5){ $len = strlen($num); $str = ''; for($i=0;$i<5-$len;$i++){ $str .= "0";原创 2012-05-09 16:59:37 · 1899 阅读 · 0 评论 -
drupal 7 在内容列表 添加 按 分类 (术语 )进行 查找、过滤
1。 先在过滤器中添加一个分类下拉框。并且输出分类的内容。(如下图)打开 drupal7\modules\node\node.admin.inc 文件,找到 node_filters() 方法,在表单中添加这么一段代码:$filters['type'] = array( 'title' => t('type'), 'options' => array(原创 2012-05-09 16:36:06 · 201 阅读 · 0 评论