background preloader

URL Rewriting for Beginners

URL Rewriting for Beginners
A beginner's guide to URL rewriting, with plenty of examples. Introduction URL rewriting can be one of the best and quickest ways to improve the usability and search friendliness of your site. There are several other guides on the web already, that may suit your needs better than this one. Apache URL Rewriting Guide - The best guide around Before reading on, you may find it helpful to have the mod_rewrite cheat sheet and/or the regular expressions cheat sheet handy. What is "URL Rewriting"? Most dynamic sites include variables in their URLs that tell the site what information to show the user. The problems with this kind of URL structure are that the URL is not at all memorable. Clearly a much cleaner and shorter URL. Now we're getting somewhere. Unfortunately, the last URL cannot be easily understood by a server without some work on our part. Platforms and Tools . Flags Conditions Related:  web dev

So You Want to Accept Credit Cards Online? Until recently, accepting credit cards on a website was expensive and complicated. But that was before Stripe: a radically different and insanely awesome credit card processing company. Today, I'll show you how to start accepting cards in 30 minutes or less - without spending a dime. Republished Tutorial Every few weeks, we revisit some of our reader's favorite posts from throughout the history of the site. Without Stripe, accepting credit cards on a website is a massive undertaking. Setup takes about five minutes. Unfortunately, it is illegal to kidnap the CEO of, slather him in barbecue sauce and drop him into a pit of honey badgers. The rest of this tutorial will detail how to implement Stripe on your website with PHP and Javascript (jQuery). We're dealing with credit card information, so of course we have to secure the user's connection to our server. Note: there is one exception. To fix this, load the image from a secure URL, like this: Security. That's it!

Big Ball of Mud Brian Foote and Joseph Yoder Department of Computer Science University of Illinois at Urbana-Champaign 1304 W. Springfield Urbana, IL 61801 USA (217) 328-3523 (217) 244-4695 Saturday, June 26, 1999 Fourth Conference on Patterns Languages of Programs (PLoP '97/EuroPLoP '97) Monticello, Illinois, September 1997 Technical Report #WUCS-97-34 (PLoP '97/EuroPLoP '97), September 1997 Department of Computer Science, Washington University Chapter 29 Pattern Languages of Program Design 4 edited by Neil Harrison, Brian Foote, and Hans Rohnert Addison-Wesley, 2000 This volume is part of the Addison-Wesley Software Patterns Series. This paper is also available in the following formats: [PDF] [Word] [RTF] [PostScript] Also by Brian Foote and Joseph Yoder Architecture, Evolution, and Metamorphosis The Selfish Class This paper was twice featured in Slashdot A number of additional patterns emerge out of the BIG BALL OF MUD. Still, this approach endures and thrives.

Encoder son site intégralement en UTF-8 Il existe deux méthodes en PHP permettant d'afficher du texte en UTF-8. Après avoir bien sûr encodé correctement tous les fichiers selon la manière décrite juste au-dessus. L'une est radicale au niveau du fichier, l'autre se fait au cas par cas, sur chaque texte à afficher. La méthode radicale consiste à mettre en première ligne de chaque fichier, un header qui va préciser au serveur de renvoyer de l'UTF-8 : header( 'content-type: text/html; charset=utf-8' ); L'autre méthode consiste à utiliser une fonction PHP autour du texte que l'on veut afficher en UTF-8 : Fonction utf8_decode() Sélectionnez echo utf8_decode( 'Ici mon texte en UTF-8' ); La différence entre les deux méthodes est flagrante. Faisons un petit test pour nous en convaincre. header( 'content-type: text/html; charset=utf-8' ); echo 'Texte accentué Dans test2.php nous mettons ce code : Ouvrons-les dans le navigateur. Mais pourquoi utf8_DEcode() alors que l'on veut ENcoder en UTF-8 ? Encodage Apache AddDefaultCharset utf-8

