Adding fields to Joomla 3.x contact component - joomla

I need to add fields to the joomla 3.x com_contact component. I have found some instructions via google search but they are all for earlier versions (i.e. 2.5) of Joomla.
I know there are other components on the extensions.joomla.org site, but they are not what I want. And I am not looking for contact form components. I don't need to create forms.
I tried adapting the 2.5 modifications I found for 3.x but they don't work. At least I could not get them to work.
Here's the closest I found to doing this. But it is for joomla 2.5 and the steps appear to be different for 3.x based on my attempts to do this.
How to do it but apparently not for Joomla 3.x
Does anyone have step-by-step directions on how to do this?
Thanks!

If you want add fields to Joomla 2.5.x/3.x ‘Contact Form’ do these steps:
(I want to add ‘telephone’ field)
1- Go to *Joomla Directory > components > com_contact > models > forms*
Open ‘contact.xml’ file.
2- Add this code to the file between ‘fieldset’ element:
<field name="contact_telephone"
type="text"
id="contact-telephone"
size="30"
description="Your Number for Contact"
label="Phone"
filter="string"
required="true"/>
3- Go to *Joomla Directory > components > com_contact > views > contact > tmpl*
Open ‘default_form.php’ file.
4- Find this code in the file:
<legend><?php echo JText::_('COM_CONTACT_FORM_LABEL'); ?></legend>
and add this code between element:
<dt><?php echo $this->form->getLabel('contact_telephone'); ?></dt>
<dd><?php echo $this->form->getInput('contact_telephone'); ?></dd>
5- Go to *Joomla Directory > components > com_contact > controllers*
Open ‘contact.php’ file.
6- Find ‘_sendEmail’ function
[find this code: private function _sendEmail($data, $contact) ]
and add this code in the function:
$telephone = $data['contact_telephone'];
and then change this code
$body = $prefix."\n".$name.' <'.$email.'> '."\r\n\r\n".stripslashes($body);
to
$body = $prefix."\n".$name.' ('.$email.', '.$telephone.') '."\r\n\r\n".stripslashes($body);
I added the variable $telephone in that line.
Now, emails contain the telephone-number from the sender.
This worked perfectly for me!

