سؤال

I have been following this guide to successfully create a Joomla custom component: http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Introduction

For simplicity's sake lets say I have two tables, one for authors and one for books.

--AUTHORS-- ID Name

--BOOKS-- ID Name Author_reference

Both have two views each, one list view and one edit view. When I click on a author in the list view it takes me to the list view of the books to see what books the author has written, and only those books filtering out the others.

Here the problem start, when I click on the New button in Joomla I want to add a book to that specific author, but have no way to set that reference. So far I have set that reference with a Session variable when clicking the author but that has obvious flaws such as opening another author in a new tab changing the Session variable.

EDIT: Looks like my question was not very specified. I need a way to send a parameter/variable when clicking the "New" button in admin mode in my component.

هل كانت مفيدة؟

المحلول

You can see a good tutorial for this on another question that I answered: How to add a link category_id added to the admin (JToolBarHelper::addNew)? - Joomla 2.5

Basically, joomla has two functions that you can set in the controller for that view to facilitate adding items to the url even through it's redirects as part of the loading, checking out, and save process.

نصائح أخرى

You can build that with the "foreign key" or "category field" functionality in the Joomla Component Creator. It will save you a lot of headake. Give it a try.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top