video-tutorial will help you create static block in magento backend.
And call backend static block to frontend .phtml file.
And call backend static block to frontend .phtml file.
INSTALLATION
<form action="" method="post" enctype="multipart/form-data"> Upload Image:<input type="file" name="image" id="image_id" /> </form>following code used to limit the upload file extension
<script type="text/javascript"> $(function() { $('#image_id').change( function() { var ext = $('#image_id').val().split('.').pop().toLowerCase(); if($.inArray(ext, ['gif','png','jpg','jpeg']) == -1) { $('#image_id').val(""); alert('Please Enter the files in the format jpeg,gif,png'); } }); }); </script>
<script> (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOUR APP ID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>3.Paste following code in which place you need like button
<div class="fb-like" data-href="http://phpand.blogspot.com/" data-send="true" data-width="450" data-show-faces="true" data-font="arial"></div>4. For more refer https://developers.facebook.com/docs/reference/plugins/like/
<html> <head> <title>My Facebook Login Page</title> </head> <body> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : 'YOUR_APP_ID', status : true, cookie : true, xfbml : true }); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script> <div class="fb-login-button" data-perms="email,user_checkins"> Login with Facebook </div> </body> </html>
<?php global $user; print_r($user->username); ?>
<?php global $user; print_r($user); ?>
<a href="http://www.facebook.com/sharer.php?u=<url to share> &t=<title of content>" target="_blank"> link or image</a>
<a name="fb_share" type="button" share_url="YOUR_URL">Compartir en Facebook</a> <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"> </script>For more http://developers.facebook.com/docs/share/
<?php if (($i % 2) == 0 ) { echo "$i is even"; } else { echo "$i is odd"; } ?>Another method to find odd or even number in php, by using Logical AND operator
<?php function is_odd($num) { return( $num & 1 ); } if (is_odd(8)) { echo "8 is odd"; } else { echo "8 is even"; } Output: 8 is even ?>Number 8 binary value is 1 0 0 0
$fruit[0] = "apple"; $fruit[1] = "banana"; $fruit[2] = "orange"; echo $fruit[0];
for ($i=0;$i<=2;$i++){ echo $fruit[$i]; }
$count = count($fruit); for ($i=0;$i<=$count;$i++){ echo $fruit[$i]; }
foreach ($fruit as $value){ echo $value; }
GET
|
POST
|
---|---|
Get method transfer data through URL
http://www.phpand.blogspot.com/index.php?fname=phpand&age=20
|
In post method data transfer will not appear in the browser
|
Get method have character restriction depends on browser. In old browser URL length is very less.
|
Post method is no limit. The post method depends on post_max_size in the php.ini file
|
Get method data will be visible for every one(displayed in the browser's address bar)
|
Post data not visible and secure.
|
Get method data transfer speed is high
|
Data transfer speed is less.
|
if(ereg("^[0-9]{2}-[0-9]{10}$", $phone_number)) { echo "valid phone number"; } else { echo "invalid phone number"; }
if(ereg("^[0-9]{3}-[0-9]{3}-[0-9]{4}$", $phone_number)) { echo "valid phonenumber"; } else { echo "invalid phonenumber"; }
strstr($string , $needle string , $before needle);
<?php $email = 'name@example.com'; $domain = strstr($email, '@'); echo $domain; // prints @example.com $user = strstr($email, '@', true); // As of PHP 5.3.0 echo $user; // prints name ?>
if($_SESSION['user']->guid != page_owner()){ forward($_SERVER['HTTP_REFERER']); }
SELECT salary FROM `salary_table` GROUP BY `salary` DESC LIMIT 1 , 1;
SELECT max(salary) FROM `salary_table` WHERE salary = (SELECT max(salary)FROM `salary_table`);
global $CONFIG; echo "<pre>"; print_r($CONFIG->actions);
$form_body .= elgg_view('input/captcha');
function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params)
{
if (!is_array($returnvalue))
$returnvalue = array();
$returnvalue[] = 'register';
$returnvalue[] = 'user/requestnewpassword';
$returnvalue[] = 'your action name';
return $returnvalue;
}
captcha_verify_action_hook();
<?php if(ereg("^[0-9]{2}-[0-9]{10}$", $phone_number)) { echo "valid phone number"; } else { echo "invalid phone number"; } ?>
SELECT * FROM `user` WHERE `Id` =1;
SELECT * FROM `user` WHERE `Id` IN ('1','2','3');
SELECT * FROM `user` WHERE `Id` IN ('1','2','10');
<script type="text/javascript"> <!-- var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() $(document).ready(function(){ $('#DOB1').datepick({ yearRange: '-90:+10', dateFormat: 'mm/dd/yyyy', maxDate: 'month/day/year', altField: '#DOB1_alt', showTrigger: '<img src="images/calendar.gif" alt="Popup" class="trigger">', onSelect: function(dates) { var date = dates[0]; $('#DOB1_alt').val(date); } }); }); //--> </script></div>
<?php global $CONFIG; echo $CONFIG->path; ?>
$allselect = '';
$friendsselect = '';
$mineselect = '';
switch($vars['orient']) {
case '':
$allselect = 'class="selected"';
break;
case 'friends':
$friendsselect = 'class="selected"';
break;
case 'mine':
$mineselect = 'class="selected"';
break;
}
?>
<?php
if (isloggedin()) {
?>
<div id="elgg_horizontal_tabbed_nav">
<ul>
<li <?php echo $allselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?display="><?php echo elgg_echo('all'); ?></a></li>
<li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=friends&content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?display=friends"><?php echo elgg_echo('friends'); ?></a></li>
<li <?php echo $mineselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=mine&content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?display=mine"><?php echo elgg_echo('mine'); ?></a></li>
</ul>
</div>
<?php
}
?>
$friendsselect = '';Step 2:
$mineselect = '';
switch($vars['orient']) {
case '':
$friendsselect = 'class="selected"';
break;
case 'friends':
$friendsselect = 'class="selected"';
break;
case 'mine':
$mineselect = 'class="selected"';
break;
}
?>
<?php
if (isloggedin()) {
?>
<div id="elgg_horizontal_tabbed_nav">
<ul>
<li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=friends&content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?display=friends"><?php echo elgg_echo('friends'); ?></a></li>
<li <?php echo $mineselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=mine&content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?display=mine"><?php echo elgg_echo('mine'); ?></a></li>
</ul>
</div>
<?php
}
?>
switch($orient) {
case 'mine':
$subject_guid = get_loggedin_userid();
$relationship_type = '';
break;
case 'friends':
$subject_guid = get_loggedin_userid();
$relationship_type = 'friend';
break;
default:
$subject_guid = 0;
$relationship_type = '';
break;
}
switch($orient) {
case 'mine':
$subject_guid = get_loggedin_userid();
$relationship_type = '';
break;
case 'friends':
$subject_guid = get_loggedin_userid();
$relationship_type = 'friend';
break;
default:
$subject_guid = get_loggedin_userid();;
$relationship_type = 'friend';
break;
}
<?php
if(isloggedin()){
?>
<!-- spotlight -->
<?php //echo elgg_view('page_elements/spotlight', $vars); ?>
<?php
}
?>
function user_menu() {In system.admin.inc file
$items['admin/user'] = array(
'title' => 'User management',
'description' => "Manage your site's users, groups and access to site features.",
'position' => 'left',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('access administration pages'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
'weight' => 3,
);
}
function system_admin_menu_block_page() {The same module we display our custom module menus
$item = menu_get_item();
if ($content = system_admin_menu_block($item)) {
$output = theme('admin_block_content', $content);
}
else {
$output = t('You do not have any administrative items.');
}
return $output;
}
Add following function in template.php.
After create page-calendar.tpl.php file in theme folder.
Clear cache and check it.