Redirecting between components and modules.

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
tovergaard
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Dec 02, 2007 9:54 pm

Redirecting between components and modules.

Post by tovergaard » Sun Dec 02, 2007 10:51 pm

Can anyone help me out on this:

I am completely new to Joomla and have developed an extension whose basic functionality is as follows:

The frontend user must be able to 'save' one or more specific content items and later on be able to download all saved content as one pdf. The content is gonna be static, so instead of generating pdfs on the fly I have chosen to store each content item as a ready made pdf and just collate the requested pdfs when the user clicks a button.

Since some of my problems may well arise from bad structure I will try to explain how I set things up.

The extension consists of a component which handles the backend administration - that is managing the ready made pdfs and linking these to specific content items. The component also holds most of the vital functions: 1) Letting the user save references to content items and  2) Letting the user remove references. 3) Collating several pdfs into one.

With each content item in the frontend I show a link "Save for PDF" which calls a function in my component that stores the id of the content item in a session variable. When done the user must ideally be returned to the content item. This must be a very common task and thus my first question: Is there an easy way to redirect to the referring page? The question boils down to. How to call a function in one component from another component (com_content) and return? Note that the function may be called from several different content items.

The user must also be able to view a list of the saved content items and optionally remove one or more of these before collating as a single pdf. The natural thing to do would be to build this into the same component but since I need to show this list along with a static content item I have instead chosen to build the list as a module. Was there a better way to do this. By each item in the list there is a small 'delete' icon which calls a function in my component. This creates a similar problem: How to call a function in a component from a module and return safely? In this case the module is only shown on a single page so I could choose to simply redirect to a hardcoded url, but I would prefer a prettier way.

I am sure I can hack my way out of this by passing relevant parameters to the component functions and use these to return to the right place, but is this the way to do it, or am I a complete jerk to have overlooked a simple way or possibly having chosen a bad structure?

I would really appreciate any feed back on this. For me the hard part of Joomla-development have been understanding how components and modules play together.

Best regards
Thomas

No problems in the actual coding of the needed functionality

consisting af a component and a module

tovergaard
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Dec 02, 2007 9:54 pm

Add: Applies to Joomla (1.0.x) [No text]

Post by tovergaard » Sun Dec 02, 2007 11:03 pm

No text


Post Reply