Image Caption

Thursday, February 14, 2013

Joomla mass email with attachments [Demo Code]


Step: 1 Create the form 

<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
 <input type="text"   name="emailid" id="emailid"  />
 <input type="text"   name="subject" id="subject"  />
 <input type="text"   name="message" id="message"  />
 <input type="file"   name="attachment" id="attachment"  />
</form>

Step: 2 Get the form value and Call the mail function

$recipient  = JRequest::getVar('emailid', '', 'post', 'string', JREQUEST_ALLOWRAW);
$subject  = JRequest::getVar('subject', '', 'post', 'string', JREQUEST_ALLOWRAW);
$body  = JRequest::getVar('message', '', 'post', 'string', JREQUEST_ALLOWRAW);
$attachment = JRequest::getVar('attachment', null, 'files', 'array');
$attachmentname=$attachment[name];
jimport( 'joomla.utilities.utility' );
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment, $attachmentname, $replyto=null, $replytoname=null);


Step: 3 Replace the function "addAttachment" in libraries/joomla/mail.php

function addAttachment($attachment, $name = '')
{
// If the file attachments is an aray, add each file... otherwise just add the one
if (isset ($attachment))
{
if (is_array($attachment)) {
foreach ($attachment as $file) {
parent::AddAttachment($file, $name);
}
}
else
{
parent::AddAttachment($attachment, $name);
}
}
}

Step: 4 Replace the below code in ( libraries\joomla\utilities\utility.php ) line 44

function sendMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment=null,$attachmentname, $replyto=null, $replytoname=null )

Saturday, February 9, 2013

Chronoform - You are not allowed to access this URL directly, POST array is empty [Solved]

This issue occurred due to some users access site with and without "www" site url 

Check Form action url:
<form name="ChronoContact_Renewal" id="ChronoContact_Renewal" method="post" action="http://website.com/index.php?option=com_chronocontact&task=send&chronoformname=ExamApply&Itemid=119" >

Default Form action url:
http://website.com/index.php?option=com_chronocontact&task=send&chronoformname=ExamApply&Itemid=119


Need to change the Form action url:
index.php?option=com_chronocontact&task=send&chronoformname=ExamApply&Itemid=119

Place the above url in 
Chronoform >>> Forms Managements >>> General  >>> Form submit url

<form name="ChronoContact_Renewal" id="ChronoContact_Renewal" method="post" action="index.php?option=com_chronocontact&task=send&chronoformname=ExamApply&Itemid=119" >




Friday, February 8, 2013

iPhone/iPad Website Icon image and Title


Add the code to head tag

Icon Image:
<link rel="apple-touch-icon" href="images/favicon.png"/>

Icon Text:
<meta name="apple-mobile-web-app-title" content="Site Title">

Thursday, February 7, 2013

Get Radio Button Value in JavaScript

Get Radio Button Value in JavaScript
<script>

function getvalue() {
    var radios = document.getElementsByName("test");

    for (var i = 0; i < radios.length; i++) {      
        if (radios[i].checked) {
            alert(radios[i].value);
            break;
        }
    }
}
</script>
<input type="radio" name="test" value="first" onclick="getvalue();">
<input type="radio" name="test" value="second" onclick="getvalue();">

Logout link for Joomla 1.5, 2.5 and 3.0

[Note: Tested in Joomla 1.5, 2.5, 3.1.5]

Joomla 1.5 Logout Link

<?php
$returnURL = base64_encode(JURI::root() . "");
$user =& JFactory::getUser();
echo 'Hi,'.$user->username;
?>
<a href="index.php?option=com_user&task=logout&return=<?php echo $returnURL; ?>">
<input  type="button" name="Submit" class="button" value="Logout"></a>

Joomla 2.5 Logout Link


<a href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1">
<input  type="button" name="Submit" class="button" value="Logout">
</a>


Joomla 3.1 Logout Link

//JUtility::getToken() has been removed in Joomla 3.0. Use JSession::getFormToken() instead.

<a href="index.php?option=com_users&task=user.logout&<?php echo JSession::getFormToken(); ?>=1">
<input  type="button" name="Submit" class="button" value="Logout">
</a>


Friday, February 1, 2013

Site is down just for me [Solved]

You think your ISP has blocked a website from you. please follow the below step to unblock the site.

Step:1

Install the spotflux to your PC. Click here to download SpotFlux

Step: 2

Spotflux >>> Setting >>> Proxies[Tab] >>> Auto detect proxy setting >>> ok

Step:3

Then check the Blocked website in your browser...