Phpmyadmin: Extract HTML in PHP files to Twig templates

Created on 21 Dec 2018  路  45Comments  路  Source: phpmyadmin/phpmyadmin

phpMyAdmin have HTML and presentation logic in PHP files, these should be extracted to Twig templates.

Twig templates can be found at the templates directory and can be rendered like this:

/** @var PhpMyAdmin\Template $template */
$output = $template->render('template_name', [
    'first_variable' => $firstVariable,
    'second_variable' => $secondVariable,
]);
good first issue help wanted newbie refactoring

Most helpful comment

Hi there! First time contributing to phpmyadmin. I'm going to try to run the project, understand the project's collaboration process, and make some PRs regarding this issue

All 45 comments

Hi there! First time contributing to phpmyadmin. I'm going to try to run the project, understand the project's collaboration process, and make some PRs regarding this issue

Hey @thicolares, are you still working on this issue?

Hey @thicolares, are you still working on this issue?

Hi @ankitkataria! Yes, but I had to finish other things during Xmas and new year's eves. If you don't mind, I'm going to resume it this weekend. If I do not, I'll let you know.

@ankitkataria @thicolares You two can work on it. This is a big work and will hardly be closed with just one pull request.

So, you can open a pull request if you extract only a small portion of HTML to a Twig template. That way it's even easier to review and merge your pull request.

@mauriciofauth @ankitkataria Sounds great!

It is definitely a big work -- after rereading the issue, I noticed there were no specifics files in it.

I have just run the project locally using docker and skimmed the code.

I decided to start with the https://github.com/thicolares/phpmyadmin/blob/extract-html-in-view-operations-to-twig/view_operations.php file. And I created a branch to do so: https://github.com/thicolares/phpmyadmin/tree/extract-html-in-view-operations-to-twig

@mauriciofauth Should I open a PR to the master or another specific branch?

I have performed smoke tests, but I could not find any previous automatic test.

Hi Guys, It seems to be a lot of work. Can I also work on this?

@thicolares Yes, open a PR against master.

@sharik709 Yes, you also can work on it.

@mauriciofauth Thank you.

Hi, I'm gonna be working on transformation_overview.php. Once done, I should open PR against master, right?

Hi,

My name is Shumail Ahmed and I am a Computer Science student. I am in the last year of graduation. I am writing this because I would like to contribute to this project. In university, I am studying about the "Open Source" software.
My teacher has given me a task to contribute to the GitHub in any project, which relates to my interest and according to my level of skills.
I found this project and I think I will be able to contribute to this project with some online research and with your little help.

Thanks
Shumail Ahmed

Hello @sharik709 ,
Are you working on this issue? I am also willing to work alongside.

Yeah, I am working. You can pick other files. Other than the ones mentioned here. @bahl24

Hi there can I work too on this? Which file can I pick?

@aektos Yes, anyone can work on this. :smile:

@mauriciofauth Cool :) Can I pick prefs_manage.php?

Hello, I have just started to contribute in open source. I read newbie tags to start with. I want to know that can I do pull request and start working on anything random or should I go in some systematic order ? Aslo, I would like to know if there is any detailed documentation for this or i need to do brute force on this ?

@sharik709 and @thicolares are you through working on this issue? . I am willing to work alongside .

Hi @saviobosco, Great. Choose a file and post here the name of the file you are working on. So, others don't work on same file.

Happy coding :)

Hi! Is there still some files i can work on? if so, can i get an example of one that would be nice to get converted to twig?

I also did some contributions here. :blush:

@mauran there is still a lot. Just search the PHP files with '<. :smile:

Is there anything left to work on?

I also want to help on this? kindly update us if this still available, thank you :)

I would like to join too. Is all the work here completed?

It seems that this project is not active anymore

@nikkolai14

It seems that this project is not active anymore

It is still active and development is done !

And I would mention @seyfer in https://github.com/phpmyadmin/phpmyadmin/issues/14801#issuecomment-546714359

there is still a lot. Just search the PHP files with '<. :smile:

@williamdes Okay, I will going to take a look at the files then let you guys know what files I will be working on, Thanks!

Hi i would like to help with twig files. Its good to start with good-first-issues. I will be starting with master branch or please mention another branch

@tabraiz961 For this issue please use master branch

hi, I am completely new here and want to contribute to this issue and please share your suggestions with me.

@anirudhsingh20
To contribute I would recommend following

  • Fork the repository
  • Clone the fork locally into a web folder eg:/var/www
  • Checkout master branch and create a new branch from master
  • Run yarn install or npm install
  • Run composer install
  • Create a config.inc.php if needed using the example file
  • Access your phpmyadmin website and login
  • Start developing
  • Do not forget to use --signoff option to add your signoff line in the commit body, please use your real name (this option is an agreement to our policy)
  • Commit and push your changes
  • Open a pull-request to this repository, branch: master

Do you have any more questions?

@williamdes what should I do to understand file structure and codebase? is there any documentation available ?

@williamdes what should I do to understand file structure and codebase? is there any documentation available ?

Take a look

Since this is still open, I believe this is not yet complete, right? I want to join to contribute!

Hi @nikkolai14
You can contribute on this issue, we are very glad to have new contributors!

Branch: master

Hello @williamdes, I'll also contribute to this.

What is a good way to find files that need their html extracted?

I'm thinking of just looking for files that:

  • Match for html (quick and dirty regex, /<.*?>/)
  • And do not match for $template->render(), or use PhpMyAdmin\Template;

Hello @cyrialize
You can contribute on this one :+1:

maybe by searching for '< you will have most results
Your suggestions look okay

Hello, i'm new to working on other projects on GitHub. I can help with this. Do I pull a particular branch to work on this issue? How can I tell what has already been converted to twig?

Hello @britbarn
You can follow https://github.com/phpmyadmin/phpmyadmin/issues/14801#issuecomment-579408039 and use master branch.

You can tell by searching '< in the code base
Anything that looks like HTML should be into twig templates

You can have a look to #15796 that is a recent PR for this issue

libraries/classes/Database/Routines.php getExecuteForm is a good example to start with

Hi @williamdes , I have just created a pull request for this example. It's my first pull request, so let me know if I need to change the way I did it. Thanks!

Hi @britbarn !
Could you open the pull-request URL here (https://github.com/phpmyadmin/phpmyadmin/pulls) ?

You did open it on your repo: https://github.com/britbarn/phpmyadmin/pull/1

Thank you ;)

@williamdes thank you, I believe I have now submitted the pull request in the correct spot

Was this page helpful?
0 / 5 - 0 ratings