Servage Magazine

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

Articles Tagged ‘opensource’

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 ...

Auto-install popular scripts. It’s magic!

Tuesday, March 27th, 2018 by Servage
Hey, have you ever wondered why so many free scripts are complicated to setup? Why don't they always work out of the box? Exactly! It's annoying! Many Servage users think that way, and I can only agree with you. And it doesn't have to be like that. With the Autoinstaller tool in your Servage account, you can install many of the most common open source scripts within seconds. It's as simple as pressing the mouse button. The need for an Autoinstaller Most open source scripts require somewhere in the area of a few to a lot of things to setup and customize, depending on your hosting account, before it works. This is often because the developers have made ...

Start blogging in 10 minutes

Friday, February 2nd, 2018 by Servage
WordpressSo, you want to have your own blog? There are many ways to accomplish that, and lots of tools out there to help you. I would like to present Wordpress to you, which is one of the most popular, and probably one of the best, blog applications available today. Wordpress can be installed on your Servage account with just a few clicks in the Autoinstaller, whereafter it is easy to further customize your blog with your own theme, plugins/addons etc. So if you want an own blog today, read on. Installing Wordpress Login to the Servage control panel and go to "Tools > Autoinstaller". Choose Wordpress blog, and follow the instructions of the Autoinstaller. Please remember to ...

Powerful role-based access control in Yii

Wednesday, May 30th, 2012 by Servage
I would like to show a few examples on role based access control in Yii. Yii is a very robust and feature-rich opensource PHP framework, and solves many traditional problems in a clean and fully object-oriented way. Have a look at your current framework and how you use access control, then take a look at these examples for Yii: $auth=Yii::app()->authManager; $auth->createOperation('createPost','create a post'); $auth->createOperation('readPost','read a post'); $auth->createOperation('updatePost','update a post'); $auth->createOperation('deletePost','delete a post'); $bizRule='return Yii::app()->user->id==$params["post"]->authID;'; $task=$auth->createTask('updateOwnPost','update a post by author himself',$bizRule); $task->addChild('updatePost'); $role=$auth->createRole('reader'); $role->addChild('readPost'); $role=$auth->createRole('author'); $role->addChild('reader'); $role->addChild('createPost'); $role->addChild('updateOwnPost'); $role=$auth->createRole('editor'); $role->addChild('reader'); $role->addChild('updatePost'); $role=$auth->createRole('admin'); $role->addChild('editor'); $role->addChild('author'); $role->addChild('deletePost'); $auth->assign('reader','readerA'); $auth->assign('author','authorB'); $auth->assign('editor','editorC'); $auth->assign('admin','adminD'); You might have noticed that these examples are so straight forward that no detailed explanation is required, since the method names say exactly what they do. Note the use of business rules if(Yii::app()->user->checkAccess('createPost')) { // create ...

Using PHP frameworks for rapid development

Tuesday, July 5th, 2011 by Servage
frameworksWe're still seeing many users trying to build their own stuff from the ground up. While this is generally a good idea for large custom projects, with a lot of non-standard functionality, it is most likely overkill for most smaller projects. You actually don't need to reinvent the wheel with every project you start. Have a look at this earlier article that presents some PHP frameworks, which can really speed up your development. There are numerous advantages of working with a framework when creating and maintaining projects. Development work can be faster and more efficient when using a framework. It is easier to get things done, and it motivates developers to continue working. Often ...

Easy next-gen stylesheet creation with SASS

Saturday, May 7th, 2011 by Servage
SASS stands for Syntactically Awesome Stylesheets, and is an addition to CSS3. It's meant to make CSS3 generation easier and more fun. Since browser differences and complex CSS definitions have made the stylesheet creation a very complex task, SASS enables the designer to get great results fast. Some of the core features of SASS are the ability to use variables, nested rules, mixins and selector inheritance. This functionality makes CSS creation more script-like, and you get better CSS with less code. After creation, SASS uses Compass to compile your final stylesheet. This step also compresses your stylesheet to the smallest possible size, by reducing the entire file to one ...

Use CSS-based grids for website layouts

Monday, December 6th, 2010 by Servage
In the beginning of the evolution of the world wide web, we saw many websites relying on table based layouts. Actually, it was pretty genius, because it took a two dimensional table and build the layout of the website within it. However, the table had one major problem. It wasn't meant to be used like that and ruined the logic of the page. A table element should be used to represent tabular data, not layout. This is why the div and span element comes in handy today for modern css designers. These are elements you can use more freely, and still create both proper valid HTML code, and nice design. ...

How to speed up WordPress?

Friday, October 22nd, 2010 by Markus
Using WordPress? Wow cool, then this article can be very interesting for you! Can I speed up my WordPress ? Can I reduce the hit-count ? ... Yes YOU can! The first thing you can do, is to reduce the count of HTTP requests. If you  are using plug-ins, watch them carefully for inefficiencies like added CSS and JavaScript files. Combine, minify and compress these files. Some plug-ins allows you to turn off their bundled CSS file in the settings page of the plug.in. Where possible, copy the plug-ins CSS into the current theme's style.css and turn off the extra file. Also you can disable or remove plug-ins you're not using. (Only disabled plug-ins ...

Create a jQuery plugin

Thursday, September 23rd, 2010 by Servage
One of the easy ways to quickly create cool stuff in Javascript is by using jQuery. I wrote about it in an earlier article, and will now add an introduction about creating own jQuery plugins. Why? Often developers create elements that they wish to re-use in the same, or across several projects. Creating a jQuery plugin makes it really simple to do that, and still maintain a code-base for that particular function. So you don't have to copy&paste code between different files, and can develop the plugin as a stand-alone feature. I think that's very convenient. And it even makes it possible for you to share you nifty ...

Next generation YUI framework

Tuesday, March 23rd, 2010 by Servage
In the earlier article "Make rich web-applications easily" we wrote about the YUI framework, which enables you to easily add web 2.0 features to your website. The Yahoo developers have continued their quest of creating cool functionality with state-of-the-art technology, and released the next generation of their framework, called YUI3. They say "YUI 3 is Yahoo!'s next-generation JavaScript and CSS library; it powers the new Yahoo! homepage and incorporates what we've learned in five years of dedicated library development." I encourage you to have a look at the features YUI3 provides, so you can add cool features to your own framework. At the same time it is also well ...