PHP Joomla 1.5 Module Creation with system-message

Posted on 2008-10-23
Last Modified: 2012-05-05
Gday Experts,

I have created a simple contact module, when the user submits the form, it either says 'mail sent' or 'failed', I wish to display this information in system message/jdoc object <jdoc:include type="message" />

What code would I use to add messages to this area?

-- Zemond
Question by:zemond
  • 2
  • 2

Expert Comment

ID: 22830149
in a component you just set the message as the second option in the redirect

$this->setRedirect('?option=com_invoice', 'test');

test being the message..


Author Comment

ID: 22837258
Gday gxp071,

Thanks for the reply, can it be done without performing a redirect?


Accepted Solution

gxp071 earned 500 total points
ID: 22839503
I'm not sure,

ive tracked the function back and its part of the jController class,  it also has a setMessage() method but it just sets it internally and passes it into a redirect.  the setRedirect method calls the _gobal $mainframe->redirect() which is a JApplication instance.

internally redirect() stacks the message using the enqueueMessage() function.  So in theory if you want to add a message to the stack you could try

_gobal $mainframe;
$mainframe->enqueueMessage('Your Message');

But I've never tried it so no idea if it will do what you want.  Sorry I cant be anymore help,  Ive limited experience of creating modules, and I've never try to do this.  Creating components i've always just used a redirect.

Hope this helps though, good luck

PS. have you tired posting on the developer section of the joomla forum?

Author Closing Comment

ID: 31509172
Much appreciated, thank you for donating your time.

-- Zemond

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php extract($_REQUEST) 5 54
Unwanted Popup 8 29
error while installing php56 in redhat enterprise linux 20 24
What does this formatting equate to? 7 12
In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question