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! :-)

Don't really get anything out of that:/

Member Avatar for LastMitch

@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.

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

Member Avatar for LastMitch

@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.

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.

Member Avatar for diafol

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]

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.

Member Avatar for LastMitch

@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.

"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.

Member Avatar for LastMitch

@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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.