Understanding Event Delegation Event delegation allows us to attach a single event listener, to a parent element, that will fire for all descendants matching a selector, whether those descendants exist now or are added in the future. For the remainder of the lesson, we will reference the following HTML structure: When an anchor in our #list group is clicked, we want to log its text to the console. Normally we could directly bind to the click event of each anchor using the .on() method: While this works perfectly fine, there are drawbacks. Consider what happens when we add a new anchor after having already bound the above listener: If we were to click our newly added item, nothing would happen. Understanding how events propagate is an important factor in being able to leverage Event Delegation. <a><li><ul #list><div #container><body><html>document root This means that anytime you click one of our bound anchor tags, you are effectively clicking the entire document body!

Well-Intentioned Destruction The custom-built PHP-based content management system suffered from the classic problem of too many cooks in the kitchen. Every code file had conflicting naming conventions and coding styles, structures and duplicate methods all over the place; a Big Ball of Mud. And Dan S. was thrown head first into it. Dan was trudging through the usual drudgery of low-to-medium priority tickets, when suddenly the heavens cracked open and a Very High priority ticket descended from the sky; the first he'd ever seen. Wonderful, Dan thought, our clients can't differentiate the difference between "edit" and "delete." A few months went by, and the same thing happened. 01/25/2009 11:32:43 [Dan] Deleting page ID 108 The only way that a page could be deleted without it being logged is if something had direct database access (for example, all of the other developers on his team), or if someone had bypassed security. A Well-Intentioned Destructive Force And that's when he saw something troubling.

Cookie-less Session Variables in JavaScript This page uses cookie-less session variables in JavaScript. Refresh or navigate away from this page and click back to see the effect in operation. You have visited this page: 1 time The previous 10 visit times: Close your browser or click reset counter to restart the session. (view session dump) This JavaScript code has been created by Craig Buckler of for View the source of this file and session.js for implementation instructions. Please use the code as you wish at your own risk. Mod Rewrite Generator by The Mod Rewrite Generator can be used to turn dynamic URLs into search engine friendly static URLs. Static URLs typically rank better in search engines than long complex dynamic URLs with lots of parameters, they are easier to index in the first place and they're also friendlier looking to the end user. The apache module mod_rewrite converts urls in a certain format to another format, and can be very useful in helping a site with dynamic content to be indexed. Using this tool you can transform long dynamic URLs into short static URLs. Enter your dynamic URL and click Rewrite URL to generate your new URL: For example, you may enter the URL: On this page, the wizard will help you make your URL perfect. Look! If you satisfied with the rewritten URL, click Otherwise, customize it to fulfill your needs. Configure the Wizard to get a better URL. Select parameters that should be present in the rewritten URL. Tips and hints Enter the prefix: Congratulations!

Developing An Embeddable Javascript Widget | Shootitlive A clear trend in web development today is that sites are composed of many 3rd party widgets. Go to any big site, open up the web inspector and see how much is really loaded from the address you typed! This is great – everyone delivers one service they do well, instead of each site rolling their own half-baked version of everything from a comment system to a media player. Remember the days before Youtube? To show a video you’d have to host a media file yourself and usually just link to it and hope the user’s browser’s setup correctly; watching it was often done in a tiny, non-fullscreen’able QuickTime window. Now you just drop in a an embed code and get a full-fledged video player right on your page, together with your content. But with so many components co-existing on a page comes a number of challenges arise: The embed code must be short & concise and work with a number of CMS’s What if they interfere with each other? Our mission today We went from this: to this: Shootitlive? How we do it

jdolieslager/phped-gettersAndSetters DropzoneJs + PHP: How to build a file upload form DropzoneJS is an open source library that provides drag'n'drop file uploads with image previews. It is a great JavaScript library which actually does not even rely on JQuery. In this tutorial, we are building a multiple file upload form using DropzoneJS, and the backend will be handled by PHP. Related: DropzoneJs + PHP: How to display existing files on server Table Of Content Content 1.Preparation Download DropzoneJS from this URL. Your folder&file structure should look like this after the preparation: 2.Work with DropzoneJS Open file "index.php" and let us create a DropzoneJs form. Copy the content below to "index.php" and we will go through each line of code individually. Include the CSS Stylesheet.Include DropzoneJS JavaScript library.Create an upload form with css class "dropzone" and "action" is "upload.php". Now go to browser, and navigate to "index.php", you should be able to see a page as below: However it is not quite done yet, we will still have to code for the file uploading process.