-
- CommentAuthorJimBamir
- CommentTimeJul 13th 2008
Hello Guys,
I have one question that bothers me for a while now. I read a few tutorials about building mvc systems and all that stuff. There aren't pretty much of them out in the net and most oft them that are there, are just confusing.
But there was one pretty good tutorial though. I copied the code and played around with it a little bit.
Now I have one problem. I don't really now how I can implement variable url's into the router. Because it calls fixed functions in the controller classes.
Here is the Link to my Code packed in a zip-file.
The Code
I would be very thankfull if somebody could help me. Maybe I can do something for you in reward ;)
regards
Jim -
-
CommentAuthorJJenZz
- CommentTimeJul 13th 2008
I havent really looked too deep into your code but it looks as though you are trying to create your own MVC system.
It might be worth taking a look at some pre-built systems such as CodeIgniter to see how they acheive this. They have a URI helper class which enables you to grab segments of the URI but not sure how they code the router to handle it. Pull it apart, maybe you'll find what you need! -
-
- CommentAuthorJimBamir
- CommentTimeJul 13th 2008 edited by JimBamir on the 13th July 2008 at 11:29:00 EDT
Thank you, I will. Any other suggestions?
€dit: It's only to have an idea how things can be done. I'll build my very own later on, for now it's only for understanding the code and how it should/could work.
Tanks everybody in advance ;) -
- CommentAuthorconartistdesigns
- CommentTimeJul 13th 2008
I havent looked into your code much either but I found this on the web. I don't have a clue about MVC System but here is what I founf
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]
this might need to go in your .htaccess file? It the words router and rewrite so I deemed it usful. lol -
- CommentAuthorJimBamir
- CommentTimeJul 13th 2008 edited by JimBamir on the 13th July 2008 at 13:08:10 EDT
I allready have that in my .htaccess file ;)
Ehm... I'm so stupid. There are variables given where the arguments are passed xD
Now i have the problem of how accessing an array. I tried it this way but it doesn't really seam to work ô.0
var_dump($this->registry['router']->args);
I learned it this way, but why doesn't it do, what it really should?
€dit: i solved the problem, no need to help anymore, thank you
regards
Jim
1 to 5 of 5