On Step number 4 IF YOU`RE USING A TEMPLATE, then you go to:
*Joomla Directory > templates > your_template_folder_name > html > com_contact > contact > and ppen ‘default_form.php’ file.

Related

How to use correct lang parameter?

I have a fresh Mediawiki installed into fresh UBUNTU 18 LTS... The ''SyntaxHighlight'' extension not works for Unix shell, lang="sh", lang="shell", lang="bash", ... no one is working. It is not at #Supported_languages, and there are no clues about how to install "Other markup".
At mediawiki.org/list there are no clues.
So, how to solve the problem? It is a config, env or syntax problem?
NOTES AND TESTS
Notes.
It is a corporative Wiki, no way to offer public URL... But it is a fresh, standard and controlled installation, all reproductive and standard.
The Wiki was configured with skin "Vector" and language "Brazilian Portuguese".
Tests.
Usage tests of mediawiki.org/Extension:SyntaxHighlight, the Python example.
1.1. With tag <syntaxhighlight>. Result: no highlight, same as <pre>.
1.2. With tag <source>. Result: no highlight, same as <pre>.
PHP example, fragment from wikipedia.org/PHP Syntax.
2.1. With tag <syntaxhighlight>. Result: no highlight, same as <pre>.
2.2. With tag <source>. Result: no highlight, same as <pre>.
The code fragments used in the tests:
def quickSort(arr):
less = []
pivotList = []
more = []
if len(arr) <= 1:
return arr
else:
pass
<title>PHP "Hello, World!" program</title>
<?php echo '<p>Hello World</p>'; ?>
MediaWiki Syntax highlighter used Pygments library, you should first download and install the extension:
Requirements
This version of the extension has been tested with Pygments 1.6, 2.0.2 and
MediaWiki 1.25 as of 2015-06-19. To get releases of this extension compatible
with earlier versions of MediaWiki, visit:
https://www.mediawiki.org/wiki/Special:ExtensionDistributor/SyntaxHighlight_GeSHi
Download
https://github.com/wikimedia/mediawiki-extensions-SyntaxHighlight_GeSHi/archive/master.tar.gz
Installation
Add this line to your LocalSettings.php:
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
By default, this extension will use a bundled copy of Pygments 2.0.2. If you
would like to use a different copy of the library, you can set
$wgPygmentizePath to point to the path to the 'pygmentize' binary.
Usage
On the wiki page, you can now use "source" elements:
<source lang="php">
<?php
v = "string"; // sample initialization
?>
html text
<?php
echo v; // end of php code
?>
</source>
Parameters
For details information of these parameters, see the documentation of Pygments'
HtmlFormatter at http://pygments.org/docs/formatters/#HtmlFormatter.
lang; Defines the language.
line; Corresponds to linenos="inline" option.
start; Corresponds to linenostart opion.
enclose; If set to "none", corresponds to the nowrap=1 option.
inline; Corresponds to the nowrap=1 option.
highlight; Corresponds to hl_lines option (comma separated).
Note
Pygments is generous about creating HTML elements: highlighting large blocks of
code can easily generate enough of them to crash a browser. As a guard, syntax
highlighting is turned off for code fragments larger than 100 kB.

How to show code in Mobile device in Prestashop 1.7

I need add a custom code in Prestashop 1.7 only for Mobile visits. Css display none is not the solution I am looking for. In previous PS 1.6 the code what works was {if $isMobile} and checking PS 1.7 file classes/Context.php yet is included the variable "isMobile".
I tried add a {if $isMobile} or {if $mobile_device} in .tpl files but it is not working
Into the getWidgetVariables() function of your controller module, you can add the following line into array returned:
'mobile_device' => Context::getContext()->isMobile(),
And check into your .tpl:
{if isset($mobile_device) && $mobile_device}
<p>Displayed only on mobile</p>
{/if}

'jQuery' is undefined in while using bundle in mvc

Step 1- We have merge
1) jquery-1.7.2.js,
2) jquery.unobtrusive-ajax.js,
3) jquery.validate.js,
4) jquery.validate.unobtrusive.js
In Single file using online js compressing tool. And saved that new file in our application script folder.
Step 2- When we are using new file in our application by using
" script src="Domain_Path"+"/Scripts/CDNScripts/jqueryval.js" type="text/javascript">"/script>
Its working very good.
Step 3- BUT when we are using bundling and CDN like below.
bundles.UseCdn = false;
string JqueryvalCND = "Domain_Path" + "/Scripts/CDNScripts/jqueryval.js";
bundles.Add(new ScriptBundle("~/bundles/jqueryval", JqueryvalCND).Include(
"~/Scripts/CDNScripts/jqueryval.js"));
**It producing error "'jQuery' is undefined "**
Please suggest urgent
You need to include your bundle in your page too :
Razor : #Scripts.Render("~/bundles/jqueryval")
Web Forms : <%: Scripts.Render("~/bundles/jqueryval") %>

magento theme falling back to default theme evenafter theme is changed in admin side

magento theme falling back to default theme evenafter theme is changed in admin side.
I tried clearing all cache and checked
System > Configuration > GENERAL > Design > Themes > Layout, it is "blank" and System > Configuration > GENERAL > Design > Package > Current Package Name is "default".
In System > Configuration > GENERAL > Design > Package > Current Package Name, you put the name of the folder that is directly under app/design/frontend/ that you are going to use for your theme. inside this folder is your theme. if the theme you are using is not 'default' you need to put the name of this folder to System > Configuration > GENERAL > Design > Themes > Default.
eg: if your package name is mypackage and theme name is mytheme you need to put those in current package name and default themes respectively

how to install gmagick extension of php on windows vista

gmagick is newer version of imagemagick with more set of features it is less resource intensive and fast but the problem is there is very few discussion about this wonderful tool on web i recently came across this on
http://devzone.zend.com/1559/manipulating-images-with-php-and-graphicsmagick/
but i could not install it on windows machines cos phpize did not work so i tried some other way and some how managed to get on phpinfo page but i could not make it work further i colud not even open a single image with gmagick
this is code i used
<?php
$path="gallery/img1.jpg";
// initialize object
$image = new Gmagick($path);
echo $image;
// read image file
$file = 'gallery/img1.jpg';
$image->readImage($file);
echo '<img src="' . $file . '" width="200" height="150" /> <br/>';
?>
i used this code to instanstiate gmagick class and open image but i am geeting very big error as follows
Fatal error: Uncaught exception 'GmagickException' with message 'Unable to open file (gallery/img1.jpg)' in C:\xampp\htdocs\junk\imgproc\imgproc1.php:4 Stack trace: #0 C:\xampp\htdocs\junk\imgproc\imgproc1.php(4): Gmagick->__construct('gallery/img1.jp...') #1 {main} thrown in C:\xampp\htdocs\junk\imgproc\imgproc1.php on line 4
A) To answer the question in your headline (that might lead other readers here):
Windows builds of the GraphicsMagick extension for PHP can be obtained here:
http://valokuva.org/builds/
Check whether you need the thread-safe version or not by looking at a phpinfo(); output of your webserver. Look for the entry Thread Safety. In the entry PHP Extension Build you should also find the VC version that you need, e.g. API20090626,TS,VC9 for VC9.
Download the latest build that matches your conditions, put it into your PHP/ext directory and add it to your php.ini like this:
extension=php_gmagick_ts.dll
Remember to correct the name of the dll if you use the non-TS version.
Restart Apache and check phpinfo();. There should be a gmagick block now..
B) To correct the problem with your code:
The Gmagick constructor does not expect a path as a parameter, but a full image filename (may include a path). Most often it is better to leave it empty and provide the file in the readImage() call.
Try a full $path (starting at root) and use it in readImage() and writeImage():
Here is an example of a working piece of code:
<?php
// assuming this is the path to your code and to your image files
$path = 'C:\xampp\htdocs\junk\imgproc\';
$image = new Gmagick();
$file = 'img1.jpg';
$image->readImage($path.$file);
// The rest of your code does not make any use of the GM instance,
// so I add something functional here: create a grayscale version and show it
$fileOut= 'img1_GRAY.jpg';
$image->setImageType(Gmagick::IMGTYPE_GRAYSCALE);
$image->writeImage($path.$fileOut);
$image->destroy();
echo "<img src='$fileOut' >";
?>
It should show a grayscale version of your image file.

Resources