Topic: Forums using mod_rewrite
I had to do quite a bit of modifications, but I was able to get everything working (I think).
I'd love to hear some feedback on this.
http://forums.site-reference.com
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 show off → Forums using mod_rewrite
I had to do quite a bit of modifications, but I was able to get everything working (I think).
I'd love to hear some feedback on this.
http://forums.site-reference.com
Very nice. I can imaging it would have been a lot easier if all URL's were generated by a function instead of being hard-coded into the source. I.e. instead of putting post.php?tid=$tid&qid=$qid in the source, you would call e.g. pun_url('post.php', array('tid' => $tid, 'qid' => $qid)). That way, you could do all the mod_rewrite stuff in that function. I've thought about this ealier. Maybe I'll think something up for 1.2.
perhaps just a variable that the function fetch with a global ... so people just write like this in the code
}
if($super_duper_mod)
{
//set a get variable to be used
$url_var['myid']=generate_random_user();
//lots of other code
}
//lots of code
$url_var['id']=$fid;
echo '<form action="'.pun_url('post.php').'">'; //etc...
and the pun_url function
function pun_url($url='error.php')
{
global $url_var;
$first=true;
foreach $url_var as $key=>$value
{
if($first)
{
$url .= '?' . $key . '=' . $value;
$first=false;
}else
$url .= '&' . $key . '=' . $value;
}
return url;
}
or something similar ... (heh I wrote it as I anyway needed to write one, have thought about it for a while, but never got to rewriting my little thing for it )
oh, and that rewrite you've made seems to work fine ... nice work
Thanks.
Yes, a function would make life quite a bit easier. Its the second time going through things, so it took a little less time. I did get hung up in one spot, however. When you go to the last post, why is it formated as viewtopic.php?id=3#3?
there is a '<a name="'.$postid.'"></a>' at every post, and the # is a html indicator to jump to that named position ... so a #3 at the end means it will jump to the nametag that has the value 3 ....
<div><a name="23183"></a></div>
from the source of this page ... so if you put #23183 at the end of the current url, you will jump to that post
Frank H: That is another solution, but I can't see what advantages it has. It requires two separate actions (add variables to the global array and call the function) instead of one.
Frank H: That is another solution, but I can't see what advantages it has. It requires two separate actions (add variables to the global array and call the function) instead of one.
well ... it's possible to include get tags for mods in the small code snippets the mods use, instead of needing to modify a line in the original code(and therefore making muliple mods to clash) ... but, hmm... I just figured out that you don't always want to send the same get tags on every url ... hmm... actually then your way is probably the best way to go ... or ... I'll probably extend the function alittle for me (also allowing an array in the function call)
I still don't get it :)
PunBB Forums → PunBB 1.2 show off → Forums using mod_rewrite
Powered by PunBB, supported by Informer Technologies, Inc.