Country detection via PHP

Imagine a example.com with some example.com/es, example.com/fr with content related to each country. One solution is a javascript-based country detector that could ask the visitor to change the current site to the most appropriate one regarding to the visitors origin. The problem with this solution is that the user needs to load the content twice, and […]




¿Qué hora es?, ¿qué color es?

Hoy os traigo algo interesante, aunque sea una chorrada como una casa. Pero bueno, para eso está el blog, ¿no? Se trata de una combinación CSS+PHP+Javascript que hace cambiar el color del cuerpo del documento de forma dinámica según la hora en la que estemos. ¿Cómo lo hace? Como ya sabemos, el color se puede […]


Dinamize the content with PHP

One way to do more dinamyc our pages, write less code and simplifying the architecture of the files is using PHP. You can use CSS3 to make the web coolest than others, but the content can be dinamized linking many files. Imagine that you have a master ‘index.php’ with a space to include the content. You […]


Insert a file with PHP

There are situations in wich we want to edit separately the content of a website instead to edit all in one file. <?php include ‘FILE.inc’; ?> For me it’s more comfortable edit the files in parts. We can make a file like this: <!DOCTYPE html> <html> <head> <?php include ‘head.inc’; ?> </head> <body> <?php include ‘body.inc’; ?> […]


Auto-updating copyright year in footer with PHP

Usually we visit some pages in which the year in the footer isn’t the current year. This recurrent problem can be easily solved replacing the current-year-place with this PHP code: <?php echo date(“Y”); ?> Simple as milk.


301 Variable Redirection with PHP

Yesterday I posted “301 REDIRECTION WITH PHP“, a mini how-to where I explained how to make a permanent redirection with PHP. But, if your case is similar to mine, that code it is not sufficient, and we must make a different redirection for each URL request. To do that in one file, you must write the […]


301 Redirection with PHP

Sometimes you might want to redirect your visitors to a new URL address. One reason you may want to do this is that the page they are trying to access no longer exists. There are 3 types of redirection, 301, 302 and 303. ‘Redirection 301’ is for that pages that are moved permanently. In PHP, […]