Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Programming With Yii2: Sluggable Behavior
May 13, 2015 @ 17:53:33

NetTuts.com has continued their series looking at programming with the Yii2 framework in this latest part of the series covering the "sluggable" behavior the framework includes.

In this Programming With Yii2 series, I'm guiding readers in use of the newly upgraded Yii2 Framework for PHP. In this tutorial, I'm going to show you how to modify Yii's default view URL routes for model objects to be more user friendly and search engine friendly. Yii provides built-in support for this via its sluggable behaviors. For these examples, we'll continue to imagine we're building a framework for posting simple status updates, e.g. our own mini-Twitter.

They start the tutorial off by defining what a "slug" is for those that may not have used them before. From there they show you how to add in the behavior to the current version of their sample application, adding a new "slug" column to their status table. They then update the status model to reflect the changes and test it out with the insert of a new update. They also show how to implement the slug handling in your routing and add the functionality to the controller to handle the different request. They finish off the post with a mention of managing permanence and uniqueness to prevent overlaps.

tagged: series yii2 framework sluggable slug functionality tutorial

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-sluggable-behavior--cms-23222

SocialGeek.be:
Clean urls through readable slugs in PHP
Jan 06, 2009 @ 20:28:16

On the SocialGeek blog there's a recent post that looks at making stubs for your URLs, making them easier to read and remember.

This is where the fun begins of course. How many times have you been confronted with someone sending you an indecipherable, thus untrustworthy link? Right, so we agree that for a user, it is important to have a clean URL that is readable and includes the title of the page or (at least) some description related to the content. Slug time!

They explain what slugs are (and how they're useful for users) as well as how to convert a title into a "slugged" string by replacing anything that's not an A-Z or 0-9 character to remove the less URL friendly characters.

tagged: clean url readable slug tutorial regular expression

Link:

Felix Geisendorfer's Blog:
Two Tutorials - Title to Slug & Dependencies with If
Oct 23, 2006 @ 18:17:58

Over on the ThinkingPHP blog today, there's two new tutorials from Felix Geisendorfer - one dealing with the conversion of WordPress titles into the "slugs" the system uses, and the other the first article he shows a method how, inside the structure of CakePHP, to make a component to grab the slug out of the URL and parse it down to the different parts of the title.

In the second, Felix demonstrates how, with some simple if logic, you can simulate dependencies. His examples include a simple if to check for the return of "true" from various functions and an inline example of an svn export and FTP.

tagged: tutorial title slug dependencies convert tutorial title slug dependencies convert

Link:

Felix Geisendorfer's Blog:
Two Tutorials - Title to Slug & Dependencies with If
Oct 23, 2006 @ 18:17:58

Over on the ThinkingPHP blog today, there's two new tutorials from Felix Geisendorfer - one dealing with the conversion of WordPress titles into the "slugs" the system uses, and the other the first article he shows a method how, inside the structure of CakePHP, to make a component to grab the slug out of the URL and parse it down to the different parts of the title.

In the second, Felix demonstrates how, with some simple if logic, you can simulate dependencies. His examples include a simple if to check for the return of "true" from various functions and an inline example of an svn export and FTP.

tagged: tutorial title slug dependencies convert tutorial title slug dependencies convert

Link:


Trending Topics: