TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-07-2009, 04:16 AM   #1 (permalink)
The Contributor
 
Join Date: Feb 2007
Posts: 59
Thanks: 9
Killswitch is on a distinguished road
Default URL in MVC

I have recently found and began playing around with MVC. I have a basic framework setup, the controller class, model class, an sql class, and so on. A basic app works ( well, I am just printing from the method so... ).

Anyways, the URL structure I was hoping to get "cleaner", as the current /controller/and/so/on/id/4 is not so great. Since I am new to MVC, I was wondering if you can rewrite or use PHP to rewrite these values so a URL of...

/content/view/id/5

Could be turned into...

/content/this-is-some-page

I wasn't quite sure how it would work, if it even could since the URL values are used to determine the methods called and so on.

I know Joomla does something similar, maybe very loosely based on MVC ( haven't checked out the new version ), but was wondering what you guys had to say on the subject?
Killswitch is offline  
Reply With Quote
Old 11-07-2009, 06:53 AM   #2 (permalink)
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 80
Thanks: 0
dschreck is on a distinguished road
Default

creating custom page URL's isn't that complicated. You'll just need to create a lookup system of some type, and store the look ups in a DB or in MC.
__________________
Where I Ramble: http://www.iwilldomybest.com/
What I do: Zynga Game Network
Senior Software Engineer and Lead Tech
dschreck is offline  
Reply With Quote
Old 11-08-2009, 02:11 AM   #3 (permalink)
The Contributor
 
Join Date: Feb 2007
Posts: 59
Thanks: 9
Killswitch is on a distinguished road
Default

I don't think I understand. I know how to do it with mod_rewrite, but not sure if this would totally kill the functionality of MVC ( removing things such as view/id/5 making it 5.html or whatever ).
Killswitch is offline  
Reply With Quote
Old 11-22-2009, 04:18 AM   #4 (permalink)
The Visitor
 
Join Date: Nov 2009
Posts: 4
Thanks: 0
icosytech is on a distinguished road
Default

Hi Killswitch,

Right now, I am also engaged in MVC development, you know well that index.php is the only entry point to the application, then what would be the exact problem in rewriting the URL as per your wish? But I didnt try the URL rewriting in MVC apps yet.

You have development your OWN framework right? But in my experience I am not sure that we can have strict MVC approach in PHP development. how about your framework ya?
icosytech is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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


All times are GMT. The time now is 04:49 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design