Gallery 2 Custom file

Gallery 2 Custom file
Now that we are familiar with the layout of the Gallery 2 directory, we can begin to create our new theme. We have already made a copy of the Matrix theme folder and renamed it to the name for our new theme. For this example, the name of the new theme is dCipollo. But you can name your theme anything as long as it contains only alphanumerics and underscores. This tutorial is part of a group of tutorials about how to use the Gallery 2 software as an online portfolio. See the links below to read the previous tutorials.

The first step is to make some changes to the file. Even though we gave our new theme a name when we renamed the folder, we still need to tell Gallery that this is a different theme from the Matrix theme. To do this, we will change a few lines of code in the file. Open the file in your text editor (not in Word or another word processing editor).

Here is the code with the areas that we will change highlighted. As you can see, we are changing the name, called a theme ID, from Matrix to the name of our theme. Here is what your new code should look like.


    First we will add a line of code after line 21. We don't want to claim that this theme is anything but a customization of an existing theme by Bharat Mediratta. So we will put the text "*REVISION OF THE MATRIX THEME" on this new line. Don't omit the * in front of the text. This tells the server that the text is a comment and not part of the executable code.

  2. class dCipolloTheme extends GalleryTheme {

    On Line 29, we will use our theme name in the class code by changing MatrixTheme to "dCipolloTheme".

  3. function dCipolloTheme() {

    On line 31, we will again change the MatrixTheme to "dCipolloTheme".

  4. $this->setId('dCipollo');

    On line 34, we will change Matrix to "dCipollo".

  5. $this->setName($gallery->i18n('dCipollo'));

    On line 35, we will change Matrix to "dCipollo".

  6. $this->setDescription($gallery->i18n('REVISION MADE TO MATRIX THEME'));

    On line 36, we will add the text REVISION MADE TO MATRIX THEME as our description.

  7. $this->setVersion('1.1.1');

    On line 37, we will start our version numbering at 1.1.1.

Now we can return to the Site Admin control panel and change the default template from Matrix to our new theme.

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.