background preloader

PHP for Beginners: Building Your First Simple CMS

PHP for Beginners: Building Your First Simple CMS
By Jason Lengstorf On CMS, php #The Magic of PHP + MySQL It's safe to say that nearly every website that's up-to-date these days is using some form of content management system (CMS). To get our feet wet as back-end developers, we'll be creating a simple PHP class that will: Create a databaseConnect to a databaseDisplay a form with two fieldsSave the form data in the databaseDisplay the saved data from the database Download Files This class is intended to give you a feel for how PHP and MySQL interact together, and to show the basics of a CMS. #Building the Class Our first step is to simply lay out the class in a file named 'simpleCMS.php' so we have a road map to work with. As you can see, we're creating one class with four variables and five methods. #The Variables In this case, all four variables are for connecting to the database: $host, $username, $password, and $table provide a path and access to our database on the server. #Build the Database #Connect to the Database #Build the Form <! <?

CSS3 @font-face Design Guide Although CSS3 @font-face is supported by most major browsers (IE, Firefox, Chrome, and Safari), but not all. When it doesn't, your custom fonts might break the layout or come out with undesired results. In this article, I will explain the common issues with using custom fonts, picking the matching fallback web safe fonts, and how to create a perfect fallback font style with Modernizr. Common Mistake One common mistake that most people make when implementing custom fonts is not specifying the fallback fonts or picking the wrong fallback fonts. Web Safe Fallback Fonts When using custom fonts, it is important to include the web safe fonts as fallback. Layout Issues Because every font face has its own width, height, weight, kerning (letter-spacing), etc., some fonts are not substitutable with the web safe fonts. This might causes layout issues as shown in the image below where the fallback font extends off the boundary. Modernizr Fallback Font Styles With Modernizr (demo) Including Modernizr

Hakim's projects 10 CSS Rules Every Web Designer Should Know Through experience as web designers we memorise all kinds of code syntax, hacks and snippets. With CSS in particular there is a number of rules and declarations that can really help transform your website designs and open up new possibilities when compared to older techniques. This post rounds up 10 declarations and tips that every web designer should have available in their CSS arsenal. @media screen and (max-width: 960px) { } The @media rule not only allows you to specify styling for your web page when printed. A cool and extremely useful CSS3 property that has now gained thorough browser support is background-size. One CSS3 property that has really helped transform the web over recent years is @font-face. The clever margin: 0 auto; declaration is one of the first snippets you learn when getting to grips with CSS. For those float clearing situations where overflow: hidden; doesn’t work, the best alternative is the clearfix technique.

Related: