1

I was searching over SO long time, but couldnt find the answer:

I'm creating a Joomla 2.5 module, is a kind of portfolio. I dont know, how many item will be finally in the module, 40 or 200, and it can still grow. Is there any way, to add the module items dynamically in Module Backend, like in component?

  • 1
    You can put whatever you want in your module. A module normally accompanies a component and displays some of its data on pages that you select, in module positions that are outside the component's main position. A module is not meant for complex back-end editing. For that you can use/create a component. – MasterAM Sep 17 '13 at 13:44
  • Thanx for your answer. But the question is, how to manage this without any component. I was thinkin in someting with DB & Jquery. – Prorock Comenta Sep 17 '13 at 14:00
  • Actually, creating a component would be much easier than forcing a wrong functionality onto a module. There are numerous open-source components and you could even use a custom layout of a content's category module. I think you should learn some more about how Joomla works and if you want to create a simple component, you can begin by creating one [here](http://www.component-creator.com/) and customize it yourself (the creation will probably take you just a few minutes). – MasterAM Sep 17 '13 at 14:13
  • I know how to create components, but i still dont know how to achieve this with modules:) – Prorock Comenta Sep 17 '13 at 14:28
  • Take a look at the `Article Category` module. It has all of the functionality that you need. See how it is built and get inspiration. On a side note, you can probably use this module itself to display your portfolio. – MasterAM Sep 17 '13 at 14:35
  • Thanks, but I think, you didnt understand my question. I dont want create component and modules for it. I need to create a module only, doesnt matter if its portfolio or news, or whatever, in which module I could add items just clickin "ADD NEW" inside of the Module backend, which adds a new item inside the module. Imagine a newsticker: newsticker module, where you add news items. By hand. today you have 10 news in module, in one month f.ex. 100. to dont touch the module xml file, would be nice to add every news item in module BE. – Prorock Comenta Sep 17 '13 at 14:55
  • A module does not have its own DB table, but only a config row. You cannot (w/o hacking the hell out of the framework) get what you want with a module alone. – MasterAM Sep 17 '13 at 15:24

2 Answers2

3

While not really supported by the framework, there are ways to do it. You would likely want to create a new new field type for the XML form. This field type could add the necessary javascript to the page to get the add button to work. (Guide on custom field type: http://docs.joomla.org/Creating_a_custom_form_field_type)

As long as you name the input elements as an array (<field name="element_name[]"...) all of the items you add should get wrapped up as part of the params and saved in that row.

You would also have to have the field type that you make able to process that array back when it's getInput function is called.

I think I saw this once with a slideshow module. May have been this one: http://extensions.joomla.org/extensions/photos-a-images/slideshow/image-jquery-slideshow/20362 but I could be wrong on that aspect.

David Fritsch
  • 3,711
  • 2
  • 16
  • 25
  • Just to confirm, Slideshow CK http://extensions.joomla.org/extensions/photos-a-images/slideshow/image-jquery-slideshow/20362 is probably the slideshow you are thinking of David. It has a neat interface where you can add slides individually to the slideshow. – Neil Robertson Sep 19 '13 at 06:44
  • Yeah, I think that is what I'm thinking of. I remember it being a neat interface, but I've not looked into how they do it. – David Fritsch Sep 19 '13 at 16:22
0

Thanx for your answers. Is another idea maybe, with the custom field!Ill check that, thanx. Till now I found (i hope) a solution,without hackin the hell, using jquery and json storing data in a file...it lookes pretty simple.