From: Bako M. <mi...@ng...> - 2021-02-23 15:11:43
|
Hi Honza, Thank you very much for the answer. You don't need to spend time on MLX right now, I can live with the trick I found, if needed. Would like to get a documentation for site module and multilanguage support, hopefully some time will be available. Do not understand how parameter handling is going on in the SEO way, I have seen that {go} is giving you the actual URL, the other variables were empty in my case. We will see. I am happy we are in contact. Have a sunny day! Misi La 2021-02-23 02:21, Honza Malik a scris: > Hola Misi, > > > nice to see you here! > > > > Hi Honza, Ariel, I hope you are doing well during these difficult times > > > We are OK with our family, I hope you all too. > > > > Tried to migrate AA site from php 5.5 to 7.2. > > > Did svn update to the last revision and updated the database. > > > Great - the last AA in SVN support PHP >= 7.2 > > > I have encountered the new site module approach, did not understand how > > > it works, how can you migrate sites using the "old way", and could not > > > find any documentation about it. > > > The "new" approach to Site Module is there from commit 2009-08-17 in > SVN - > > > / Site Module now you can use without any control-file, so you do not/ > > / need any PHP scripting at all. All you need is to select/ > > / AA_Router_Seo in "Router" field in Site Setting and specify/ > > / the slices, which are used within the Site Module. This means, that/ > > / AA_Router_Seo is now stabilized and standardized. See also new/ > > / possibilities useful here - {xid}, {xid:path}, {xid:1}, {go} and tree/ > > / posibilities of {item}/ > > > It works well for the new sites and we use it from that time. The > documentation is not in good shape for it, but if you are interested, I > will prepare some example. > > > On the other hand, we are trying to be as backward compatible as > possible, so the old sites should work in new AA as well. We still run > some sites based on that older approach with the most current AA. > > > The rewrite of the site from old to new approach is not trivial and > I would go for it only in the case of redesign of the whole site. > > > > For the time being I had to stick to the old ways - start feeling like > > > in some old, burned out gunman character from a western movie :-) - here > > > is my experience, if anybody needs it: > > > > > > location: apc-aa/modules/site/sites > > > file: > > > > > > Found that the ereg() function used here is out of php 7, found > > > suggestion of using preg_match() instead. > > > Right - ereg is gone in php7. One of the advantage of the new sitemodule > is, that you do not need external php script, so all php code is managed > and updated be AA. > > > > # previous php 5.5 version > > > > > > if( ereg( > > > > "^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-]) > > > ([a-zA-Z_]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)", $apc, $vars )) > > > > > > > list($old_state,$old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t,$old > > > _x) = $vars; > > > > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > > > > The problem is that preg_match() is creating two dimensional array, and > > > the syntax is a bit different. Need to use differently the list > > > function, 2 versions below: > > > > > > (need to be adapted to the state variable structure used) > > > > > > # ======================================================= > > > # replacement for PHP 7+ > > > # v. 1 > > > > > > if( preg_match( > > > > '"^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-] > > > )([a-zA-Z_-]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)"', $apc, $vars, > > > PREG_OFFSET_CAPTURE )) { > > > > > > > list($old_state,$old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t,$old > > > _x) = $vars; > > > $old_state = $vars[0][0]; > > > $old_w = $vars[1][0]; > > > $old_s = $vars[2][0]; > > > $old_f = $vars[3][0]; > > > $old_l = $vars[4][0]; > > > $old_a = $vars[5][0]; > > > $old_r = $vars[6][0]; > > > $old_p = $vars[7][0]; > > > $old_t = $vars[8][0]; > > > $old_x = $vars[9][0]; > > > } > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > # ======================================================= > > > # replacement for PHP 7+ > > > # v. 2 > > > > > > if( preg_match( > > > > '"^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-] > > > )([a-zA-Z_-]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)"', $apc, $vars, > > > PREG_OFFSET_CAPTURE )) > > > > > > list( list($old_state, ),list($old_w, ),list($old_s, ),list($old_f, > > > ),list($old_l, ),list($old_a, ),list($old_r, ),list($old_p, > > > ),list($old_t, ),list($old_x, ) ) = $vars; > > > > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > # ======================================================= > > > This second one looks more sophisticated & PHP like, however I feel like > > > it is to complicated structure to be efficient, I don't know the inner > > > workings of PHP, can not decide which one is faster on execution. > > > > > > Anyway probably there was some sick mind coming up with this syntax of > > > the list function, to use blank space for parameters to skip (embedded > > > list structure). Looks like broken code to me. I still prefer C as a > > > programming language :-) . > > > There are two examples of this older sitemodule approach in the > > /modules/site/sites/ directory. The examples are addapted to PHP 7,2 and > should be OK. > > > One approach is in site_ecn_as_example.php3: > > > if ( preg_match( > "/^([a-zA-Z0-9_])([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z_]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)/", > $apc, $vars )) { > > list($old_state,$old_w,$old_s,$old_f,$old_r,$old_p,$old_t,$old_x) = > $vars; > > } else { > > list($old_w,$old_s,$old_f,$old_r,$old_p,$old_t) = ['z', 'z', 'v', > 'x', '-', '-']; > > } > > > Another - site_greenpages.php3 - uses the built-in function ModW_str2arr() > > > $apc_varnames = "tpmiuvw"; //TODO replace with "tpmih*" > > $apc_reg = > "^([-pe])([-]|[0-9]+)([hbsfcCt])([-]|[0-9]+)([hbsfcCt][-0-9]+)*"; > > $apc_init = '--h-s-'; > > $apc_state = ModW_str2arr($apc_varnames, $apc, $apc_init, $apc_reg); > > > > > ------------------------------------------------------- > > > the MLX / add / edit item form problem: > > > > > > I am using MLX for multiple languages. The "Edit <language>" tab works > > > on existing items. However if I want to add another item on ther > > > language, and select "Add <language>" tab, it is generating a blank Add > > > item form of another slice, perhaps the first slice of the database. > > > > > > Also when I select the last button (abort or cancel, mine is in > > > romanian) also jumps back to the other slice item list (not always > > > though). If I coming out of the form with the "Update" (first) button, > > > it behaves normally. Today just logged in again, fresh start, and went > > > in, this time left the form normally with Cancel button. Strange. > > > > > > I noticed that the link ends in the & character when you hover above the > > > Add <language> link - like some parameter is missing. Found that if I > > > add module ID at the end, the Add form is generated but blank, the data > > > from the corresponding item on another language is not copied, and > > > language field is filled with random values, like Norwegian, Japanese, > > > Russian, etc. which I never use. > > > > > > example: > > > > > > Original link: > > > > https://site.ro/aa/admin/itemedit.php3?encap=false&add=1&mlxl=HU&mlxid=4e5b4 > > > d4073eb2e9f937d5cf72934d819& > > > > > > Altered link generating the blank page: > > > > https://site.ro/aa/admin/itemedit.php3?encap=false&add=1&mlxl=HU&mlxid=4e5b4 > > > d4073eb2e9f937d5cf72934d819&module_id=fd49721e08b3ad1ffca8211b1dbdee1b > > > > > > After added new item - need to care about the language selection field, > > > otherwise strange things are happening - things are back to normal, you > > > can edit and save normally, MLX does its job and item is properly > > > displayed in the site. > > > Well MLX. I must say we are not using MLX extension on any of our sites, > so it is quite difficult for me to test it. There is already another > translation approach in current AA which we use. The MLX extension is > still in AA and we are trying to update is to newer PHP, but it is no > longer maintained by Michael Moritz and not much tested. I can take a > look on it if you give me access to your AA and AA files in the server... > > > Best, > > Honza > > > > Dne pondělí 22. února 2021 14:04:46 CET, Bako Mihaly napsal(a): > > > // apparently I'm off the list, resubscribed with mi...@ng... > > > > > > Hi guys! > > > > > > Have not seen much talk on this list, hopefully I am still on it. > > > > > > Hi Honza, Ariel, I hope you are doing well during these difficult times > > > - Cc:-d this to you as well just in case. > > > > > > Tried to migrate AA site from php 5.5 to 7.2. > > > > > > Did svn update to the last revision and updated the database. > > > > > > I have encountered the new site module approach, did not understand how > > > it works, how can you migrate sites using the "old way", and could not > > > find any documentation about it. > > > > > > For the time being I had to stick to the old ways - start feeling like > > > in some old, burned out gunman character from a western movie :-) - here > > > is my experience, if anybody needs it: > > > > > > location: apc-aa/modules/site/sites > > > file: > > > > > > Found that the ereg() function used here is out of php 7, found > > > suggestion of using preg_match() instead. > > > > > > # previous php 5.5 version > > > > > > if( ereg( > > > > "^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-]) > > > ([a-zA-Z_]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)", $apc, $vars )) > > > > > > > list($old_state,$old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t,$old > > > _x) = $vars; > > > > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > > > > The problem is that preg_match() is creating two dimensional array, and > > > the syntax is a bit different. Need to use differently the list > > > function, 2 versions below: > > > > > > (need to be adapted to the state variable structure used) > > > > > > # ======================================================= > > > # replacement for PHP 7+ > > > # v. 1 > > > > > > if( preg_match( > > > > '"^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-] > > > )([a-zA-Z_-]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)"', $apc, $vars, > > > PREG_OFFSET_CAPTURE )) { > > > > > > > list($old_state,$old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t,$old > > > _x) = $vars; > > > $old_state = $vars[0][0]; > > > $old_w = $vars[1][0]; > > > $old_s = $vars[2][0]; > > > $old_f = $vars[3][0]; > > > $old_l = $vars[4][0]; > > > $old_a = $vars[5][0]; > > > $old_r = $vars[6][0]; > > > $old_p = $vars[7][0]; > > > $old_t = $vars[8][0]; > > > $old_x = $vars[9][0]; > > > } > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > # ======================================================= > > > # replacement for PHP 7+ > > > # v. 2 > > > > > > if( preg_match( > > > > '"^([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-])([a-zA-Z0-9_-] > > > )([a-zA-Z_-]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)"', $apc, $vars, > > > PREG_OFFSET_CAPTURE )) > > > > > > list( list($old_state, ),list($old_w, ),list($old_s, ),list($old_f, > > > ),list($old_l, ),list($old_a, ),list($old_r, ),list($old_p, > > > ),list($old_t, ),list($old_x, ) ) = $vars; > > > > > > else > > > list($old_w,$old_s,$old_f,$old_l,$old_a,$old_r,$old_p,$old_t) = > > > array( 'i', '-', '-', 'r', 0, '-', '-', '-'); > > > > > > # ======================================================= > > > > > > This second one looks more sophisticated & PHP like, however I feel like > > > it is to complicated structure to be efficient, I don't know the inner > > > workings of PHP, can not decide which one is faster on execution. > > > > > > Anyway probably there was some sick mind coming up with this syntax of > > > the list function, to use blank space for parameters to skip (embedded > > > list structure). Looks like broken code to me. I still prefer C as a > > > programming language :-) . > > > > > > ------------------------------------------------------- > > > the MLX / add / edit item form problem: > > > > > > I am using MLX for multiple languages. The "Edit <language>" tab works > > > on existing items. However if I want to add another item on ther > > > language, and select "Add <language>" tab, it is generating a blank Add > > > item form of another slice, perhaps the first slice of the database. > > > > > > Also when I select the last button (abort or cancel, mine is in > > > romanian) also jumps back to the other slice item list (not always > > > though). If I coming out of the form with the "Update" (first) button, > > > it behaves normally. Today just logged in again, fresh start, and went > > > in, this time left the form normally with Cancel button. Strange. > > > > > > I noticed that the link ends in the & character when you hover above the > > > Add <language> link - like some parameter is missing. Found that if I > > > add module ID at the end, the Add form is generated but blank, the data > > > from the corresponding item on another language is not copied, and > > > language field is filled with random values, like Norwegian, Japanese, > > > Russian, etc. which I never use. > > > > > > example: > > > > > > Original link: > > > > https://site.ro/aa/admin/itemedit.php3?encap=false&add=1&mlxl=HU&mlxid=4e5b4 > > > d4073eb2e9f937d5cf72934d819& > > > > > > Altered link generating the blank page: > > > > https://site.ro/aa/admin/itemedit.php3?encap=false&add=1&mlxl=HU&mlxid=4e5b4 > > > d4073eb2e9f937d5cf72934d819&module_id=fd49721e08b3ad1ffca8211b1dbdee1b > > > > > > After added new item - need to care about the language selection field, > > > otherwise strange things are happening - things are back to normal, you > > > can edit and save normally, MLX does its job and item is properly > > > displayed in the site. > > > > > > This is my 2c. > > > > > > Have a nice day! > > > > > > Best, > > > > > > Misi > > > Strawberrynet Romania > > > > > > > > > > > > _______________________________________________ > > > "Did you get answers to your ActionApps-related queries? If yes, please > > > help the ActionApps community by uploading the answers onto appropriate > > > space in the ActionApps documentation wiki. See the *How to contribute* > > > section today http://actionapps.org/en/How_To_Contribute" > > > _______________________________________________ > > > apc-aa-general mailing list > > > apc...@li... > > > https://lists.sourceforge.net/lists/listinfo/apc-aa-general > > > |