0
votes

Newly I designed and create a new theme for drupal 8 locally, everything works correctly on my localhost and I haven't any problem in localhost environment, but the problem arises when I decide to upload my theme to real cpanel host (product server).

In cpanel host my theme shows up and treat like other themes and install without any problem or error message,
but the problem here: theme setting page and home page not showing anything (show only a blank empty page without any content in it, a white screen only show up).

It is worth noting that other themes like bartik or downloaded theme from drupal center work correctly in product host.
I uninstall and install again my theme and clean cash several times and I even install another local host with new drupal core and test my theme and I have not encountered any problems.

This problem makes me very deuced because in localhost everything works normally and haven't any problem and in cpanel host nothing

Is there any tips or standard that I should consider for creating and uploading my theme from local host to real product host?

Thanks to all of you.

1
First, you need to figure out why its not working. Is there any error you can see in Drupal watchdog error log in CMS? Something on the server is not supporting your theme code so first find and fix the problem. If you won't found any errors in watchdog then check the server logs directories for any PHP errors.Anurag

1 Answers

0
votes

With especial thank to Anurag, I appreciate him for his constructive comment.
It may happen to anyone like this problem. After reading a lot of error messages in Drupal watchdog error logs I found something interesting.

This problem arises from below error:

Warning: require_once(/home/cPanelUserName/public_html/themes/ThemeName../lib/jdatetime.class.php): 
failed to open stream: 
No such file or directory in require_once() (line 11 of /home/CpanelUserName/public_html/themes/ThemeName/ThemeName.theme)

I am using a php library which has this code:

require_once dirname(__FILE__) . '../lib/jdatetime.class.php';

I guess here is that including the dirname (__FILE__) ensures that the require_once function uses an absolute rather than relative path.

Howsoever I do not change anything in theme directory structure when I move my theme from localhost to real product host but I think that refers to difference between Linux Host and Windows localhost because when I change that snippet code to include ('lib/jdatetime.class.php'); everything goes back to normal mode.
I'd be very happy to share your experiences with me about this problem.