This is a techy how-to article about measurements related to div locations and dimensions.
Listing all the reasons to know the information would be a long list. Getting the dimensions of a div element for use when centering the div within the viewport is one reason. It is also how I used it just yesterday.
There are various ways to try to determine the location of a div in the viewport (browser window, generally, but might also be an iframe). Similar to its dimension, there are various ways to determine the width or the height of a div.
The ways are JavaScript methods. PHP doesn't work for this functionality because PHP runs before the web page is loaded into a browser window.
The JavaScript function I prefer to use provides the viewport location and the dimensions of a div all in one function call. getBoundingClientRect is the name of the function.
At Willmaster and some other sites, we use a site-wide One Login System. The system can protect any directory that contains a customizable .htaccess file.
How the One Login System Works
There is one log-in page. After logging in, a cookie is set.
Directories are protected with entries in the .htaccess file. If the cookie is set, the browser is allowed to access the directory. Otherwise, the browser gets a "not authorized" message.
Why?
For Willmaster.com, we use the One Login System to protect various scripts on the domain. The Possibilities emailing software is an example. Others are syndication, web content updating, server monitoring, and backup software.
Some of those are in separate directories. Some share the same directory. So long as the directory has the customized .htaccess file, we're good.
For better security, either or both the username and the password may contain embedded spaces.
The source code provided in this article is an updated version of what we are using. It was updated for easier customization and to allow more than one username/password set to be specified. (With a separate username for each person allowed access, removing a username later won't affect anybody else's log-in.)
If you program in PHP, you know it is a fairly common need to peek into variables and see what they contain. It can be especially needful when one is chasing a bug.
If you have programmed with PHP for a long time, you no doubt have developed ways to view the content of variables without affecting the flow of the software's execution.
Here is another way, or perhaps a way you are already using. This method publishes the variable name, its length, and its content on the web page. The dumped information can be viewed on the web page where the PHP is running.
As a programmer, you are likely to be tasked with reading and writing CSV files.
CSV (Comma-Separated Values) used to be the most popular format for data files compatible with various types of software. It may still be the most popular. Other popular formats are XML and JSON. This article is dedicated to CSV.
If you are not a programmer, you may want to skip this article.
But if you are a programmer, I'll describe how to read and write CSV files with PHP.
I'll first describe how to write a CSV file. Then, how to read it.
JavaScript can be used to tell the browser to forget it ever displayed the current page and to load another page in the same window. If the browser's "back" icon works at all, it will skip over the current page.
The technique may be applied to, as examples:
Removing a log-in page from history so the "back" icon won't work. This would prevent the browser from backing up and automatically refilling the form fields like they were before.
A one-guess quiz. When the response is selected, the browser takes the user to the next page to see if they won (or whatever). The browser won't back up to the page one-guess page for the person to try to change their response.
Methods GET and POST both refer to how the browser sends information to a web page.
Most people don't need to know what method their browser uses when requesting data. Even as a site developer, it isn't often that a choice needs to be made between GET and POST methods.
Yet, when you do need to make a choice, it is good to know what it is you are choosing.
When you wish to rotate text or an image 360°, perpetually, consult this article for a basic how-to.
Only HTML and CSS are used.
No JavaScript is required for this functionality.