0

Hey there DaniWeb!

I have been working a little bit on a framework, and i've came to a little problem:(

I want my URL's to be like CodeIgniters where it'll be:

site.com/modulename/function/arg1/arg2/arg3 and so on..

and i was thinking it could be be done with something like this (pseudo-code):

$args = array();

foreach($_GET as $g) {
    if($g == "arg" . (WILDCARD / NUMBERS ONLY)) {
        $args[] = $g;
    }
}

$module = $_GET['m'];
$function = $_GET['f'];

require_once($module . ".php");

$m = new $module;

echo $m->$function(Some way to make all args in here with commas);

Could anyone possible come up with something like that? ^^

Thanks for reading, and i hope you understand my idea! :-)

3
Contributors
12
Replies
13
Views
5 Years
Discussion Span
Last Post by LastMitch
Featured Replies
  • 1
    diafol 3,720   5 Years Ago

    Have a look at this. http://stackoverflow.com/questions/2720460/how-to-rewrite-url-to-multiple-query-parameters Read More

0

@Weliaz

Could anyone possible come up with something like that? ^^

No

I have been working a little bit on a framework, and i've came to a little problem:(

How long have you work on a Framework? It's on OOP. If you are familiar with it then the code should be much easier to understand unless this is your first code you wrote or you just used someone else code and modify it.

Don't really get anything out of that:/

I thought you want to get this:

site.com/modulename/function/arg1/arg2/arg3

The link I provided does have that example in it.

0

I indeed want something like that, however the link does not provide me with any method to complete that wish.

0

@Weliaz

I indeed want something like that, however the link does not provide me with any method to complete that wish.

I'm not familiar with CodeIgniters but base on the example you provide it's missing something.

In order to get this:

site.com/modulename/function/arg1/arg2/arg3

you have to follow the instructions on this website:

http://codesamplez.com/development/codeigniter-routes-tutorial

plus read this:

http://codeigniter.com/user_guide/general/urls.html

then you will get what you want.

0

I don't think you completely understood my request.

I don't need something to integrate with CodeIgniter. I am making my very own framework, and need something like CodeIgniters URL routing.

0

OK so this is .htaccess?

site.com/modulename/functionname/arg1/arg2/arg3

relates to what?

site.com/index.php?module=modulename&function=functionname&a1=arg1&a2=arg2&a3=arg3

if so:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /index.php?module=$1&function=$2&a1=$3&a2=$4&a3=$5 [L]
0

I need both .htaccess and PHP code.

And that script ain't exactly right.

What i need is an unlimited amount of "args", which means that it won't just be arg1,2,3 but can continue forever.

I need .htaccess code for that + a PHP code to parse it.

0

@Weliaz

I need both .htaccess and PHP code.

And that script ain't exactly right.

I feel you are asking a lot.

Regarding about the mainframe. I thought you were using a mainframe. But you never mention about creating your own mainframe.

I think you need to hired someone to do this. I really doubt any DaniWeb member will take that much time provide such a code.

0

"I have been working a little bit on a framework, and i've came to a little problem:(

I want my URL's to be like CodeIgniters where it'll be:"

I think that kinda tells that i'm working on my own framework.

0

@Weliaz

"I have been working a little bit on a framework, and i've came to a little problem:(

I want my URL's to be like CodeIgniters where it'll be:"

I think that kinda tells that i'm working on my own framework.

I think your question is more vague than precise.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.