From: Steven L. <st...@tu...> - 2004-11-02 18:32:00
|
Hello Everyone, I would like to make a suggestion to simplify links within the current 0.9.3x branch of phpwebsite. The idea is to have individual module pages in the base of phpwebsite. These pages will automatically set the module and assume a view operation to reduce the number of variables needed to request a item to be viewed. Example: pagemaster.php <?php $_GET['module'] = $_REQUEST['module'] = 'pagemaster'; if (!isset($_REQUEST['MASTER_op']) && !isset($_REQUEST['PAGE_user_op'])) $_GET['PAGE_user_op'] = $_REQUEST['PAGE_user_op'] = 'view_page'; if (isset($_REQUEST['id'])) $_GET['PAGE_id'] = $_REQUEST['PAGE_id'] = $_REQUEST['id']; include('index.php'); ?> Link before: ./index.php?module=pagemaster&PAGE_op=view&PAGE_id=1 Link after: ./pagemaster.php?id=1 Then if you want to edit: ./pagemaster.php?id=1&MASTER_op=edit_page - since the op is passed here the pagemaster.php file will not set the default op to view Old links will still work, but code will have to be updated to generate the new syntax. Thoughts? Suggestions? -- Steven Levin Computer Systems Admin I Electronic Student Services Appalachian State University http://phpwebsite.appstate.edu |
From: Shaun M. <sh...@ae...> - 2004-11-02 22:45:20
|
On 2 Nov 2004, at 18:22, Steven Levin wrote: > > Old links will still work, but code will have to be updated to generate > the new syntax. > That's the key. There needs to be a core function to generate a short url. I can't say I'm too thrilled with having lots of stubs around to pick up the short urls and calling one 'pagemaster.php' is a bit long also. ;-) Would it not be possible for index.php to convert a short url into a long one? eg. index.php?page=1 index.php?forum=1&thread=5 index.php?link=3 Each module would have to register a short url to long translation with the core. That would make mod_rewrite rules dead easy also if needed at all. I raised this in an RFE some time ago - http://sourceforge.net/tracker/index.php? func=detail&aid=857459&group_id=15539&atid=365539 The other alternative is the 'node' approach. Give every url a node number and hold a table mapping nodes to actual urls. I think that's how Drupal works. How this fits in with versioning and workflow may need investigating. Shaun aegis design - http://www.aegisdesign.co.uk |
From: Matthew M. <ma...@tu...> - 2004-11-03 15:49:52
|
I like the concept but with a few notes: 1) Mod_rewrite in 0.9.4/1.0.0 solves the long link string pretty well. This may not be needed then. 2) I don't believe it should be a 'standard'. I think it should be implemented as a shortcut. Having two versions of link creation may be confusing. 3) Creating the file on installation may be problematic as we normally only give write access to files, images, etc. If the file is not created on install, the admin will have to create it themselves. I think having a shortcut for people to link to pages and such would be cool but I would like to see it as as an added feature that doesn't require rewrites or a change in the current system. My 2 cents Kent Broc.. Matt McNaney On Tue, 2004-11-02 at 13:22, Steven Levin wrote: > Hello Everyone, > > I would like to make a suggestion to simplify links within the current > 0.9.3x branch of phpwebsite. The idea is to have individual module > pages in the base of phpwebsite. These pages will automatically set the > module and assume a view operation to reduce the number of variables > needed to request a item to be viewed. > > Example: > pagemaster.php > <?php > > $_GET['module'] = $_REQUEST['module'] = 'pagemaster'; > > if (!isset($_REQUEST['MASTER_op']) && !isset($_REQUEST['PAGE_user_op'])) > $_GET['PAGE_user_op'] = $_REQUEST['PAGE_user_op'] = 'view_page'; > > if (isset($_REQUEST['id'])) > $_GET['PAGE_id'] = $_REQUEST['PAGE_id'] = $_REQUEST['id']; > > include('index.php'); > > ?> > > Link before: > ./index.php?module=pagemaster&PAGE_op=view&PAGE_id=1 > > Link after: > ./pagemaster.php?id=1 > > Then if you want to edit: > ./pagemaster.php?id=1&MASTER_op=edit_page > - since the op is passed here the pagemaster.php file will not set the > default op to view > > Old links will still work, but code will have to be updated to generate > the new syntax. > > Thoughts? > Suggestions? -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |
From: Shaun M. <sh...@ae...> - 2004-11-03 17:03:26
|
On 3 Nov 2004, at 15:35, Matthew McNaney wrote: > I like the concept but with a few notes: > > 1) Mod_rewrite in 0.9.4/1.0.0 solves the long link string pretty well. > This may not be needed then. This presumes people have mod_rewrite installed which some hosting plans don't allow as it can be expensive on cpu time and of course it only works on Apache. Some users use .htaccess ForceType rules instead with no file extensions used and a bit of PHP so... http://www.domain.com/pagemaster.php?id=4 becomes http://www.domain.com/pagemaster/id/4/ making the url more search engine friendly if not exactly shorter. See http://www.tutorio.com/tutorial/php-alternative-to-mod-rewrite-for-se- friendly-urls for an example > > 2) I don't believe it should be a 'standard'. I think it should be > implemented as a shortcut. Having two versions of link creation may be > confusing. I don't think it would be that big a deal in practice for a user. The old links would still work and any mod using the new shorter url would just start using both. > > 3) Creating the file on installation may be problematic as we normally > only give write access to files, images, etc. If the file is not > created > on install, the admin will have to create it themselves. > > I think having a shortcut for people to link to pages and such would be > cool but I would like to see it as as an added feature that doesn't > require rewrites or a change in the current system. > Couldn't we just do this with a minor change in index.php? Add a stub in each module to encode / decode short urls and change each module as we go to call the functions to convert long urls to short ones. This is how it was done in Xaraya IIRC and each stub was almost identical unless the module did something crazy. Maybe there's some method of registering the stubs with the index needed also but nothing boost couldn't do I'd guess. We could then even lose the index.php with a really simple mod_rewrite or forcetype rule rather than some massive list. Shaun aegis design - http://www.aegisdesign.co.uk |
From: Matthew M. <ma...@tu...> - 2004-11-03 21:23:31
|
> See > http://www.tutorio.com/tutorial/php-alternative-to-mod-rewrite-for-se- > friendly-urls for an example Flash overload! I like the example, and I can code support for it even though it still requires Apache. Is there a noticeable difference in speed between letting php parse the string and letting mod_rewrite compute the link? Is mod_rewrite unpopular? The site claims: "Because doing mod_rewrite on sites with a lot of pages takes up a large amount of resources." Are they programming a rewrite on a per link basis? Currently 0.9.4 has just one rule (although admittedly it is not very flexible). > Couldn't we just do this with a minor change in index.php? > > Add a stub in each module to encode / decode short urls and change each > module as we go to call the functions to convert long urls to short > ones. > > We could then even lose the index.php with a really simple mod_rewrite > or forcetype rule rather than some massive list. I'll play around with this tomorrow. How about: www.site.com/index/pagemaster/action/view/id/4 'index' remains to call the file (is there a .htaccess hack to drop this as well?). The first parameter after the index is always the module (pagemaster). Then the script pipes the remaining parameters into key/value pairs within GET and REQUEST. The moduleLink and secureLink functions can have a switch to deliver the links in this format or not automatically. -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |
From: Shaun M. <sh...@ae...> - 2004-11-03 22:04:44
|
On 3 Nov 2004, at 21:12, Matthew McNaney wrote: > > > I like the example, and I can code support for it even though it still > requires Apache. Is there a noticeable difference in speed between > letting php parse the string and letting mod_rewrite compute the link? > I imagine it depends on the rules used. If there's significant regular expression matching then maybe a more targeted piece of PHP would be faster. > Is mod_rewrite unpopular? > More 'not standard' for cheaper hosting packages. > The site claims: > "Because doing mod_rewrite on sites with a lot of pages takes up a > large > amount of resources." > > Are they programming a rewrite on a per link basis? Currently 0.9.4 has > just one rule (although admittedly it is not very flexible). > I think it comes down to the regex. > >> Couldn't we just do this with a minor change in index.php? >> >> Add a stub in each module to encode / decode short urls and change >> each >> module as we go to call the functions to convert long urls to short >> ones. >> >> We could then even lose the index.php with a really simple mod_rewrite >> or forcetype rule rather than some massive list. > > I'll play around with this tomorrow. How about: > > www.site.com/index/pagemaster/action/view/id/4 > Better I suppose but I can't help thinking that the important info in that url is www.site.com/pagemaster/4 and the rest can be assumed for users. Even 'pagemaster' is a bit of an odd name. I'd like to see www.site.com/page4 > 'index' remains to call the file (is there a .htaccess hack to drop > this > as well?). Wouldn't you be able to replace index.php?module=pagemaster with pagemaster/ ?? > The first parameter after the index is always the module > (pagemaster). Then the script pipes the remaining parameters into > key/value pairs within GET and REQUEST. > > The moduleLink and secureLink functions can have a switch to deliver > the > links in this format or not automatically. > That's where to put it although not everybody uses moduleLink. Just a matter of getting people to change. One other thing that might be nice is some virtual links. For instance, I've an 'about' page at www.site.com/index.php? module=pagemaster&PAGE_user_op=view_page&PAGE_id=9 It'd be nice to be able to create a virtual link as www.site.com/about/ This is maybe a role for a separate module to create and manage these virtual links but perhaps it needs core help also. Shaun aegis design - http://www.aegisdesign.co.uk |
From: Matthew M. <ma...@tu...> - 2004-11-04 14:51:16
|
I am still researching this but thought I would comment further. > More 'not standard' for cheaper hosting packages. Fair enough. > Better I suppose but I can't help thinking that the important info in > that url is > > www.site.com/pagemaster/4 I am going to try and find a way to dump index.php out of the link. I don't know a lot of htaccess (the mod_rewrite stuff took me a while to understand) but I'm sure it is doable. The above link would be useful but I think it is too restrictive. There needs to be a balance for it to be useful. If pagemaster had its own personal htaccess file, then there would be no problem. It would know what to do with the '4' without further information. To do the above, we would have to dictate that the action is a user view. So: $_GET['action'] = 'view'; Unless we: if (!isset($_GET['action'])) $_GET['action'] = 'view'; So far so good. But what if pagemaster has two different view functions? One view the page, one views pictures or something. We are trapped by the format. If viewing a page was the ONLY user function we needed to account for, that would work, but I don't see that often. There are usually many different things a user can do in a module and creating htaccess rules to cover the all is complicated. Sure its shorter, but a few more variables opens up a great deal more flexibility. I don't think it is worth having complicated code or having developers write specialized code just to have a small link. Who really types links anyway? Links are clicked. I think the flexibility outweighs the tiny link format. > That's where to put it although not everybody uses moduleLink. Just a > matter of getting people to change. If we don't then you would see: if ($apache_server && $htaccess_allowed) return $small_link_format; else return $full_link_format; It would just be easier to let devs enter variables into a function and not have to worry about it. Thanks for the feedback Shaun, Matt -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |
From: Matthew M. <ma...@tu...> - 2004-11-04 15:35:09
|
Yea I am responding to my own email. I don't think you can get around having a static word (like index) to make sure that file gets called. Anyway, looking back at mod_rewrite, (which lets me dump index btw) I can do this: http://site.com/blog/view/2 This assumes 1) the first variable is the module 2) the second is the 'action' 3) the last is the 'id' Not using mod_rewrite, I could probably do this: http://site.com/index/blog/view/2 I kept the 'view' in because, again, I think people might need more flexibility. Under what I proposed earlier: http://site.com/index/blog/action/view/id/2 Not too bad. I guess the question I'm asking is how many variables do we want to force? We could state that developers have to plan around using an value with the 'action' key and the final variable is always an id with the same key name. Or we can stretch it out to the third example allowing more flexibility. Or we can stick with mod_rewrite. What does everyone think? Which as a developer would you prefer? Let me know so I can put this to bed. Thanks Matt -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |
From: Ryan R. <to...@gm...> - 2004-11-04 17:56:37
|
I don't know the difficulty involved, but as a developer, I think it would make sense that the first variable would be the module, and the rest are simply dumped into a constructor for me to deal with. http://site.com{/index}/blog/view/2 (with or without the index/) Should allow the core to create the init blog object and passes in the vars from the rest of the URL. This way: http://site.com{/index}/album/view/thumb/4/6 Will create a blog object which will specify "viewing a thumbnail from page 4, image 6" Pick your example, but basically, as long as everyone agrees that the first variable is the module, should it matter how many come after it? And perhaps more importantly, should the core really care? Just my 2 cents, Ryan Roland On Thu, 04 Nov 2004 10:27:03 -0500, Matthew McNaney <ma...@tu...> wrote: > Yea I am responding to my own email. > > I don't think you can get around having a static word (like index) to > make sure that file gets called. > > Anyway, looking back at mod_rewrite, (which lets me dump index btw) I > can do this: > > http://site.com/blog/view/2 > > This assumes > 1) the first variable is the module > 2) the second is the 'action' > 3) the last is the 'id' > > Not using mod_rewrite, I could probably do this: > > http://site.com/index/blog/view/2 > > I kept the 'view' in because, again, I think people might need more > flexibility. > > Under what I proposed earlier: > http://site.com/index/blog/action/view/id/2 > > Not too bad. > > I guess the question I'm asking is how many variables do we want to > force? We could state that developers have to plan around using an value > with the 'action' key and the final variable is always an id with the > same key name. > > Or we can stretch it out to the third example allowing more flexibility. > > Or we can stick with mod_rewrite. > > What does everyone think? Which as a developer would you prefer? Let me > know so I can put this to bed. > > Thanks > > > Matt > > -- > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Appalachian State University > Phone: 828-262-6493 > http://phpwebsite.appstate.edu > http://ess.appstate.edu > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > |
From: Shaun M. <sh...@ae...> - 2004-11-08 13:55:07
Attachments:
smime.p7s
|
On 4 Nov 2004, at 17:56, Ryan Roland wrote: > > Pick your example, but basically, as long as everyone agrees that the > first variable is the module, should it matter how many come after it? > And perhaps more importantly, should the core really care? > It'd be nice to enforce some consistency and quite possibly it may be important for cross-module links - eg fatcat, menuman Shaun aegis design - http://www.aegisdesign.co.uk |
From: Matthew M. <ma...@tu...> - 2004-11-04 17:40:59
|
I talked to Steven about mod_rewrite at lunch today and we have come to the conclusion to continue to use it. Although the mod_rewrite may be slower: 1) if speed is your concern, it can be disabled 2) it can't be any slower than having php compute the translation This is just something that people will need to accept. If you can't use mod_reroute, then you will need to go without it. Your site will be perfectly functional, you just won't be able to use short urls. Matt -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |
From: Shaun M. <sh...@ae...> - 2004-11-04 21:02:10
|
On 4 Nov 2004, at 17:35, Matthew McNaney wrote: > I talked to Steven about mod_rewrite at lunch today and we have come to > the conclusion to continue to use it. > > Although the mod_rewrite may be slower: > 1) if speed is your concern, it can be disabled > 2) it can't be any slower than having php compute the translation > > This is just something that people will need to accept. If you can't > use > mod_reroute, then you will need to go without it. Your site will be > perfectly functional, you just won't be able to use short urls. That's fair enough. I'd perhaps suggest that if we're to create a function to create the short urls, if someone wants to do it differently, they could replace the function themselves anyway. Shaun aegis design - http://www.aegisdesign.co.uk |
From: Eloi G. <el...@re...> - 2004-11-05 19:07:07
|
Hey all! I just got back off the campaign trail, so it'll take me a little while to get back up to speed... Unless I'm missing some background that happened over IRC, it looks like we're trying to re-invent the wheel here. All these ideas I've seen in the past few days were already discussed and analyzed almost 2 years ago in these same discussion lists when I was developing the mod_rewrite hack. These same theories and various versions of testcode were in turn based on ideas gleaned from discussions on the boards of various php-nuke variants going back years before that. The following quotes are from different messages in this thread. Sorry if it's kind'a confusing. >> The site claims: "Because doing mod_rewrite on sites with a lot of pages takes up a large amount of resources.<< That's if you're assigning a different name for each page. We don't have to worry about that with phpws. >> The moduleLink and secureLink functions can have a switch to deliver the links in this format or not automatically.<< The Hack contains a switch in Core.php. Just set "MOD_REWRITE_ENABLED" on line 11. >>Even "pagemaster" is a bit of an odd name. I"d like to see http://www.site.com/page4 << How about http://www.site.com/page4.html <http://www.site.com/page4> ? That's the URL that the Hack currently recognizes. The "html" extension used in the created links is there to make sure that *every* SE is fooled into thinking that this is a static site. >> That"s where to put it although not everybody uses moduleLink. Just a matter of getting people to change.<< Once mod_rewrite becomes part of the core, they'll change. >> One other thing that might be nice is some virtual links.<< mhnoyes has been asking for this for a while. It's the basic idea that Wikis work off of. I've explored doing it with Article Manager, but it really should be done as a core class. . >> I"d perhaps suggest that if we"re to create a function to create the short urls, if someone wants to do it differently, they could replace the function themselves anyway. << Again, it's already been done. The only changes that we'll want to make for 0.94 is to change the delimiter to "/". If you look back at the old discussions, you'll see that the only reason the mod_rewrite hack uses "~" as a delimiter instead of "/" is because the pre-0.94 templating code looks for all its files relatively, and therefore breaks. -Eloi George- |
From: Steven L. <st...@tu...> - 2004-11-03 21:37:56
|
Ok I'm just going to hold off on this for now in 0.9.x since we already have a solution coming in 1.0.0 and mine does not really mesh well. -- Steven Levin Computer Systems Admin I Electronic Student Services Appalachian State University Phone: 828.262.6740 http://phpwebsite.appstate.edu |