Change PHP-Code in 1.8 with Docker installation on Ubuntu

Hello all!!

I would like to change the PHP Code in a Ubuntu Docker 1.8 installation. BEFORE in 1.7.9 i did NOT use DOCKER so that i had a root folder an changed the php files in the folder, like “theme\default\html\about_text.php” or “theme\default\html\login_page.php” as needed easily. I made changes in php, css, javascript etc.

Is there any easy solution to do that with the Xibo 1.8 Docker installation on Ubuntu?

Thanks!!! Mark

Your changes should be a custom theme, not directly editing the CMS source files (which can cause errors etc), which you would then put in the shared/cms/web/theme/custom folder of your installation.

So for example, if your theme was called example, it would be in the directory shared/cms/web/theme/custom/example.

Once the theme is in that directory, you can swap to it by setting your theme’s name in the CMS Settings screen.

Once you have a theme, then that will remain in place across upgrades, whcih means you won’t have to keep making the same patches over and over at each upgrade.

Thanks for the fast answer. I read before and created a custom theme. For css adjustments i understand to use override.css in css folder. But one question: Where can I find the former i.e. “theme\default\html\login_page.php” and for example add or remove some text on the login page? How do I do that? Do I need the original source file and then customize it, copy it into the custom theme folder and it will work like overriding as the css?

In addition: Is it possible to install phpmyadmin to access the mysql db installed with docker container?

I don’t know the answer off the top of my head to your first question. @dan can probably advise when he’s free.

Re: PHPMyAdmin - yes - you would run it in its own container, and link that to your MySQL container.

You need two things. First, name of your MySQL container, which you can get by running docker ps. You need the one with cms-db in the name. Second, you need the name of the network the MySQL container is running in, which you can get by running docker network ls

In my case:

Container name: xibodocker_cms-db_1
Network name: xibodocker_default

You also need to pick a port for PHPMyAdmin to be available on. I chose 8080.

You would therefore run:

docker run --name phpmyadmin -d --network=xibodocker_default --link xibodocker_cms-db_1:db -p 8080:80 phpmyadmin/phpmyadmin

PHPMyAdmin will then be running on port 8080, and you would log in with the username cms and the password you picked in config.env.

When you’re done with PHPMyAdmin, you can simply run

docker stop phpmyadmin to stop it temporarily (and then docker start phpmyadmin to start it again if needed later), or docker rm phpmyadmin to remove it completely.

Perfect! phpmyadmin is working! Thanks.

Mark

@dan the first part of my question is quiet important for me. I am looking forward to your answer. Thanks in advance.

We’ve moved from plain HTML templates via our own custom template system to something standard called twig. You can still replace any of these twig files with your own templates and they should be easier to understand and modify.

When you create your theme config.php file, you are asked to specify a view_path, which is the folder path to somewhere inside your theme (or elsewhere) which will contain the Twig files. You would then copy the twig file you are interested in from /views into your view_path and make adjustments.

The login page you want to edit is called login.twig.

I hope this answers your question?

Yes exactly, it works easily!
I think after each xibo update i have to copy the new twig files in the views folder and change it again, or is there any other solution?

Thanks a lot!

You mean into your theme’s views folder?

You only have to copy the ones you want to override - if new files we add require overriding, then yes, you would need to copy them in there.

Or did I misunderstand your question?

No all fine, that was my question. Only the twig files i want to override. i.e. the “login.twig”. And if this will change by your team, then i have to copy the new “login.twig” into my themes/views folder and make my individual
changes again.

Yes exactly so - if you want those changes of course :slight_smile: