Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /www/htdocs/solved/site/system/init.default.php on line 35
USOLVED - PHP Web Apps - Blog

Blog

This is about web development and nagios monitoring.

Switch from Icon Fonts to SVG Icons (example with Font Awesome)

Written from Klement

We recently switched from Icon Fonts to SVG Icons. If you stumbled upon this article you may already like to do the switch as well. If you aren't convinced head over to CSS Tricks to get a nice comparison list. The main reason for us was that we had problems when using HTTPS and Internet Explorer within a Citrix environment (and some workarounds didn't work quite well).

So we are using Font Awesome and like to use the same font library with SVG. This tutorial will show an easy way to convert all your icons to an SVG sprite and ditching Font Icons. I will show that along a little example with a menu structure and a some CSS styling.

Read whole post

Redirect HTTP to HTTPS using Apache and htaccess

Written from Klement

If you're having a SSL certificate for your website and want to redirect the visitors from HTTP to HTTPS for all pages you can do this by adding three simple rules via htaccess (mod_rewrite). You may already have a .htaccess file in the root folder of your website with some other rules. Then you can just edit this file and add the ReqriteCond and RewriteRule. Otherwise create a new file called .htaccess, add the fallowing lines to the file and upload it to the root folder of your website.

Read whole post

Backup a MySQL database and upload file to a remote FTP server

Written from Klement

Are you tired to manually backup your MySQL or MariaDB by PHPmyAdmin or shell commands? I'm. So I created a little PHP script that backups your database and optionally transfers the compressed backup to another FTP server. It's also possibled to define multiple databases and FTP servers. You can get the following example on GitHub.

Read whole post

CKEditor converts HTML entities back to angled brackets when coming from a database

Written from Klement

While trying out some syntax highlighting plugins for CKEditor (to start this new blog ;) ) I noticed that CKEditor has a problem when you like to display < and > (needed for code examples in HTML).

CKEditor handles angled brackets the right way when you create a new post and automatically converts them to their corresponding HTML entities &lt; and &gt;. But when you save the post to a database and load the content from a database (or JSON, etc.) back to CKEditor, all HTML entities for angled brackets (&lt; and &gt;) are converted back to < and >. So when you like to edit a post all the HTML examples are suddenly empty. 

But there's a workaround for this problem. Convert & to &amp; in your backend before handing over the string to the textarea of CKEditor.

//PHP example
$string = strtr($string, array(
'&lt;' => '&amp;lt;',
'&gt;' => '&amp;gt;',
));

This bug exists for a while in CKEditor and is still not fixed (by the date of this blog post).