From: Honza M. <hon...@ec...> - 2003-01-02 21:53:34
|
On =DAt, 2002-12-31 at 08:36, Mitra wrote: > I'm having difficulty figuring out ways to smoothly move between=20 > different parts of a site. >=20 > I can see how in the site/sites/site_greenpages.php3 file I am=20 > looking at an existing state string, and then a new state to change=20 > to, but for example ..... >=20 > I have one state "h--1-" which is the home page, and this has a=20 > list of "Categories" on it, which are generated by a view, each item=20 > in the view wants to be a link that would wants to change the state to >=20 > m=3Ds i=3D_#SITEM_ID s=3Ds >=20 > which would be a state string of "s12345s1-" You can set the state variables by URL (as you do), or you can also add the logic into site_greenpages.php3 file. I'm not sure what {m} and {s} variable means in your case, but if the {m} allways m=3Ds when you switch from homepage, you can set create conditoin in site_greenpages.php3, where you qury old {apc} state and {s} url parameter and then it sets {m} variable. > I also have to get teh site_id into the URL, since I'm trying to=20 > avoid having a one-line HTML file that contains > <!#include /apc-aa+/module/site/site.php3?site_id=3D1a2b3c> >=20 > I can see several choices to code this, none of which are pretty .... >=20 > <a=20 > href=3D"/apc-aa+/modules/site/site.php3?apc=3Ds_#SITEM_IDs1-&site_id=3D= a1b2b3c">_#HEADLINE</a> > or > <a=20 > href=3D"/apc-aa+/modules/site/site.php3?apc=3D{state}&m=3Ds&i=3D_#SITEM= _ID&s=3Ds&site_id=3Da12b3c">_#HEADLINE</a> >=20 > (I can abbreviate these slightly to > <a href=3D"?apc=3Ds_#SITEM_IDs1-&site_id=3Da1b2b3c">_#HEADLINE</a> > or > <a href=3D"?apc=3D{state}&m=3Ds&i=3D_#SITEM_ID&s=3Ds&site_id=3Da12b3c">= _#HEADLINE</a> We use site module with a file containing only one row: <!#include /apc-aa+/module/site/site.php3?site_id=3D1a2b3c> This is not so elegant, but I think it is better than to send site_id in all urls. I think quite elegant solution is to add new database field to site table, where you spacify the domain for the site. Then we can change the site.php3 script, which will look into site table and compares site.php3 PHP_SELF uri with the new site-table field (when site_id is not supply). It is quite easy code addition). > But these aren't elegant either, and anyway {state} won't work in a=20 > View, unless I fix the code in item.php3 to look up variables in the=20 > apc_state array as well (a good idea, something I'll do unless=20 > someone says its a bad idea!) Although it would be even better if the=20 > code had been merged instead of two VERY similar syntaxes being=20 > written separately. Good idea - go ahead. > There is a hint on this somewhere (I can't find the reference at the=20 > moment) where it refers to the apc=3D{state} part being added to URLs=20 > generated by apc-aa. Yes, it apc state variable is automatically added to urls generated by alias functions (f_f, f_b, ...). > It looks to me like this code was written for a particular way of=20 > doing something, and not generalized, the trouble is I can't figure=20 > out how it was INTENDED to be used. No, it is generalized. There are at least three sites using the site module without any change a and (as I hope) without any problem: http://ecn.cz http://changenet.sk http://apc-aa.sourceforge.net/slices/index.shtml Honza PS.shouldn't this discussion be placed in apc-aa-general? >=20 > - Mitra |