小编Eug*_*enA的帖子

嵌套集,php数组和转换

我需要将我的嵌套集结构(mysql)转换为json用于此spacetree 1)http://blog.thejit.org/wp-content/jit-1.0a/examples/spacetree.html

我发现这个函数可以从嵌套集创建一个数组:2)http://semlabs.co.uk/journal/converting-nested-set-model-data-in-to-multi-dimensional-arrays-in-php

我还可以使用PHP函数json_encode将php数组转换为json

我的问题:函数nestify(来自第二个链接)给了我不完全我需要的东西.我需要这样的东西:http://pastebin.com/m68752352

你能帮助我改变"nestify"功能吗?它能给我正确的数组吗?

这是此功能的一次:

function nestify( $arrs, $depth_key = 'depth' )
    {
        $nested = array();
        $depths = array();

        foreach( $arrs as $key => $arr ) {
            if( $arr[$depth_key] == 0 ) {
                $nested[$key] = $arr;
                $depths[$arr[$depth_key] + 1] = $key;
            }
            else {
                $parent =& $nested;
                for( $i = 1; $i <= ( $arr[$depth_key] ); $i++ ) {
                    $parent =& $parent[$depths[$i]];
                }

                $parent[$key] = $arr;
                $depths[$arr[$depth_key] + 1] = $key;
            }
        } …
Run Code Online (Sandbox Code Playgroud)

php arrays nested-sets

4
推荐指数
1
解决办法
7019
查看次数

获取标记我的用户的观点?

我正在使用视图和标记模块.用户可以标记用户.我可以轻松创建一个我标记的用户列表.但我无法与标记我的用户一起创建视图.

flags views drupal-6

2
推荐指数
1
解决办法
1309
查看次数

如何将一些变量从模块传递到模板文件

我已经使用API​​创建了自定义块,现在我想将我的变量传递给模板(block-block-1.tpl.php).我该怎么做?

谢谢.

drupal

1
推荐指数
1
解决办法
513
查看次数

如何覆盖特定于叠加的div?

我想覆盖一个特定的div,其中div的宽度和高度是可变的.我怎样才能做到这一点?

这是小提琴手供参考.

.c1 {
  border: 1px solid red;
  padding: 10px;
  margin: 5px;
}

.overlay {
    position: relative;
    z-index: 1000;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);;
    opacity: 1;
}
Run Code Online (Sandbox Code Playgroud)
<p>
  content before
</p>
<div class="c1">
  <div class="overlay"></div>
  <div class="c2">
    <h1>
      some content
    </h1>
    <p>
      some content under overlay some content under overlay some content under overlay some content under overlay some content under overlay some content under overlay some content under overlay some content under overlay …
Run Code Online (Sandbox Code Playgroud)

css overlay

0
推荐指数
1
解决办法
2281
查看次数

标签 统计

arrays ×1

css ×1

drupal ×1

drupal-6 ×1

flags ×1

nested-sets ×1

overlay ×1

php ×1

views ×1