View in Drupal

View is nothing but a user defined template with is changed / create block or page.

Views having fields like title, body, link etc..

Link is used for navigate permalink of any node type like articles, news etc…

Body having with limit and without limit.

JavaScript Events

The web is a dynamic environment where a lot of things happen. Most appropriately, they’re called events. Some of these events, like a user clicking a button or moving the mouse over a link, are of great interest to a JavaScript coder.

events

  1. onClick event: triggered by you as you click the link;
  2. onUnload event: triggered by the web browser as it leaves the current web page;
  3. onLoad event: triggered by the browser as the new web page content is loaded.

Example specified below

<a href="http://html.net" onclick="alert('Going anywhere? Not so fast!'); return false;">Click Me!</a>

JavaScript basics

  <!DOCTYPE html>
	  <html>
	  <head>
	  <title>My first JavaScript page</title>
/*Load in separate file */
<script type="text/javascript" src="yourjavascript.js"></script>
	  </head>
	  <body>
        
	  <script type="text/javascript">
	  //JavaScript code goes here
	  alert('Hello World!');
      </script>
		
	  </body>
	  </html>

Is JavaScript the same as Java?

No, they are not.

Java (developed by Sun Microsystems) is a powerful and much more complex programming language in the same category as C and C++.

JavaScript is a scripting language, that is, a lightweight programming language that is interpreted by the browser engine when the web page is loaded.

WordPress mail functionality

if(isset($_POST[‘submit’])){

$name = $_POST[‘name_fil’];
$mail = $_POST[‘mail_fil’];
$web = $_POST[‘web_fil’];
$msg = $_POST[‘msg_fil’];
if($name==”” || $mail==”” || $web==”” || $msg==””){
$mess = ‘<span style=”color: #c00;”>All (*) fields are required</span>’;
}else{
$message .= ‘Name: ‘.$name;
$message .= ‘<br>’;
$message .= ‘E-Mail: ‘.$mail;
$message .= ‘<br>’;
$message .= ‘Website: ‘.$web;
$message .= ‘<br>’;
$message .= ‘Message: ‘.$msg;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;
if(wp_mail(‘mail id’, “Contact Us”, $message, $headers)){
$mess = ‘<span style=”color: #20B217;”>Mail sent successfully</span>’;
}

}

echo $mess;

Drupal 8 folder structure

Drupal

  • core (Within this folder having like core folders like “Core modules”, “Core themes” etc..)
  • modules (We are able to use custom modules like other than predefined modules).
  • profiles
  • sites
  • themes (We are able to use custom themes here).

1. In drupal 8 provided excellent editor for upload content in base page or articles.

2. Built in “Views” and “Views UI” modules are┬áthere for drupal 8.

Some of action hooks in wordpress

  • muplugins_loaded
  • registered_taxonomy
  • registered_post_type
  • plugins_loaded
  • sanitize_comment_cookies
  • setup_theme
  • load_textdomain
  • after_setup_theme
  • auth_cookie_malformed
  • auth_cookie_valid
  • set_current_user
  • init
  • widgets_init
  • register_sidebar
  • wp_register_sidebar_widget
  • wp_default_scripts
  • wp_default_stypes
  • admin_bar_init
  • add_admin_bar_menus
  • wp_loaded
  • parse_request
  • send_headers
  • parse_query
  • pre_get_posts
  • posts_selection
  • wp
  • template_redirect
  • get_header
  • wp_head
  • wp_enqueue_scripts
  • wp_print_styles
  • wp_print_scripts

Create widgets in wordpress

function rainbow_widgets_init() {
register_sidebar( array(
‘name’ => __( ‘Primary Sidebar’, ‘rainbowtheme’ ),
‘id’ => ‘sidebar-1’,
‘description’ => __( ‘Main sidebar that appears on the left.’, ‘rainbowtheme’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h1 class=”widget-title”>’,
‘after_title’ => ‘</h1>’,
) );
register_sidebar( array(
‘name’ => __( ‘Content Sidebar’, ‘rainbowtheme’ ),
‘id’ => ‘sidebar-2’,
‘description’ => __( ‘Additional sidebar that appears on the right.’, ‘rainbowtheme’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h1 class=”widget-title”>’,
‘after_title’ => ‘</h1>’,
) );
register_sidebar( array(
‘name’ => __( ‘Footer Widget Area’, ‘rainbowtheme’ ),
‘id’ => ‘sidebar-3’,
‘description’ => __( ‘Appears in the footer section of the site.’, ‘rainbowtheme’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h1 class=”widget-title”>’,
‘after_title’ => ‘</h1>’,
) );
}
add_action( ‘widgets_init’, ‘rainbow_widgets_init’ );