My theme doesn't work properly on PHP7.1 and higher My theme doesn't work properly on PHP7.1 and higher
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

My theme doesn't work properly on PHP7.1 and higher

Started by KchoPrro, September 13, 2022, 07:53:02 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

KchoPrro

Hello friends, I would like to know what my gallery would need to be able to work with Php 7.6 or Php8. Apparently, I am using an old version of Php on my hosting but I have tried to update to higher versions but the gallery does not display well, it does not even display.

I put some screenshots with different versions of Php.

I have discovered that it is a problem with my theme, when I use the "curve" theme or any other integrated in CPG, everything is displayed correctly.

With PHP8 and 8.1 I see other problems even with "curve", related to the BBCode Control or Minicms plugins, but I'd be happy if my theme could at least work on PHP7.4. Any idea of the problem?

In PHP version 7.1-7.4, I get the following message if I enter directly:

QuoteFatal error: Uncaught ArgumentCountError: Too few arguments to function CPGPluginAPI::filter(), 1 passed in /galeria/themes/chaoticsoul/theme.php on line 1061 and at least 2 expected in /galeria/include/plugin_api.inc.php:156 Stack trace: #0 galeria/themes/chaoticsoul/theme.php(1061): CPGPluginAPI::filter('theme_thumbnail...') #1 /galeria/include/functions.inc.php(3166): theme_display_thumbnails(Array, '978', '\xC3\x9Altimas subida...', 'lastup', 0, 1, 245, false, false, 'thumb', NULL) #2 /galeria/index.php(1164): display_thumbnails('lastup', 0, 1, '4', 1, false) #3 {main} thrown in /galeria/include/plugin_api.inc.php on line 156

I guess that is the source of the problem  :'(.

KchoPrro

In debug mode I get these errors:

Quote
/themes/chaoticsoul/theme.php

    Warning line 31: Use of undefined constant album - assumed 'album' (this will throw an Error in a future version of PHP)
    Notice line 31: Trying to access array offset on value of type null

/admin.php

    Notice line 174: Undefined index: alb_desc_thumb
    Notice line 513: Undefined index: alb_desc_thumb


I don't know if they have anything to do with the problem  :-\.

ron4mac

Quote from: KchoPrro on September 13, 2022, 07:53:02 PM
In PHP version 7.1-7.4, I get the following message if I enter directly:

In the theme's theme.php file, replace line #1061 with:
    $wrapper_start = CPGPluginAPI::filter('theme_thumbnails_wrapper_start', null);

KchoPrro

Quote from: ron4mac on September 13, 2022, 10:35:13 PM
In the theme's theme.php file, replace line #1061 with:
    $wrapper_start = CPGPluginAPI::filter('theme_thumbnails_wrapper_start', null);

Thanks ron4mac, now the last uploaded photos appear (lastup), but the menu (sidebar) still does not appear, it only appears when we enter an image. Random images are also not displayed.  :-[


ron4mac

In trying to help you with your site, I had gotten the original ChaoticSoul version (it is very old) and made necessary changes to get it to function properly. At the time, I didn't know that you were using PHP 7.0 and I just fixed things with it to get it functioning with PHP 8.1 ... as my focus was to see whether the theme was part of the problem for FancyBox. Attached here is the theme.php file I have that is running with CPG and PHP 8.1

KchoPrro

Quote from: ron4mac on September 14, 2022, 01:03:48 PM
In trying to help you with your site, I had gotten the original ChaoticSoul version (it is very old) and made necessary changes to get it to function properly. At the time, I didn't know that you were using PHP 7.0 and I just fixed things with it to get it functioning with PHP 8.1 ... as my focus was to see whether the theme was part of the problem for FancyBox. Attached here is the theme.php file I have that is running with CPG and PHP 8.1

As always, thank you very much for the great work you do.

Now I see the web in PHP 7.4 (in 8.0 and 8.1 neither the Sidebar nor the last uploaded images and random images are shown).

Now two minor problems occur to me;

1- Under the thumbnails the description of the image appears, and not the title (I have checked the configuration, and it is correct, only the title should be visible).
2- The style sheet has changed completely, the text of the description appears in the color of the text of the categories and is not justified. This is not a major problem, I think I'll be able to put everything back in place myself.

I leave PHP7.4 on, attached a screenshot of how it looks with 8.0 and 8.1-

ron4mac

#6
Apparently your theme.php file had been significantly modified from the original. You might consider moving to a different theme. Here is a very nice, lightweight one that is free, has the side menu, has some responsiveness and would only need minor css adjustment to become a dark theme. ChaoticSoul tries to do too much in its theme.php file and creates problems with software updates.

KchoPrro

Quote from: ron4mac on September 14, 2022, 03:30:15 PM
Apparently your theme.php file had been significantly modified from the original. You might consider moving to a different theme. Here is a very nice, lightweight one that is free, has the side menu, has some responsiveness and would only need minor css adjustment to become a dark theme. ChaoticSoul tries to do too much in its theme.php file and creates problems with software updates.

Ohhhhh!  :'(, I fell in love with Chaoticsoul since I saw it for the first time in CPG, no other theme I liked so much  :-* :-*. I made some aesthetic adjustments to it and since 2010 it was the theme I used, to the point that I adapted the thumbnails for the theme (I replace each thumbnail generated by CPG with an adapted one, with a mirror effect and background color). In addition, I have many pages with MiniCMS, created for the Chaoticsoul theme that I would have to revise to adapt them to a new theme.

It's a shame, I'll have to think about it.

I have seen the subject of the link, I was totally unaware that designs were made (free or paid) outside the CPG forum. For 6 dollars that cost the paid designs, it seems cheap to me. Perhaps I will value one of the paid ones, for now I will download the free one and I will study some aesthetic changes that I like (I prefer dark colors)

Thank you very much, I'll take a few days off ;)

ron4mac

Quote from: KchoPrro on September 14, 2022, 07:30:57 PM
I replace each thumbnail generated by CPG with an adapted one, with a mirror effect and background color
Just so you know ... that effect could happen automatically with a bit of CSS and a fairly simple plugin.

KchoPrro

Quote from: ron4mac on September 14, 2022, 09:27:36 PM
Just so you know ... that effect could happen automatically with a bit of CSS and a fairly simple plugin.

I imagine that the process that I carry out in Photoshop could be automated, but it seems to me that it will be too complicated for me (I don't want to abuse your generosity either  :-[).

Yesterday I implemented the new theme and I have already made some aesthetic adjustments only on the blue color. I've seen several problems, I guess related to the version of PHP;

A) With PHP 8.1: Some images are not displayed when clicking on the thumbnail (other images are  ???), I don't know why one or the other. Examples:

Displayed:
https://www.adolfoventas.es/galeria/displayimage.php?album=21&pid=301#top_display_media

Not displayed:
https://www.adolfoventas.es/galeria/displayimage.php?album=61&pid=525#top_display_media

With PHP 7.4 this problem does not happen.

B) With PHP 7.4 and also with PHP 8.1, the strip of images shows 5 photos (it comes out of the box that contains them), in other images 4 appear (which is how it should come out)

