Get an element’s position with Javascript
Last month I posted how to get an element’s position relative to the document with jQuery and in this post show how to do the same thing but with native Javascript without the use of a 3rd party library.
Last month I posted how to get an element’s position relative to the document with jQuery and in this post show how to do the same thing but with native Javascript without the use of a 3rd party library.
When temporarily taking down a website to perform maintenance, it’s a good idea to return a "503 Service Temporarily Unavailable" header so search engines know to come back later. This post shows how to set this header using an Apache .htaccess file, and also how to show a response page to users with PHP so they know to try again later.
PHP’s Data Objects, known as PDO, are well covered in the PHP online documentation here but the format of the DSN connection string is covered individually for each driver so I’ve summarised them here in this post for quick reference.
If you have lost the admin login details for a SilverStripe installation and sending an email to reset the password is not working, there is a default admin account that can be enabled. After logging in, reset the regular administrator’s details and then remove the temporary login as shown in this post.
SilverStripe by default creates a directory for caching the site manifest etc by using the PHP function getSysTempDir(). It is possible to locate this directory elsewhere by simply creating a directory called silverstripe-cache in the website’s root directory, or at any other location by setting the TEMP_FOLDER constant.
There may be times when you need to know the actual location a BASH script is located within the script. This can be done with a combination of the $0 value and the dirname command.