Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorsuthern
    • CommentTimeDec 13th 2007 edited
     

    I'm not sure how else to describe it, but here's what I'm trying to do:
    When editing a part, list a small table of the related entries from the "conditions" table, with buttons that pop up a new window to Edit or Delete each condition. (I'll work on the js new window part later)

    Here's what I've done so far:
    - copied and renamed the 'listing.tpl' in "app/view/condition/" to _listing.tpl (so it'll be recognized as a partial, like the _form.tpl)
    - edited _listing.tpl, removing a bunch of stuff BEFORE {?conditions} and removing the ending div tag.
    - Added "var $models = 'condition, part, parts_vendors, vendor'; " inside the part_controller.php.
    - Inside the function edit, inside the part_controller, I added $this->conditions = $this->Condition->find('all',array( 'conditions' => 'conditions.part_id = '.@$this->params['id'], 'order' => 'created_at DESC'));"
    (to create the source for the _listing.tpl)
    - Inside the "views\part_form.tpl" I added &lt;p> <label>_{Part Conditions}</label><br /> <?php echo $controller->renderPartial('../condition/listing')?> </p>

    This almost works, except for an error that I'm trying to trace down. The edit page loads great all the way till it gets to '$condition_helper', and then it throws an error like such Notice: Undefined variable: condition_helper in /home/sambaserve/web/apps/inventory/app/views/condition/compiled/_listing.tpl.php on line 44 Which causes it to fail on the remainder of that line as well.

    Perhaps I'm doing this all wrong. I hope that in working this out by hand I can get a feel for how Akelos is setup. Can someone point me in the direction so I can get the $condition_helper 's working when called from a part edit view? Or perhaps a differn't way to do it? I'd love to see some tutorials on this exact subject. Hmm.. shouldn't there be something like this is a regular blog setup? hmm..

    • CommentAuthorsuthern
    • CommentTimeDec 14th 2007 edited
     

    And it's solved! For anyone else who needs to move helpers to a global scale, try the following in your application_helper.php file. class ApplicationController extends AkActionController { var $app_helpers = 'my_global'; } Where 'my_global' is the name of your controller.

    I used this to make my application work: class ApplicationController extends AkActionController { var $app_helpers = 'condition'; }

    And I had to modify show, edit, and destroy functions in condition_helper.php to look somewhat like this: return $this->_controller->url_helper->link_to($this->_controller->t('Edit'), array('controller' => 'condition', 'action' => 'edit', 'id' => $record->getId()));

Add your comments
    Username Password
  • Format comments as