Examples:
4 Images: https://www.adolfoventas.es/galeria/displayimage.php?pid=105#top_display_media
5 Images: https://www.adolfoventas.es/galeria/displayimage.php?pid=298#top_display_media

For the rest, this new theme works well and I think I will continue with it, adapting it better to my tastes.

I don't know if the BB Control and MiniCMS plugins might be giving a problem on PHP8.1, many of the photos have BBCode in the text.

Any ideas?

ron4mac

You can disable an individual plugin to see whether it may be causing a particular issue that you are seeing. If you identify an issue with a plugin (or theme, for that matter), you should first try to message the plugin (or theme) author to see if they are still supporting their work.

Ever since I have been involved with CPG, I have disliked the filmstrip ... especially how it was implemented. I have avoided doing work on it. I would rather see it gone from the core of CPG. It could better be implemented as a plugin for those who find value in the concept.

ron4mac

Quote from: KchoPrro on September 15, 2022, 12:12:24 PM
For the rest, this new theme works well and I think I will continue with it, adapting it better to my tastes.
Monica did a nice job with her themes.

CPG 1.6 has features built in that make it easier for simple themes to do much more with their CSS. For instance .. the CSS can know which type of page it is on and not display the full banner at the top of the page for album thumbnails or intermediate images. Or don't display the full menu on some page types. I would add modifications to the CSS of that theme to take advantage of those concepts.

KchoPrro

Quote from: ron4mac on September 15, 2022, 03:30:47 PM
Monica did a nice job with her themes.

CPG 1.6 has features built in that make it easier for simple themes to do much more with their CSS. For instance .. the CSS can know which type of page it is on and not display the full banner at the top of the page for album thumbnails or intermediate images. Or don't display the full menu on some page types. I would add modifications to the CSS of that theme to take advantage of those concepts.

I would like to have an advanced level of knowledge about php and css, but I am not able to do anything other than change a color, or the size of a font, font, etc. I dedicate myself to see the css code and how it affects the page and modify what I can understand. I guess with time I will learn more things :)

Quote from: ron4mac on September 15, 2022, 03:14:41 PM
You can disable an individual plugin to see whether it may be causing a particular issue that you are seeing. If you identify an issue with a plugin (or theme, for that matter), you should first try to message the plugin (or theme) author to see if they are still supporting their work.

CPG does not show me the plugin manager with PHP8.1, I get the following message:

Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /galeria/plugins/minicms/configuration.php:38 Stack trace: #0 /galeria/plugins/minicms/configuration.php(38): in_array() #1 galeria /pluginmgr.php(146): include('/home/u41263082...') #2 /galeria/pluginmgr.php(725): display_plugin_list() #3 { main} thrown in /galeria/plugins/minicms/configuration.php on line 38

The only solution I see is to downgrade to PHP7.4, disable one of the plugins, upgrade back to 8.1 and see if anything has been resolved. If it is MiniCMS or BB Control, try to contact the author, but I think they are no longer operational. Perhaps you have no choice but to stick with PHP7.4

