CluesShop.com

Wednesday, 26 February 2014

adding link to drupal7

 $form['password']=array(
      '#type' => 'link',
      '#markup' => '',
       '#title' => t('Forgot Password'),
       '#href' => 'user/password',
   );

Monday, 24 February 2014

multiple back in drupal7 using from_state

function scheduledevents_add_form($form, &$form_state, $scheduledevents) {
    // unset($_SESSION['fromtemplateview']);
      //global $base_url;
     // $path='';
     // $_SESSION['currentpage']
  //$_SESSION['flag']=false;
 
  if(!isset($form_state['page'])){
   // if($_SESSION['flag']==false){
  if(isset($_SERVER['HTTP_REFERER'])){
   $str=$_SERVER['HTTP_REFERER'];
   $t=explode('admin', $str);
   $schedulepagepath='admin'.$t[1];
   $form_state['page']['flag']=true;
   if($schedulepagepath=="admin/structure/cruise/manage"){
       $form_state['page']="admin/structure/cruise/manage";
        //var_dump('tre');
   }else{
     //  var_dump('fa');
      $form_state['page']="cruiseeventlist";
   }
  
  }
 //}
  }

sessions in drupal7 back for multiple

function scheduledevents_add($cruisetemplateid) {
   
    $cruise=cruise_load($cruisetemplateid);
 $title = ucwords($cruise->cruise_title);
 drupal_set_title($title, $output = CHECK_PLAIN);

//   if (isset($_SERVER['HTTP_REFERER'])) {
//  echo "<a href=".$_SERVER['HTTP_REFERER'].">Back</a>";
//    }


 $_SESSION['fromtemplateview']=true;

}

function scheduledevents_add_form($form, &$form_state, $scheduledevents) {
   
    global $base_url;
    if(isset($_SESSION['fromtemplateview'])){
        $path=$GLOBALS['base_url'] .'/admin/structure/cruise/manage';
        unset($_SESSION['fromtemplateview']);
    }else{
        $path=$GLOBALS['base_url'].'/cruiseeventlist';
    }
}

$form['back']=array(
        '#type' => 'markup',
        '#markup' =>'<div> <a style="font-size:120%;" href="'.$path.'"> < Back to Events List</a> </div>',
      
    );

Sunday, 23 February 2014

back link

 $form['back']=array(
        '#type' => 'markup',
        '#markup' =>'<div> <a style="font-size:120%;" href="'.$_SERVER['HTTP_REFERER'].'"> < Back to Events List</a> </div>',
       
    );

drupal 7 title dyanic

 $cruise=cruise_load($cruisetemplateid);
 $title = ucwords($cruise->cruise_title);
 drupal_set_title($title, $output = CHECK_PLAIN);

Friday, 21 February 2014

drupal7 price two digit number after decimal

$form ['tickets' . $ticket->id] ['price-' . $ticket->id] = array (
'#type' => 'textfield',
'#title' => t ( 'Price' ),
'#size' => 60,
'#maxlength' => 128,
'#title_display' => 'invisible',
'#attributes' => array ('placeholder' => 'Price'),
'#field_prefix' => '$',
'#default_value'=>sprintf("%.2f",$ticketPrice), //two number
);

Thursday, 20 February 2014

jquery pop when we select

<script>

$(document).ready(function(){

    $("#sel_change").change(function(){

        alert ("change event occured with value: " + document.getElementById("sel_change").value);

  });

});

</script>

</head>

<body>

<p>Select a menu item to see change event!</p>

<form id="changeform">

select a value from dropdown:

<select id="sel_change">

  <option value="Jan">Jan</option>

  <option value="Feb">Feb</option>

  <option value="March">Mar</option>

Wednesday, 19 February 2014

Insert php database using cmd prompt

mysql data upload using cmd promp

step 1:

Go to xamp inside bin copy the  path
step 2:
Go to cmd and past the path

step 3:

-u root -p -h localhost databasename < path of database wants to upload

Example :

C:\xampp\mysql\bin\mysql -u root -p -h localhost test < c:\user\LSN!$\desktop\p\testweb 

Thursday, 13 February 2014

Wednesday, 12 February 2014

drupal7 add cancel button

Cancel button to take them back to the previous page.



function hook_form_alter(&$form, &$form_state, $form_id) {
  $form = array();

  $form['actions']['cancel'] = array(
    '#type'   => 'submit',
    '#value'  => t('Cancel'),
    '#submit' => array('callback_for_cancel_button'),
    '#limit_validation_errors' => array(),
  );

  return $form;
}

function callback_for_cancel_button($form, &$form_state) {
  $url = $_GET['destination'] ? $_GET['destination'] : '';
  drupal_goto($url);
}