- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I am working on a simple CMS now, i have made post-new-page form, if i click “submit” button, the content will be saved into the database, by the same time i want the PHP script automatically create new folder in my root folder (i’m not sure whether it’s correct to create inside my root folder?)
This is [the example](http://www.mactricksandtips.com/2013/03/speed-up-your-mac-by-solving-disk-errors-and-problems.html “example”).
As you can see, the article’s URL (http://www.mactricksandtips.com/2013/03/**speed-up-your-mac-by-solving-disk-errors-and-problems**.html) equals to the article’s title (Speed Up Your Mac By Solving Disk Errors And Problems).
How do i achieve this? Thanks in advanced.
You can do this manually with PHP. This is called a slug.
Basically, all you have to do is switch it to lower case, remove special chars and replace spaces by dashes. :)
[Here](http://stackoverflow.com/questions/2955251/php-function-to-make-slug-url-string) is something that should help you.
There is a great script on github: [BaconStringUtilsSlugifier](https://github.com/Bacon/BaconStringUtils) (you don’t need to use Zend to use the classes in `/src`.
It does not only convert chars like `ö` to `o` but also `北亰` to `Bei Jing`, according to the readme (slugified that would be `bei-jing`)… You never know, right? ;)
You then need to redirect requests to a common landing page (probably just `/index.php`, using .htaccess), read out the slug and query that page from a database (in which you have an indexed ‘unique, which is an index’ column with the slug to make queries fast).
The `html` extension in your example doesn’t mean there is an actual html file.
search in developphp.com , they got what you want.
thank you for all the answers guys!
digesting the explanation…..
reading all the links……:)