Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Archive for April, 2018

PHP-like in_array function in JavaScript

Monday, April 30th, 2018 by Servage
Recently I once more found myself in a situation where I really felt that I am a PHP-developer, more that a JavaScript-developer. Do you also find your self writing stuff like in_array() in JavaScript code? It happens often to me, that I take for granted in other languages, what I know and love in PHP. It also often takes quite a while to find a good alternative for missing functions in JavaScript, since Google often provides you with multiple options. One of the common functins I miss in JavaScript from PHP is in fact the "in_array"-function. Luckily there is a splendid JavaScript snippet here: function in_array (needle, haystack, argStrict) { ...

HTML parser in PHP

Tuesday, April 24th, 2018 by Servage
Are you ever struggling with HTML content in PHP? Do you need to parse a HTML source? Going through a HTML document in order to extract data might seem like a complicated, or even wrong, way of approaching a problem. Surely there must be another way... Well, sometimes other ways aren't available, sometimes the quick and dirty HTML extraction is simply the easiest way to get things done. Therefore you might find yourself in situations where a working HTML parser for PHP would be a real help. PHP Simple DOM Parser by C.C. Chen is a PHP class that does exactly what I described above. It's available from Sourceforge. It can ...

Beautiful color selection made easy

Tuesday, April 17th, 2018 by Servage
Have you ever been trying to figure out how to get the colors for your web project design to match each other? Or have you ever been stuck trying to find suitable colors for a website that should match an existing logo to integrate in the corporate identity? Color selection can be easy if you know exactly what you want, but mostly you are starting from scratch, maybe with an idea or preset main color. However, how do you define proper fitting colors to go along with the main color, to both fit the intended design and be aesthetic at the same time? Maybe you have heard of complementary colors? Being ...

Create a cool CSS-based tab-menu

Tuesday, April 10th, 2018 by Servage
We received a lot of great feedback for our CSS-based dropdown menu, so I thought it would be time for another little tutorial. This time showing how to create a nice-looking tab-menu, based purely on HTML and CSS. See a live tabmenu example here. First, we want to have the menu code created in HTML. I find that the most appropriate way of doing this, is by creating the menu as a list. Thereby non-supporting browsers will still show the menu as a list, which somewhat resembles a menu. Everyone else will see the cool tab-menu :-) <ul class="tabmenu"> <li><a href="">Overview</a></li> <li class="active"><a href="">About</a></li> <li><a href="">Products</a></li> ...

GeoIP Security

Sunday, April 8th, 2018 by Servage
geoip_wildcardsThe ServageĀ  GeoIP Security supports the use of wildcards to allow IP ranges in addition to specific IPs. This means you can allow entire blocks of IP addresses with one setting, instead of having to add each address individually. What does the GeoIP Security feature do? It enables you to restrict access to login to your Servage account based on the user's country or IP address. You find it in the control panel at "Your Account > GeoIP Login Security". Allowing specific addresses: 12.34.56.78 34.56.78.90 ... Allowing address ranges: 12.34.56.* This allows any address starting with 12.34.56 12.34.* This allows any address starting with 12.34 ... Allowing countries: Simply select the ...

Create nice documentation for your PHP code

Tuesday, April 3rd, 2018 by Servage
It's a common problem amongh developers that insufficiently or no documentation of code causes problems, delays, misunderstandings. Even code you wrote yourself could look really strange after a while, when you no longer remember what's exactly going on. At this point a good documentation could help you save time and nerves. PhpDocumentor is a good script that generates documentation for your code based on inline comments in your script files. It can generate various output formats, has different themes, and is very customizable. It only requires that you actually commend your code. You can read how to comment your code easily in the PhpDocumentor manual. There are a ...