From: matt <ma...@tu...> - 2008-02-12 15:33:43
|
Verdon Vaillancourt wrote: > So, > > In a simple case then, like this from my index.php file... > > PHPWS_Core::initModClass('podcaster', 'Podcaster.php'); > $podcaster = new Podcaster; > if (isset($_REQUEST['aop'])) { > $podcaster->adminMenu(); > } elseif (isset($_REQUEST['uop'])) { > $podcaster->userMenu(); > } elseif (isset($_REQUEST['id'])) { > $podcaster->userMenu('view_channel'); > } else { > PHPWS_Core::home(); > } > ... all I need to do is change $_REQUEST['id'] to $_REQUEST['var1'] This is what I am doing in Blog (slimmed down): ------------------------------------- if (isset($_GET['var1'])) { Blog_User::fillInForward(); } if (isset($_REQUEST['blog_id'])) { $blog = new Blog($_REQUEST['blog_id']); } function fillInForward() { $_REQUEST['blog_id'] = (int)$_GET['var1']; } -------------------------------------- The reason is that the blog_id may be sent from other places than just a straight up call to the item. This method would prevent you from: 1) having to fix any other links you have where you are passing 'id' 2) having to check for var1 and/or id 3) prevent extra processes if mod_rewrite is not being used > How would this be changed? > PHPWS_Text::rewriteLink($channel->title, 'podcaster', $this- > >channel_id); It would be the same. It would return: $channel->title = 'sample'; $this->channel_id = 4; <a href="index.php?module=podcaster&var1=4">sample</a> But now you could call: PHPWS_Text::rewriteLink($channel->title, 'podcaster', $this->channel_id, $this->page_id, $this->section_id, $this->etc_id); You can have as many vars as you need. Thanks, Matt > > Thanks, > verdon > > > On 12-Feb-08, at 9:47 AM, matt wrote: > >> Good day, >> >> phpWebSite 1.5.0 will change the way it handles mod_rewrite. The >> .htaccess file will filter all requests that do not match a >> directory or >> file to the index.php file. The index.php file includes a new core >> file >> named Forward.php. phpWebSite then detects if the mod_rewrite >> format is >> getting used. If so, it writes the following variables: >> >> $_REQUEST['module'] = $variable_1; >> $_GET['var1'] = $variable_2; >> ... >> $_GET['var' . $n] = ${'variable_' . $n}; >> >> >> So this address: >> http://phpwebsite.appstate.edu/blog/2008/1/4 >> >> Will create: >> >> $_REQUEST['module'] = 'blog'; >> $_GET['var1'] = 2008; >> $_GET['var2'] = 1; >> $_GET['var3'] = 4; >> >> The updated blog module looks for this and changes the vars into year, >> month, and day for a new viewing preference. >> >> Access will no longer store the shortcuts in the .htaccess file. >> Instead, if the only variable passed is not a module, it is assumed to >> be a title. This will be passed to Access which will pull the >> appropriate key and then fill in the $_GET variable with the >> appropriate >> module and overwrite var1. This will be done instead of a forward to >> prevent losing the url. >> >> In the long run, this will allow module creators to mold mod_rewrites >> however they like. In the meantime, you will need to change your 'id' >> and 'page' checks to 'var1' and 'var2'. This change will also >> affect the >> rewriteLink function in Text.php. >> >> The next release of phpWebSite will go through an RC period. This >> should give you time to adjust your modules for this change and the >> updated File Cabinet. If you have any concerns, please reply to >> this list. >> >> Thanks, >> Matt >> >> >> -- >> Matthew McNaney >> Electronic Student Services >> Appalachian State University >> Ext. 6493 >> http://ess.appstate.edu >> http://phpwebsite.appstate.edu >> >> ---------------------------------------------------------------------- >> --- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Phpwebsite-developers mailing list >> Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers -- Matthew McNaney Electronic Student Services Appalachian State University Ext. 6493 http://ess.appstate.edu http://phpwebsite.appstate.edu |