Snippets
A collection of snippets from CSS-Tricks website for the following groups: HTML CSS Sass SVG htaccess JavaScript jQuery WordPress PHP
Nothing but 0s and 1s
A collection of snippets from CSS-Tricks website for the following groups: HTML CSS Sass SVG htaccess JavaScript jQuery WordPress PHP
Welcome to the modern PHP tutorial! This PHP tutorial helps you learn how to develop dynamic websites and web applications using PHP from scratch. PHP is one of the most popular programming languages for web development. PHP allows you to develop various web applications, including blogs, content management systems (CMS), and online stores.
<html> <head> <title>Pagination</title> <!– Bootstrap CDN –> <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js”></script> </head> <body> <?php if (isset($_GET[‘pageno’])) { $pageno = $_GET[‘pageno’]; } else { $pageno = 1; } $no_of_records_per_page = 10; $offset = ($pageno-1) * $no_of_records_per_page; $conn=mysqli_connect(“localhost”,”my_user”,”my_password”,”my_db”); // Check connection if (mysqli_connect_errno()){ echo “Failed to connect to MySQL: ” . mysqli_connect_error(); die(); } … Read more
<?php // Initialize variable for database credentials $dbhost = ‘hostname’; $dbuser = ‘username’; $dbpass = ‘password’; $dbname = ‘sakila’; //Create database connection $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname); //Check connection was successful if ($dblink->connect_errno) { printf(“Failed to connect to database”); exit(); } //Fetch 3 rows from actor table $result = $dblink->query(“SELECT * FROM actor … Read more
To remove HTML tags in PHP, we can either use the strip_tags() or htmlentities() function: The strip_tags() function will remove all HTML tags. For example, $clean = strip_tags(“<p>Foo</p> Bar”); will result in Foo Bar. The htmlentities() function will not remove but convert all symbols into HTML entities. For example, $clean = htmlentities(“<p>Foo</p>”); will result in <p>Foo</p> Lastly, we can also create a stored function in MySQL to strip HTML … Read more
MUI is a lightweight CSS framework that follows Google’s Material Design guidelines his boilerplate HTML to get started using MUI: <!doctype html> <html> <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <!– load MUI –> <link href=”//cdn.muicss.com/mui-0.10.3/css/mui.min.css” rel=”stylesheet” type=”text/css” /> <script src=”//cdn.muicss.com/mui-0.10.3/js/mui.min.js”></script> </head> <body> <!– example content –> <div class=”mui-container”> <div class=”mui-panel”> <h1>My Title</h1> <button … Read more
Material UI is a React UI framework that follows the principles of Material design. It is based on Facebook’s React framework and contains components that are made according to Material guidelines. Material design was developed by Google in 2014 while Material UI was developed by a small, dedicated, and passionate team in 2017. The first beta version of the … Read more
Bootstrap provides developers with a standard default system for creating easy websites and web applications, while Material offers a wide range of features for creating eye-catching websites with bold colors and engaging animations. Since its launch in August 2011, Bootstrap has become one of the most popular web design systems. Bootstrap provides developers with an … Read more
A headless CMS is a content management system that enables you to deliver content to multiple channels simultaneously. This content repository allows users to create, manage and publish content without having to rely on a separate application or service. In other words, you don’t need to have an interface that users would navigate through in order … Read more
Sometimes you want to add functionality or display something only for logged in users. This is easy using WordPress’ built-in is_user_logged_in() function. This quick tip will show you how to check if a user is logged in WordPress. Here’s an example using the is_user_logged_in() function to display a logout link for logged in users and a login link … Read more