Tuesday, September 24, 2013

social network share code

<script>
function facebook(){
var urlToShare = 'http://ersegment.com';
var link = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');
}
</script>
<script>
function tweeter(){
var urlToShare = 'http://ersegment.com';
var link = 'http://twitter.com/intent/tweet?url='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');
}
</script>
<script>
function linkedin(){
var urlToShare = 'http://ersegment.com';
var link = 'http://www.linkedin.com/shareArticle?url='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');
}
</script>


<script>
function twitter(){
var urlToShare = 'www.google.com';
var link = 'http://twitter.com/intent/tweet?url='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');

}
function facebook(){
var urlToShare = 'www.google.com';
var link = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');

}
function googleplus(){
var urlToShare = 'www.google.com';
var language = 'de';
var link = 'https://plus.google.com/share?url='+encodeURIComponent(urlToShare)+'&hl='+language;
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');
}
function linkedin(){
var urlToShare = 'www.google.com';
var link = 'http://www.linkedin.com/shareArticle?url='+encodeURIComponent(urlToShare);
window.open(link,'sharer','toolbar=0,status=0,width=640,height=440');
}
</script>

<ul>
<li><a href="#" onclick="facebook()" class="facebook" title="Share on Facebook"><img src="images/fb.png" /></a></li>
<li><a href="#" onclick="tweeter()" class="twitter"  title="Share on Twitter"><img src="images/tw.png" /></a></li>
<!--<li><a href="#" class="google"  title="Share on Google+"><img src="images/go.png" /></a></li>-->
<li><a href="https://plus.google.com/share?url={http://ersegment.com}" onclick="javascript:window.open(this.href,
  '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"><img
  src="/images/go.png" alt="Share on Google+" class="google"/></a></li>

<li><a href="#" class="bing"  title="Share on Rss"><img src="images/bi.png" /></a></li>
<li><a href="#" onclick="linkedin()" class="in"  title="Share on Linkedin"><img src="images/ing.png" /></a></li>
</ul>

Friday, July 5, 2013

zend form example

<?php
class Application_Form_UserForm extends Zend_Form
{
public function init()
{

$fname = $this->createElement('text','firstName')
->setLabel('First Name*')
->setRequired(true)
->setAttrib('size', '15');

$lname = $this->createElement('text','lastName')
->setLabel('Last Name*')
->setRequired(true)
->setAttrib('size', '15');



$email = $this->createElement('text', 'email', array(
      'label' => 'Email Address*',
      'required' => true,
      'validators' => array(
        array('NotEmpty', true, array('messages' => 'Please Enter Email')),
        array('regex', false, array('pattern' => '/^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/',
        'messages'=>array(Zend_Validate_Regex::NOT_MATCH=>'%value% is not a valid Email')
    )))
       )
  );



$password = new Zend_Form_Element_Password('password');
        $password->setLabel('Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
    ->addValidator(new Zend_Validate_NotEmpty())
                    ->setAttrib('size',15);

        $password2 = new Zend_Form_Element_Password('confirm_password');
        $password2->setLabel('Confirm Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator('Identical', false, array('token'=>'password', 'messages'=>'Passwords mismatch!'       )      )

->setAttrib('size',15);

$captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => 'Security Check',
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'font' => APPLICATION_PATH . '/../public/captcha/AllerDisplay.ttf',
'fontSize' => '24',
'wordLen' => 6,
'height' => '50',
'width' => '150',
'imgDir' => APPLICATION_PATH . '/../public/captcha',
'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl() . '/captcha',
)
    ));



  $submit = $this->createElement('submit', 'submit')
->setAttrib('class', 'botton')
->setName('Submit');

$this->addElements(array($fname, $lname, $email, $password, $password2, $captcha,  $submit));
}
}
?>