Posts

Showing posts from September, 2020

sitemap date format

  Date formating in sitemap.xml file for SEO:     The 'lastmod' element has to be of the format YYYY-MM-DD or YYYY-MM-DDThh:mmTZD so use: gmdate( 'Y-m-d' , strtotime($row[ 'modified' ][ 'value' ])) or gmdate( 'Y-m-d\TH:i:s+00:00' , strtotime($row[ 'modified' ][ 'value' ]))

Oop - php

                                                              OOP-PHP      1:config.php     store all the db related info uder this file as constant:      <?php define ( "DB_HOST" , "ecom.loc" ); define ( "DB_USER" , "root" ); define ( "DB_PASS" , "" ); define ( "DB_NAME" , "phptest" ); ? > 2: Database.php create a class with suitable name  and initialize the connection from the database with oop mysqli. and make a function for selecting the data from the database. <?php class Database { //database configuration variables public $host = DB_HOST ; public $user = DB_USER ; public $pass = DB_PASS ; public $dbname = DB_NAME ; //connection and error variables public $conn; public $error; //constructor function for calling connectDB public function __construct (){ $this -> connectD

preparation analytics

                                                            Preparation Test      date : 28/09/2020    CSS :      1: Explain the CSS “box model” and the layout components that it consists of.             Provide some usage examples.      The CSS box model is a rectangular layout paradigm for HTML elements that consists of the following: Content - The content of the box, where text and images appear Padding - A transparent area surrounding the content (i.e., the amount of space between the border and the content) Border - A border surrounding the padding (if any) and content Margin - A transparent area surrounding the border (i.e., the amount of space between the border and any neighboring elements) Each of these properties can be specified independently for each side of the element (i.e., top, right, bottom, left) or fewer values can be specified to apply to multiple sides. For example: /* top right bottom left */ padding : 25 px 50 px 75 px 100 px ; /

Working with Express.js

Image
  Whats in the module :         What is Express.js :   Installing Express.js: To install the expressjs into your app , you have to run - npm install --save express Adding Middleware:   example :       const http = require ( 'http' ); const express = require ( 'express' ); const app = express (); app . use (( req , res , next ) => { console . log ( 'In the middleware!' ); next ();//Allow the request  to continue to the next middleware in line }); app . use (( req , res , next ) => { console . log ( 'In another middleware!' ); }) const server = http . createServer ( app )//app is act As a valid request handler. //listening to a port for request server . listen ( 3000 ); console . log ( 'listening to port 3000' );     Handling Different Routes :                           const express = require ( 'express' ); const app = express (); // app.use((req, res, next) => { // console.log('First Middl