We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Do recrusive partial volt not working

Hi guys, could someone help me please. I do recrusive partial both with volt and php and working well in my local machine, the problem is it not working in my production server. My local and production servers run a same engine (Apache) but diferent php version (mine: 7.0) and (server: 5.6). Is the php version is make sense? i spent 2 days looking for into this problem, and i cant downgrade my php version (.cphalcon extension is not match with php5.6 version). Any advice or clue? or am i miss something behind :( :(

Thanks before,

Martin ✌️

Controller [Customers.php]:

public function treeAction($parent=null, $current=null)
{
  $this->assets->collection('cssHeader')
       ->addCss('bower_components/animate.css/animate.min.css')
       ->join(true);

 $this->assets->collection('jsFooter')
     ->addJs('js/pages/crm_corporate/app.js')
     ->join(true);

  $this->view->active_menu         = 'customercorporate';
  $this->view->active_title        = 'Corporate Tree View';
  // $this->view->trees               = Customer::findByParentId($parent);
  $this->view->trees               = Customer::findFirstById($parent);
  // $this->view->customer            = Customer::findFirstById($current);
  $this->view->current             = $current;
}

Views [Tree.volt]

<div class="hv-container">
  <div class="hv-wrapper">
      <div class="hv-item">
          <div class="hv-item-parent">
              <p class="simple-card
                {{ current == trees.id ? 'is-current animated pulse infinite' : '' }}"
                data-request="onViewCustomer"
                data-parameter="{{ trees.id }}">
                {{ trees.firstname|upper ~ ' ' ~ trees.lastname|upper }}
              </p>
          </div>

          {% if trees.has|length %}
              {% for key, tree in trees.has %}
                  {{ partial('partials/customers/tree-list-child', ['trees':trees, 'key': key]) }}
              {% endfor %}
          {% endif %}
      </div>
  </div>
</div>

Views [partials/customers/tree-list-child.volt]

<div class="hv-item-children">
  {% set max = trees.has|length %}
  {% if trees.has|length %}
    {% for tree in trees.has %}
      {{ partial('partials/customers/tree-list-item2', ['trees': trees, 'key': key, 'max': max]) }}
    {% endfor %}
  {% endif %}
</div>

Views [partials/customers/tree-list-item2.volt]

<div class="hv-item-child {{ tree.has|length == 1 and trees.has|length == 1 ? 'child-nomore' : '' }}">
    {% if tree.has|length %}
        <div class="hv-item">
            <div class="hv-item-parent">
                <p class="simple-card
                  {{ current == tree.id ? 'is-current animated pulse infinite' : '' }}"
                  data-request="onViewCustomer"
                  data-parameter="{{ tree.id }}">
                  {{ tree.firstname|upper ~' '~ tree.lastname|upper }}
                </p>
            </div>

            {{ partial('partials/customers/tree-list-child', ['trees': tree, 'key': key]) }}
        </div>
    {% else %}
        <p class="simple-card {{ current == tree.id ? 'is-current animated pulse infinite' : '' }}"
          data-request="onViewCustomer"
          data-parameter="{{ tree.id }}">
          {{ tree.firstname|upper ~' '~ tree.lastname|upper }}
        </p>
    {% endif %}
</div>

My Local Output :

My Server Output :

The variable wont pass into partial file with recrusive looping into partials/customers/tree-list-item2.volt, partials/customers/tree-list-child.volt

Hi @Muahammad what didn't work in your production server? differents PHP versions "don't matter" but Phalcon version are equals?

edited Aug '17

Hi @Muahammad what didn't work in your production server? differents PHP versions "don't matter" but Phalcon version are equals?

Hi @emiliodeg here is the phalcon -v result and update the output what i expect:

Server :

Phalcon DevTools (3.1.0)

Environment::
  OS: Linux productiontesting 3.13.0-86-generic #130-Ubuntu SMP Mon Apr 18 18:27:15 UTC 2016 x86_64
  PHP Version: 5.5.9-1ubuntu4.21
  PHP SAPI: cli
  PHP Bin: /usr/bin/php5
  PHP Extension Dir: /usr/lib/php5/20121212
  PHP Bin Dir: /usr/bin
  Loaded PHP config: /etc/php5/cli/php.ini
Versions::
  Phalcon DevTools Version: 3.1.0
  Phalcon Version: 3.1.1
  AdminLTE Version: 2.3.6

Local:

Phalcon DevTools (3.2.0 ALPHA 1)

Environment:
  OS: Darwin zeus 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
  PHP Version: 7.0.20
  PHP SAPI: cli
  PHP Bin: /usr/local/Cellar/php70/7.0.20_12/bin/php
  PHP Extension Dir: /usr/local/Cellar/php70/7.0.20_12/lib/php/extensions/no-debug-non-zts-20151012
  PHP Bin Dir: /usr/local/Cellar/php70/7.0.20_12/bin
  Loaded PHP config: /usr/local/etc/php/7.0/php.ini
Versions:
  Phalcon DevTools Version: 3.2.0 ALPHA 1
  Phalcon Version: 3.1.2
  AdminLTE Version: 2.3.6

Thank you

@Muhammad-ihsan I think the problems is with your data and your css and not with your php/phalcon.

Can you check the result on local with server data?

edited Aug '17

@Muhammad-ihsan I think the problems is with your data and your css and not with your php/phalcon.

Can you check the result on local with server data?

Hi @emiliodeg, its still working well with server data

i cant look in too deep with this problem, i new with phalcon :(