Themes not showing up

Permalink 4 users found helpful
Hello,

I've been developing with Concrete5 < 5.7 for a couple of years and I've just installed 5.7 with the hope of developing a small site. Essentially I've copied the elemental theme from /concrete/themes and I've created a new folder /themes/test which contains the theme files and I've updated the theme name in the description (As in older versions) but I cannot see the theme in the list in the dashboard. I've cleared the cache and disabled it completely. Also how come non of the other themes in /concrete/themes show up anymore?

I can't seem to find any docs for 5.7 specific themes so I assume it's similar?

Thanks in advance for any help.

andrewhawkes
 
mkly replied on at Permalink Reply
mkly
There is now another .php file that contains additional metadata about the theme. I believe it is optional but elemental does have it. Here is what you probably need to change to the handle of your new theme.

https://github.com/concrete5/concrete5-5.7.0/blob/develop/web/concre...
mkly replied on at Permalink Reply
mkly
Oops wrong file. Ignore that for now.
andrewhawkes replied on at Permalink Reply
andrewhawkes
I've just tried updating the namespace in page_theme.php but no luck :/
mkly replied on at Permalink Best Answer Reply
mkly
Okay I just tested this process and it worked for me. Make sure you have your Cache disabled as well.

Copy
/concrete/themes/elemental

to
/application/themes/test

Change
/application/themes/test/description.txt

to look like
Test
This is a test.

change the namespace in
/application/themes/test/page_theme.php

to this
namespace Application\Themes\Test;
andrewhawkes replied on at Permalink Reply
andrewhawkes
Thanks, I just watchedhttps://www.youtube.com/watch?v=vQm1QXN9OfI&list=UUywmkk3TWHLcYy... an realised it's in /application/themes now!

Cheers
mkly replied on at Permalink Reply
mkly
I should add that I think your issue is that you created a new root directory /themes

In 5.7 these local overrides and folders are now in the /application folder. If you look in the /application folder you will see a /themes directory already there. The /application folder in 5.7 is like the root folder in 5.6
OlliSavolainen replied on at Permalink Reply
OlliSavolainen
I did just like that and I get error:
Class \Application\Theme\Test\PageTheme does not exist
Do you know what is wrong?
andrewhawkes replied on at Permalink Reply
andrewhawkes
Check that "\Application\Theme\Test\" contains the description.txt file. Your theme files need to be at that level.
OlliSavolainen replied on at Permalink Reply
OlliSavolainen
That's just like that.
Now last error disappear and now I have:
Cannot declare class Application\Themes\Testi\PageTheme because the name is already in use
But where you give name to theme.
andrewhawkes replied on at Permalink Reply
andrewhawkes
You name the theme in your description.txt file; the top line is the name, the second line is the description. Ideally you should name the theme folder the same. If you've copied over a theme from the main themes folder you might have the controller.php file which could be causing that issue.
OlliSavolainen replied on at Permalink Reply
OlliSavolainen
Example above is wrong. If you want to use "elemental" theme as starting point do this:
Copy this folder
concrete/themes/elemental

to
application/themes/

and change folder name to "test"
then change:
application/themes/test/description.txt

to
Test
This is my first template

then change
application/themes/test/page.php

first three lines
<?php
namespace Application\Theme\Test;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme{

and change
application/themes/test/css/main.less

line 6 to:
@import "../../../css/build/core/include/mixins.less";
tipweb replied on at Permalink Reply
I think, the line 6 in main.less has to be changed to
@import "../../../../concrete/css/build/core/include/mixins.less";
OlliSavolainen replied on at Permalink Reply
OlliSavolainen
And this page is very useful learning to make new themes:
http://www.concrete5.org/documentation/5.7/developers/themes/conver...
Willough replied on at Permalink Reply
Both of these instructions seem flawed and now I have a situation. I cannot load the pages and themes page. Error message is:

Class \Concrete\Theme\ElementalTest\PageTheme does not exist


- I had copied the elemental folder to application/themes folder
- Renamed the folder to Elemental test
- Changed the description.txt file according to directions with new theme name on first line and no change to description
- changed page-theme.php (there is no page.php by the way) to
namespace Application\Theme\Elementaltest


Went to pages and themes, went to install the new theme and got the error above. I have since removed all files under application/themes but I cannot get back to the pages & themes page. This error just persists.

How can get it resolved and get back to the original pages & themes page short of reinstalling 5.7? There is debug info but it's over my head. I am still new to Concrete and like many others new to 5.7. Thanks.
andrew replied on at Permalink Reply
andrew
In general, no theme directory in concrete5 (any version) has ever worked well with a space in its name. You should use an underscore instead.

Try "elemental_test", and make sure that the namespacing follows concrete5's camelcasing rules, so it's Application\Theme\ElementalTest
Willough replied on at Permalink Reply
Thank you. My problem at the moment is how to remove the error message and return to the Pages & Themes page. I cannot get rid of the error message even when I have removed everything from the application/themes directory. Is there a way to fix this short of a complete re-install? I have not gone far enough with a new site to do a backup so I have nothing to restore.
mhawke replied on at Permalink Reply
mhawke
I believe you might have to delete the row from the PageThemes table using phpMyAdmin through your host's Control Panel.
Willough replied on at Permalink Reply
That did the trick. All is back to normal and theme has been copied and is usable. Thanks!
mroberte replied on at Permalink Reply
I tried the various methods above and when I go to click install, the page will go to a 404 page. After that, I go to Page and themes to activate, I get an error message.

"An unexpected error occurred.
Cannot redeclare class Concrete\Theme\AnchorFree\PageTheme"

Does anyone know what this is?

My page_theme.php first couple lines look like:

<?php
namespace Concrete\Theme\AnchorFree;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme {
Create4 replied on at Permalink Reply
Create4
I had the same problem. "Class \Application\Theme\Mydomain\PageTheme does not exist"

My problem was that my theme folder was starting with a capital. Changed it to a lower-case letter and it all worked for me.
mroberte replied on at Permalink Reply
Ahh I figured it out:

So in the code that needs to be replaced in page_theme.php I still had the file directory pointing to the core folder
namespace Concrete\Theme\Themename;


And it should and is suppose to be
namespace Application\Theme\Themename;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme {


Where Concrete was replaced with Application in the namespace line. This only applies if you move the folder to the application - themes - folder (which is the correct folder to duplicate the elemental theme to alter).