Adding 'default text' to Joomla's extension 'Simple Email Form' - joomla

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 the ' 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.phpand 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));

Related

View and download files uploaded via a form in Kentico

In Kentico, how can make it possible for site users to see and download files uploaded by other users through a form?
I make a form in Kentico CMS. Users can fill and submit it properly. My form has an upload file field.
I made a new page to show the content of the submitted forms. For this, I use a "Query Repeater with effect".
It seems the Query works well. I write a Transformation to show each record in a table format.
All records and fields appear well except the file field. I can not find a way to generate a link of uploaded files to assign it to the href attribute of a link tag. I use code like this
Download File"
The problem with this code is the <%# Eval("UploadFile1") %> returns a string like this
94e5b02d-1bcd-4341-9930-6e5ef1029d8b.pdf/MyFileName.pdf
How can I solve this problem?
When using the /CMSPages/GetBizFormFile.aspx you need to supply the file name and site name as the query string parameters. The file name is actually the GUID of the file + the extension. So, the link should look like this:
~/CMSPages/GetBizFormFile.aspx?filename=3560f3ed-6a12-444e-9fc6-2447fc903a23.jpg&sitename=SiteName
The thing here is that the GetBizFormFile is checking the access - user must be logged in, editor and must have permissions for forms module assigned.
If you want to create a public accessible link, you will need to compose the link directly to the disk location of the file (assuming that the folder on disk is not secured). The default location is ~//BizFormFiles. You can customize the location in Settings -> System -> Files -> Custom form files folder. This means, that using the GUID stored within the file upload field, you can compose the link like:
~/SiteName/BizFormFiles/3560f3ed-6a12-444e-9fc6-2447fc903a23.jpg
One of my friend suggested a solution that is works well!
1- at the first get the access to Everyone to read form records. Applications>Permissions>Module>forms
get the access to Everyone
2- the code for transformation:
<asp:PlaceHolder ID="ph1" runat="server" Visible='<%# IfEmpty(Eval("UploadFile1"), false, true) %>'>
<br>
<a style="color:blue;font-weight:bolder" href=<%# "https://example.com/CMSPages/GetBizFormFile.aspx?filename=" + Eval("UploadFile1").ToString().Split('/')[0] %>>Download File: <%# Eval("UploadFile1").ToString() == "" ? "a" : Eval("UploadFile1").ToString().Split('/')[1] %></a>
</asp:PlaceHolder>
the first line is for show nothings if there is not any uploaded file.

Extra text in footer in laravel

I have a Script . there have a footer text after
</body></html>
that means end of every page .i searching all view file and some off others directories not find out that text . so is there any possibility File i can get this footer text. i have not enough knowledge in laravel ..
As you mecioned, you cant find text on your footer.
That is probably beacause you have a template for content
search line code
section('content')
or maybe
section('footer')
This is the section you are working on.
Go back to your views folder
Open app.blade.php, find yield('content') or what your looking for, there you have the code included into all views.
or maybe you have a view fooder.blade.php the footer of all views
That is templating logic on laravel, you can search all code following the sections.
If there is no a layouts folder, look for something with related name.

trying to find a file to edit the div information

So we have a section on our website (category menu) which was modified to include a custom menu system. in the file top.phtml i found the following code
<div >
<?php //echo $_menu;
echo $nf_menu;
?>
</div>
The code inside the div's is calling for the menu, but i need to edit the actual code of the menu as it has inline styles for z-index applied to it and i need to adjust the z-index number.
Where would i find this menu. does that php code indicate where the file may be? Our coder is gone so we are not sure how they did this.
Based on the very limited information you've provided, there are basic ways of finding out where specific code is being generated in Magento (or any other scripting/php based framework).
View the html source (output) of your menu in a browser and find a piece of the menu HTML that would be unique. An example can be a unique class name or something that will set it apart from everything else.
<ul class="nf-menu">
<li>...
Do a site-wide file search for the unique reference you found in step 1. For example, search for <ul class="nf-menu"> or just nf-menu.
Don't know how to search for text in a file? Use the resources you have available to learn how:
For Linux based machines, see Finding all files containing a text string on Linux
Or if you have the files locally, use an IDE program such as phpStorm or Dreamweaver that includes a folder search for files containing a string of text.
Once you've found the file generating the code, simply make the modifications. I'd recommend making a backup of any file you modify so that you can revert to it if you're changes don't work as intended.

Edit PHP file for Joomla 2.5 Module K2 Content

I'm trying to edit the K2 content module by changing the file:
/modules/mod_k2_content/tmpl/Default/default.php
Basically I need a div to wrap around:
<a class="moduleItemCategory">
Somewhere near line 128.
But when I change the file nothing is changed on the webpage...
Is this the right file?
I'm not using sub-templates.
It might be possible that there is a template override for this file. Template overrides are simply a duplicate of your default.php (name may sometimes be different) which will be located in the directory below and is used to perform edits to the view of an extension without editing the core file.
templates/TEMPLATE_NAME/html/mod_k2_content/default.php
If you see this file there, then you will need to edit this one

How can I display an XML feed without any template code in Joomla?

I'm trying to display an XML feed in a custom Joomla 2.5 component's view/layout, but the XML is rendered as a regular layout inside the site's HTML template. How can I display the XML without any template HTML code?
(The trick to include tmpl=component in the URL from this related question doesn't help, there's still some HTML output from the template that ruins the XML.)
I would prefer a solution that only involves code changes in my custom component, like in Symfony when you call the method setLayout(false).
The only solution I have found is to create a file in the current template folder, e.g. "xml.php", and put only this in the file:
<?php
$document = JFactory::getDocument();
$document->setMimeEncoding('text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<jdoc:include type="component" />
Then I can append tmpl=xml to the URL.
[edit]
My bad, I made an assumption and you know what that gets you.
Joomla! 1.6->2.5 you can create an alternate output format for an existing view by:
calling the view with a format parameter attached e.g. &format=json
creating a matching view class file e.g. view.json.php that can sit alongside the standard view.html.php file for you view.
The view.yourformat.php file can use your existing controllers and template files in the normal fashion.
Don't forget to add either &tmpl=component or &tmpl=raw to your query string so modules etc don't load as well.
tmpl=raw won't load the html body surrounds or template, only the main component.
[/edit]
From Joomla! 1.6 onward (including 2.5) there is built in support for controller formats ie. you create a controller for the output format you want.
Normally a controller would be named for each view:
/components/mycomp/controllers/myview.php
A XML version of the controller would be name:
/components/mycomp/controllers/myview.xml.php
A JSON version would be:
/components/mycomp/controllers/myview.json.php
To call a particular format version of a controller you simply add &format=theformatyouwant to the URL parameters, so in your case &format=xml
This is discussed in this document from 1.6 days - I used it as a basis for several of our components that have JSON and ics requirements.
This issue drove me crazy a couple of times.
After much frustration, the simplest solution is the one suggested by cppl. In your query
string put the following variables:
format=yourcustomformat
view=viewname
Let say you want json output from a view called json.
Create a veiw folder with the name of your view
json
And a file inside that folder called
view.json.php
Then in your url string you include the following url parameters seperated by the & symbol:
index.php?option=com_mycomponent&format=json&view=json
cppl is correct that this loads a non-html view. However you don't have to put the tmpl parameter in at least in 2.5. If the view name is not view.html.php then 2.5 seems to not include the assigned site template in the response. I think because the view is not veiw.html.php it assumes raw output and does not include the template. I tested this with both an ajax call and a direct url call to the view and in both cases all I got back was the component output. Yeah!
If someone knows where this issue is well documented by the Joomla folks please post!

Resources