Feature Request: look for "default-content.php' in themes

Post Reply
cristoslc
Developer
Posts: 10
Joined: Thu May 15, 2014 8:42 pm

Feature Request: look for "default-content.php' in themes

Post by cristoslc »

Instead of requiring that new areas' default content be added to the index.php file, it would be very helpful if WonderCMS automatically checked for a "default-content.php" file in the theme's directory, and imported it. Similar to the methodology used in the Jumbotron theme in line 22 at https://github.com/cristoslc/WonderCMS- ... /index.php

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Feature Request: look for "default-content.php' in theme

Post by wiz »

I was busy the last couple of days, I'll check your theme first thing tomorrow morning, and this sounds like a great idea, seperating it from the index. I'll reply on this thread tomorrow.

cristoslc
Developer
Posts: 10
Joined: Thu May 15, 2014 8:42 pm

Re: Feature Request: look for "default-content.php' in theme

Post by cristoslc »

Do you prefer requests be raised in this forum, or as issues on Github?

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Feature Request: look for "default-content.php' in theme

Post by wiz »

All requests / bug / issue reports should go over here (BETA support - with a new topic).

cristoslc
Developer
Posts: 10
Joined: Thu May 15, 2014 8:42 pm

Re: Feature Request: look for "default-content.php' in theme

Post by cristoslc »

I found this code to be adequate, around line 66 of index.php in WonderCMS 0.6 BETA

Code: Select all

# Load default content for theme, if any
$themeContent = 'themes/'.$c['themeSelect'].'/default-content.php';
if (file_exists($themeContent)) {
	include ($themeContent);
}

cristoslc
Developer
Posts: 10
Joined: Thu May 15, 2014 8:42 pm

Re: Feature Request: look for "default-content.php' in theme

Post by cristoslc »

Correction: didn't realize it at the time, but this caused issues after changing the text. (Content from default-content.php overrode exiting content from files)

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Feature Request: look for "default-content.php' in theme

Post by wiz »

Do you think there's any way to incorporate this into the theme(.php) file itself? (Or any other convenient way perhaps?) I mentioned the other day that we're trying to keep it as small as possible (and we even managed to get rid of one extra file - on the version that's on GitHub.

Other than that, very good concept.

cristoslc
Developer
Posts: 10
Joined: Thu May 15, 2014 8:42 pm

Re: Feature Request: look for "default-content.php' in theme

Post by cristoslc »

I tried that, but as currently written, the default content needs to be loaded BEFORE the content from the files is loaded. Any attempts to load it after the files have already loaded just overwrites the displayed content with the defaults (even if the file contents are different).

If there were some easy way to tell which default content should be loaded, and which areas already have content (from files), then I think it would be easier to build into the theme. Suggestions?

(Also, this suggestion would include adding a few lines of code to the index.php, but I'm not suggesting that default content for the core be moved to a separate file; just that the core check any themes to see if they have default content that needs to be loaded.)

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Feature Request: look for "default-content.php' in theme

Post by wiz »

I replied on the other topic, maybe the "new file" I mentioned could include features as you're mentioning.

I understand the problem, maybe we will indeed have to move things around, maybe it would be created seperately each time an user creates a page (within /files/folder-pagename/).

mary
Posts: 5
Joined: Mon Aug 08, 2016 9:50 am

Re: Feature Request: look for "default-content.php' in themes

Post by mary »

Do you prefer requests be raised in this forum, or as issues on Github?

Post Reply