1 (edited by StevenBullen 2008-02-13 09:39)

Topic: Adding to pun_url

Will we have a standard way to add to this? as in pun_url()

Im using the following code at hook 'co_common' ... But dont think its ideal.

// Add Arcade URL rewriting scheme to standard URL rewriting scheme 
if (file_exists(PUN_ROOT.'extensions/arcade/include/url/'.$pun_config['o_sef'].'.php')) 
    require PUN_ROOT.'extensions/arcade/include/url/'.$pun_config['o_sef'].'.php'; 
else 
    require PUN_ROOT.'extensions/arcade/include/url/Default.php';

I could have one file with all the different schemes in but that is even less efficient.

Re: Adding to pun_url

What's not ideal about it?

3 (edited by StevenBullen 2008-02-13 11:16)

Re: Adding to pun_url

Ok stupid questions time.
Does it make no difference if the code was duplicated 10 times? 10 extensions adding simliar lines to above
what is bad duplication and what is not?

Im more on about the speed implications. Is there any?

Re: Adding to pun_url

I really don't understand what you're trying to get at wink
No, including 10 files should not have any significant speed impact. And the lines aren't "duplicated," they're different for each extension.

Re: Adding to pun_url

I meant as in duplicated apart from one word change.

Anyway you have answered the question and i will carry on how I was. Cheers. big_smile

Re: Adding to pun_url

Keep in mind, of course, that you should be appending to the array (or changing values in it), not replacing the entire thing with your own version.

7 (edited by StevenBullen 2008-02-13 12:02)

Re: Adding to pun_url

Yeah it adds it on the end of the array.

But im thinking instead of 4 files (Default.php, Folder Based.php) etc... to just have one. Then in that file have the 4 different schemes (simple if statement to pick up the correct one). Easier to edit more than anything. smile