andrzuk / FineCMS

PHP application using my own MVC architecture and PDO database interface.
http://my-notes.pl
15 stars 5 forks source link

Suggestion and solution for admin page when user on site #4

Closed danfolt closed 2 years ago

danfolt commented 7 years ago

When user onsite, some GroupElement are hidden, I wanted hide also div class="GroupElements" in order to not confuse users with empty section names -inight2222

I have ordered solution on fiverr, so I don't know if it is PHP correct, if you want Andrzej it works, it hides GroupElements too when empty, so update also your script because I think that users should be confused with empty div of system management etc

screenshot- domain - date - time

andrzuk commented 7 years ago

Yes, it is good idea to hide groups when all their elements are hidden. I just applied this solution.

danfolt commented 7 years ago

I've copied Your admin solution, looks much more better, and thanks for new aside panel, very helpful, I myself probably will use this snippet and will create another somewhere else, for the moment I don't see any other issues, before I launch the site I am going to implement 2-3 new features, new PayPal module for users who after payment will gain monthly access to some of the USER's, OPERATOR sections of the site by updating user_roles table function_id from zero to one, I've already speak with some people who would help me, so I will let You know in case you like it, next and this I would like to speak with You before (to know Your opinion, on the internet there are plenty multilingual solutions, I have found also one very easy for MVC, many of them doesn't seem to be difficult at all, before I choose which way to go, I was only wondering if you were ever thinking about multilingual and which approach You would go (strings memorized in database, json, En_en files with arrays, gettext, switch language button in user admin preferences or MaxMind Geo redirect or using both etc ). many people prefer arrays, it's simple and they say maintaining fast performance, what I didn't like was that most of them use for every translated string some kind of echo statement, I've noticed that You don't use echoe's at all, if you have ever seen some tutorial somewhere please send me a link I would make an request and implement it, last feature was INFO aside module with user's online which I've noticed on your MySQLi websites, I don't remember where I think Catalogue, I wanted to ask You if this fully works if this shows also user's usernames in the sidebar(feature I like most) then I would rewrite it also for PDO and FineCMS, please if You can let me know Your opinion on localization, multilingual, for me is important before I start, to do not to go wrong way, there are many solutions, I have already a lot of ideas, but I would like to know the one which best fit FineCMS, fast performance, easy integration, etc. Thanks

andrzuk commented 7 years ago

Multilingual solution should be based on database and kept in one table (StringID, Value_EN, Value_GE, Value_IT, Value_FR, Value_PL). Switching between languages would be accessible on top of site - for every visit guest. But this solution requires a lot of work - prepare all strings in few languages and replace all strings in source code (even buttons labels, links etc.) with strings loaded from database.

danfolt commented 7 years ago

Changing strings it is my work, most of strings are as 'caption' => 'New Article', so if the string will have to be something like 'caption' => $lang['new_article'] this is 1-2 days work for me changing all files. With Find all and Replace all as I did with all files at time from polish to english it will last even less. I would have to change all or most of them anyway(whatever way I choose). Thanks for idea I' ve seen similar idea on stackoverflow, so I will reread it and check it out, DB idea I like more because to translate, edit we can use admin panel in future, similar way as editing config keys.

andrzuk commented 7 years ago

Yes, but $lang[] array must be loaded from database. You can, of course, fill $lang[] array just in source code, but it wouldn't be manageable from Admin Panel.

danfolt commented 7 years ago

What would be the best solution in the source to be manageable from Admin Panel (in future) ? If I would use it with database, I would like also use powerful admin panel to make edits there, (after creating all languages values in excel and inserting all of them in batch), having already nice admin sections should be also nice to do not need to edit it in phpMyAdmin anymore using Admin list on the left and simple inputs on the right, or clicking on every default string in the list and opening 5 inputs in 5 languages. I thought that every column from database should be editable independently wherever I want if I want to(only updating data)

andrzuk commented 7 years ago

Suppose such solution. We create table 'translations' in our database. In this table we keep translations for all site elements in all supported languages. In table every row is dedicated for one site element (link, button caption etc.) and every column is dedicated for one language.

danfolt commented 7 years ago

Yes that part of localization (database table with 5 -6 fields table (StringID, Value_EN, Value_GE, Value_IT, Value_FR, Value_PL) I understood very well, database table with translations I will prepare alone without a problem, then there should be some mechanism not easy to understand for me (lets say in application.php or in new file lang.php telling to some strings lookup in database (this part is time consuming, but not a problem for me, because I have a time and i like those things (working with editors, find and replace and also manually or datamystic's TextPipe should be perfect for it) if I will know the correct string, variable, array which will replace 'caption' => 'New Article' with some 'caption' => %VariableNew_ArticleLookingForStringIDinDatabase%

andrzuk commented 7 years ago

Solution could look like this: $caption = $translation->get_text($text_id, $_SESSION['language']); in every place where any text appears.

danfolt commented 7 years ago

Excellent. Thank you . That I wanted to know. Next week I will start to work on this.