Skip to content

RaptorJesus67/zeppCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

ZEPP CODE

Convert symbols to string to unique "Zepp Code" to create so-called "pretty-URL's"

The Zepp "Zeppelin" Code started out as a simple algorithm to switch between strings and symbols. Each symbol would have a string associated with it, as well as a "Zepp Code" counter part using the following syntax "%000#" (minus quotations, of course).

Example to examine:

Band Name: Scruffy & The Janitors

That '&' is not only ugly in the URL, but it's also reserved! So are #, %, =, etc. To fix this, use ZeppCode! ZeppCode uses three-way conversion that takes the first parameter and converts it to the second. The code allows for urls like this example.com/band/scruffyAndTheJanitors instead of this:
example.com/index.php?band=Scruffy%20%26%20the%20Janitors

Example ZeppCode

String: and
Zepp: %001#
Symbol: &

Initiation of the class is straight forward:

	# CONFIGURATION OR FILE FOR USE
require_once("path/to/file/zeppTranslate.php");
$zepp = new zeppTranslate;

File being used for the database:

	# CHANCES ARE THE MODEL FILE
$urlSegment = "scruffyAndTheJanitors";

// If included in function, either call it new, or don't forget GLOBAL
$var = $zepp->zeppCode("string", "zepp", $urlSegment);

$sql = "SELECT `col` FROM `table` WHERE `col` = '$urlSegment' OR `col` = '$var'";
// SQL Process...

After retrieving item from Database:

	# POSSIBLY THE VIEW, BUT CAN BE MODEL STILL
$name = $zepp->zeppCode("zepp", "symbol", $databaseElement);

About

Convert symbols to string to unique "Zepp Code" to create so-called "pretty-URL's"

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages