Adding 'default text' to Joomla's extension 'Simple Email Form'
I just want to add some 'default text' to the fields... My efforts to edit the PHP have not worked at all !!
I'm guessing that the file to edit is th开发者_如何转开发e ' mod_simpleemailform.php ' I cant seem to find the "echo's" that spit out the form...
Am i on the right track...?
Thanks!!
Based on my research this is not a module that comes installed with Joomla! I will answer your question when it comes to properly formated modules.
To find your form go into the folder for your module. In your case it should be /modules/mod_simpleemailform
.
This is where the "System" for your module resides. You will find files such as:
mod_simpleemailform.xml
This is a configuration file for the module.
index.html
This prevents the listing of your module's folder contents.
helper.php
This is where your module's functions and brains are located.
mod_simpleemailform.php
This calls functions in your helper.php
in order to get content and information. Once it has all of its data it will call a template file for the module located in /tmpl
of your module's directory.
In here you will find:
index.html
It does the same thing as the previous index.html
default.php
This is your default template file for your module. This file will contain your form and HTML code that you see on screen.
The default.php
is the file that you likely want to use. It is possible that your form is in an other file located in the /tmpl
folder so you may have to pick around a little bit.
Usually your fields are not in an echo
they are just place on the outside of php tags. You will likely want to add a value
attribute and then add some text to it like so <input type="text" name="myField" value="My Default Text" />
.
Even better still you could add parameters to the XML file so then you may echo a default text you entered in the back-end of Joomla!.
Just follow on Jonathan's answer, yes, you can find the brain of the module inside of helper.php
and all that you need to achieve your goal: "add some 'default text' to the fields".
Inside the constructor function, you can find the following sentence, that save in $l
the name of the current field (because it's inside a loop):
$l = trim($params->get($labelLabel));
you can just add a string with your desired default text (i.e. inside a variable: $myDefaultText):
$l = $myDefaultText . trim($params->get($labelLabel));
精彩评论