Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6648731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:41:23+00:00 2026-05-26T00:41:23+00:00

This is in fact mainly a Zend question than a jQuery. I’m trying to

  • 0

This is in fact mainly a Zend question than a jQuery.

I’m trying to implement jQuery nested Sortable http://mjsarfatti.com/sandbox/nestedSortable/ with Zend, saving and reading out the exact position of the sortable elements (including their parents). I have now the following code in my partialLoop file which is the main part of my work. It calls itself (recursively) in another partialLoop() method if there are children of an element and looks like the following, which is the partials/_docs-edit-row.phtml itself:

<?php
// not really nice to call a db model in a view file, but is there an other way... ?
$docSectionModel = new Model_DocSection();
global $workedthrough, $i;

$childs = $docSectionModel->fetchChildSections($this->id);
if($childs)
    $childs = $childs->toArray();
?>

<?php if(empty($workedthrough) || !in_array($this->id, $workedthrough)) : ?>
<?php $workedthrough[] = $this->id; ?>
<li>
    <div class="handle">
        <input type="hidden" class="section_id" name="section_id[<?php echo $i; ?>]" value="<?php echo $this->id; ?>" />
        <input type="hidden" class="section_parent_id" name="section_parent_id[<?php echo $i; ?>]" value="<?php echo $this->parent_id; ?>" />
        <input type="text" name="section_title[<?php echo $i; ?>]" value="<?php echo $this->title; ?>" />
        <a href="#" class="open"></a>
    </div>
    <div class="inner-edit closed">
        <textarea name="section_content[<?php echo $i; ?>]"><?php echo $this->content; ?></textarea>
        <input type="submit" name="doc_save" value="Save" />
        <input type="submit" name="remove_doc_section[<?php echo $i; ?>]" value="Remove this section" />
    </div>

    <?php if($childs) : ?>
        <ol>
            <?php echo $this->partialLoop('partials/_docs-edit-row.phtml', $childs); ?>
        </ol>
    <?php endif; ?>

</li>
<?php endif; ?>
<?php $i++; ?>

What I was trying to do here was to create with $i a counter which goes through both loops to get a continous counter because $this->partialCounter would start from the beginning in each new level. So in fact this is my main problem (I defined the $i in the main view file as well as $workthrough which is to look if the item has been gone over to avoid multiple calls of items which are not in the first level of the loop) that $i doesn’t seem to count properly for any reason while $workthrough works like a charm.
Now, is it possible to have a continous counter in all the partialLoops? Also I really would like to know if maybe someone got a better approach to do what I want to do.

If something looks strange or is unclear I will explain it of course. I appreciate any help!

Best Regards, .wired

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:41:24+00:00Added an answer on May 26, 2026 at 12:41 am

    A few bits of information which may help you:

    • Using nested partials works but since partials clone the view, it can quickly become a performance problem and should better be avoided

    • You can pass your rowset to the partial as an object which would enable you to call dependent rowsets $view->partialLoop()->setObjectKey('model')

    • In your case it’s probably better to loop yourself and use render() instead of partials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to preface this with the fact that I love jQuery as a
First off, please accept my apologies if this question is basic, I mainly have
I have a table with arbitrary columns and rows. This fact is irrelevant though
The associativity of stream insertion operator is rtl, forgetting this fact sometimes cause to
I always found this rather annoying fact about applets, that they disappear if you
Alright, I'll preface this with the fact that I'm a GTK and Python newb,
My fact table looks like this yesterday a yesterday a yesterday a yesterday b
This snippet throws an NullPointerException due to the fact that its unboxed to a
this one is not homework, it just the fact that i've been out of
This afternoon, upon noticing a broken build and the fact that some files looked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.