Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-15-2010, 03:26 AM Pretty Permalinks
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
I want to start using pretty permalinks on my website. Can anybody help me out with a basic list of what needs to be done in order to achieve this.

I currently have everything routed my index.php page.

Any help would be appreciated.
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 11-16-2010, 05:54 AM Re: Pretty Permalinks
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
Are you using any cms? or custom code?

If wordpress, by default WP has the feature.
http://www.google.co.uk/search?q=wordpress+permalink
http://wphacks.com/how-to-setting-up...ink-structure/

Hope that helps.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE

Last edited by vivekar; 11-16-2010 at 05:57 AM.. Reason: added links.
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 11-16-2010, 09:40 AM Re: Pretty Permalinks
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
It will be custom code,

Im thinking about having a table of all available pages, but not sure how to handle the requests from the url and get it into the correct permalink.
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 11-16-2010, 11:55 AM Re: Pretty Permalinks
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Use $_SERVER['REQUEST_URI'] to determine how to process the request. For example if the url the user visits is:
Code:
http://yoursite.com/some-page
$_SERVER['REQUEST_URI'] will be:
Code:
/some-page
If you provide me with a permalink structure I can provide a more detailed example.


By the way this is pretty much what Wordpress does. Taking a look through wordpress' code may help out.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 11-16-2010, 04:17 PM Re: Pretty Permalinks
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
Yeah, ive tried but the wordpress code is massive.

Permalink structure would be something like /category/page-name/page-number.

For example: /news/sport/1

Last edited by evans123; 11-16-2010 at 04:20 PM..
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 11-16-2010, 04:34 PM Re: Pretty Permalinks
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
PHP Code:
print_rexplode('/''/category/page-name/page-number') ); 
yields:
Code:
Array
(
    [0] => 
    [1] => category
    [2] => page-name
    [3] => page-number
)
PHP Code:
$parts explode('/'$_SERVER['REQUEST_URI']);

$category $parts[1];
$page_name $parts[2];
$page_number = isset($parts[3]) ? $parts[3] : 1
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 11-16-2010, 05:34 PM Re: Pretty Permalinks
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
Thanks for help.
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Reply     « Reply to Pretty Permalinks
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18394 seconds with 12 queries