Quote from: ron4mac on September 15, 2022, 03:14:41 PM
Ever since I have been involved with CPG, I have disliked the filmstrip ... especially how it was implemented. I have avoided doing work on it. I would rather see it gone from the core of CPG. It could better be implemented as a plugin for those who find value in the concept.

I totally agree with you, it would be more interesting to leave the filmstrip as a plugin for those who want to implement it. However, I like how it looks, but aesthetically it is more interesting without the filmstrip_background, for that reason I removed it from the chaoticsoul theme.

I will try to contact Monica, the truth is that her themes are very good, I hope I can buy her a more current theme that also works with php8.0

ron4mac

Quote from: KchoPrro on September 19, 2022, 07:54:02 AM
CPG does not show me the plugin manager with PHP8.1, I get the following message:
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /galeria/plugins/minicms/configuration.php:38 Stack trace: #0 /galeria/plugins/minicms/configuration.php(38): in_array() #1 galeria /pluginmgr.php(146): include('/home/u41263082...') #2 /galeria/pluginmgr.php(725): display_plugin_list() #3 { main} thrown in /galeria/plugins/minicms/configuration.php on line 38

Remove these 4 (consecutive) lines from the MiniCMS plugin configuration.php file:
$lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english';
include('plugins/minicms/lang/english.php');
if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/minicms/lang/'.$lang.'.php')) {
    include('plugins/minicms/lang/'.$lang.'.php');
}

KchoPrro

Quote from: ron4mac on September 19, 2022, 04:28:31 PM
Remove these 4 (consecutive) lines from the MiniCMS plugin configuration.php file:
$lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english';
include('plugins/minicms/lang/english.php');
if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/minicms/lang/'.$lang.'.php')) {
    include('plugins/minicms/lang/'.$lang.'.php');
}


Thanks! The problem has been solved. Was able to get into plugin management and disabled BBCode Control (bbcode_control): v1.12. It has been the solution, now there are no more errors. I used the plugin to add embedded links in the image description, or add a bold text. Now that I don't have the Plugin active, I notice that the links still exist and the bold or italics also appear in the description. I guess this was also an improvement from version 1.6x of CPG, before it couldn't use BBCode.

The unsolved problem is to know why there are times that 5 thumbnails appear in the intermediate image and other times 4 (the correct one is 4). This is not a CPG issue, it's a theme issue. I'll ask Monica if she has any ideas on the solution.

Thank you very much again! :)

ron4mac

#15
Quote from: KchoPrro on September 20, 2022, 08:13:21 PM
The unsolved problem is to know why there are times that 5 thumbnails appear in the intermediate image and other times 4 (the correct one is 4). This is not a CPG issue, it's a theme issue.

In the theme style.css file, at about line 1119, comment out the width spec.:
#film {
/* width: 100%!important; */
}

Somewhere in the same file, at an appropriate location, add the line:
#film .thumb {padding: 1px}

And part of the issue here does involve the way the film strip was (is) implemented in CPG.

KchoPrro

Quote from: ron4mac on September 20, 2022, 09:07:39 PM
In the theme style.css file, at about line 1119, comment out the width spec.:
#film {
/* width: 100%!important; */
}

Somewhere in the same file, at an appropriate location, add the line:
#film .thumb {padding: 1px}

And part of the issue here does involve the way the film strip was (is) implemented in CPG.

Finally, the only thing that has managed to adapt has been this code;

#film {
width: 740px!important;
}

#film .thumb {padding: 5px}


I don't know if it can affect when we visit the page from a mobile or tablet, but only limiting the size in width pixels (in addition to the 5 px padding), has solved the problem:
https://www.adolfoventas.es/galeria/displayimage.php?album=10&pid=971#top_display_media


Thank you very much for the help, I would never have found this solution.

Interestingly, with the modification you gave me in the previous message and the deactivation of the BB Control Plugin, the Chaoticsoul theme now works perfectly with PHP8.1

Today I will also remove filmstrip_background and this theme will be ready, thank you very much for everything!!

KchoPrro

Quote from: KchoPrro on September 21, 2022, 08:38:42 AM
Finally, the only thing that has managed to adapt has been this code;

#film {
width: 740px!important;
}

#film .thumb {padding: 5px}


I don't know if it can affect when we visit the page from a mobile or tablet, but only limiting the size in width pixels (in addition to the 5 px padding), has solved the problem:
https://www.adolfoventas.es/galeria/displayimage.php?album=10&pid=971#top_display_media


Thank you very much for the help, I would never have found this solution.

Interestingly, with the modification you gave me in the previous message and the deactivation of the BB Control Plugin, the Chaoticsoul theme now works perfectly with PHP8.1

Today I will also remove filmstrip_background and this theme will be ready, thank you very much for everything!!

I assumed that moving from a percentage measurement to pixels would affect display on other platforms. Attached a screenshot of the page viewed from a mobile.

It is not very important either, the images, in mobile view mode, did not come out correctly either. I can live without it ;)