Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 17:15:34

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,385
GitHub

RFC: With Zero theme, don't install any default content

Currently (4.9.0 beta 2), if the Zero theme is selected during installation, the bulk of the default content (e.g. links; theme styles, pages, forms; categories) isn’t installed – with the exception of the default “Welcome to Textpattern” article, some default links, and their associated categories, plus the section for the default article.

This makes sense, from my perspective. An admin or designer selecting Zero is building from a blank canvas. There’s no front-side scaffold to display said article, unless you count syndication feeds, so the article seems a little redundant. An admin or designer chooses Zero consciously, and they’re either going to zap the default article with ID #1, or edit it with their own first article. The default article becomes a bit crufty in the absence of the other default content.

Proposal for comment / discussion:

If Zero theme is selected, don’t install any default content at all. No default article, no default links, no sections, no categories.

Edit: for clarity, the Zero theme includes default and error_default page scaffolds, but they’re both empty, except for a comment directing the user to the docs.

This is closer to a truly clean slate, and saves the initial post-install housekeeping of stripping out the remaining content. It also helps keep the IDs for each article, section and category a little saner as the ID #1 (#1 to #3 for categories, #1 to #5 for links) of each isn’t installed to the database and subsequently deleted. Database nerds, rejoice!

The floor is yours.

Edit: tweaked post content and title.

Last edited by gaekwad (Yesterday 17:33:16)

Offline

#2 Yesterday 17:50:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,833
Website GitHub

Re: RFC: With Zero theme, don't install any default content

Yes, except the only slight fly in the ointment is that Textpattern might expect an article. And the default section (and error_default) have to exist or it gets very annoyed when you visit the front end. Plus the “important” (ugh) Forms.

Not tried deleting everything to see how it behaves. Might be worth trying to see how bare bones it can go.

Pretty sure the other content types and Category etc can be left blank without issue.

I think the general thought stream was “if someone is an admin and wants a clean slate, they’re probably going to have boilerplate scaffolding they’ve prepped from other jobs, so they can import that theme instead during installation” (by dumping it in the themes dir prior to starting, so it becomes an option in the drop-down).

Whether that’s a true or misguided statement is open for debate.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 Yesterday 18:32:41

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,385
GitHub

Re: RFC: With Zero theme, don't install any default content

Bloke wrote #340106:

Yes, except the only slight fly in the ointment is that Textpattern might expect an article. And the default section (and error_default) have to exist or it gets very annoyed when you visit the front end. Plus the “important” (ugh) Forms.

Not tried deleting everything to see how it behaves. Might be worth trying to see how bare bones it can go.

Thanks, Bloke. I’ve just run a fresh install of 4.9.0 beta 2, Zero theme, and manually removed all traces of articles, section, links, and categories. In debugging mode, there’s nothing warning- or error-wise shown on the front side at all. In fact, the page source is pleasingly clean (I’m guessing in no small part because there are no article tags present?):

<!-- Contents of the 'default' (home) page template goes here. -->
<!-- Trace summary:
Runtime   : 7.89 ms
Query time: 3.68 ms
Queries   : 6
Memory (*): 572 kB
Pages     : default
-->
<!-- Trace log:
  Time(ms) | Duration | Trace
      0.16 |     0.08 | [PHP includes, stage 1]
      0.25 |     2.37 | [PHP includes, stage 2]
      0.35 |          | 	[Textpattern autoload dir: 'vendors']
      0.36 |          | 	[Textpattern autoload dir: 'lib']
      2.64 |     0.50 | [SQL: SELECT nonce, name, RealName, email, privs FROM txp_users WHERE name = 'adminpete' ]
      3.14 |          | [Rows: 1]
      3.17 |     0.57 | [SQL: SELECT name, val FROM txp_prefs WHERE user_name IN ('','adminpete') ORDER BY FIELD(user_name, '','adminpete') ]
      3.74 |          | [Rows: 117]
      3.86 |     0.53 | [Loading plugins]
      3.86 |     0.52 | 	[SQL: SELECT name, version, load_order FROM txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
      4.38 |          | 	[Rows: 0]
      4.41 |     0.55 | [SQL: SELECT * FROM txp_section WHERE 1 ]
      4.97 |          | [Rows: 1]
      4.97 |     0.24 | [PHP includes, stage 3]
      5.03 |     0.03 | 	[Load: 'vendors/Txp.php']
      5.05 |     0.01 | 		[Load: 'vendors/Textpattern/Container/FactoryInterface.php']
      5.06 |          | 		[Class loaded: 'Txp']
      5.07 |     0.02 | 	[Load: 'vendors/Textpattern/Container/Container.php']
      5.09 |     0.01 | 		[Load: 'vendors/Textpattern/Container/ContainerInterface.php']
      5.09 |          | 		[Class loaded: 'Container']
      5.11 |     0.02 | 	[Load: 'vendors/Textpattern/Tag/Registry.php']
      5.12 |     0.01 | 		[Load: 'vendors/Textpattern/Container/ReusableInterface.php']
      5.13 |          | 		[Class loaded: 'Registry']
      5.22 |     0.00 | [Loading plugins]
      5.25 |     0.01 | [Load: 'vendors/Textpattern/L10n/Lang.php']
      5.26 |          | 	[Class loaded: 'Lang']
      6.04 |     1.02 | [SQL: SELECT name, data FROM txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
*     7.07 |          | [Rows: 304]
*     7.36 |     0.51 | [SQL: SELECT user_html FROM txp_page WHERE name = 'default' AND skin = 'zero' ]
      7.87 |          | [Rows: 1]
      7.87 |          | [Page: 'zero.default']
-->
<!-- Query log:
Duration | Query
    0.50 | [SQL: SELECT nonce, name, RealName, email, privs FROM txp_users WHERE name = 'adminpete' ]
    0.57 | [SQL: SELECT name, val FROM txp_prefs WHERE user_name IN ('','adminpete') ORDER BY FIELD(user_name, '','adminpete') ]
    0.52 | [SQL: SELECT name, version, load_order FROM txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
    0.55 | [SQL: SELECT * FROM txp_section WHERE 1 ]
    1.02 | [SQL: SELECT name, data FROM txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
    0.51 | [SQL: SELECT user_html FROM txp_page WHERE name = 'default' AND skin = 'zero' ]
-->
<html><head></head><body></body></html>

Mmm, tasty! So in a post-install-manual-housekeeping sense, it’s doable. Whether this is viable or desirable to have done automatically during install is part of the reason I posted.

I think the general thought stream was “if someone is an admin and wants a clean slate, they’re probably going to have boilerplate scaffolding they’ve prepped from other jobs, so they can import that theme instead during installation” (by dumping it in the themes dir prior to starting, so it becomes an option in the drop-down).

Whether that’s a true or misguided statement is open for debate.

I totally understand this take, and I’d file under ‘true’ not ‘misguided’. There’s also a contingent of in-browser hackers who might copy & paste from an IDE or file system, or even do raw dev in the textareas since the whole admin experience is pleasingly uncluttered. In that sense, each of the three camps would perhaps benefit from having only their content, not our content.

Edit: errant copy & paste from console; now fixed.

Last edited by gaekwad (Yesterday 18:34:42)

Offline

#4 Yesterday 19:16:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,833
Website GitHub

Re: RFC: With Zero theme, don't install any default content

If the front end still functions without all the content (I’m surprised it works with no sections and page templates!) then we can certainly look to get rid of it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 Yesterday 19:32:57

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,385
GitHub

Re: RFC: With Zero theme, don't install any default content

Bloke wrote #340108:

(I’m surprised it works with no sections and page templates!)

Please forgive the nitpick – there are two page templates included with the Zero theme, but they’re empty (save for a comment).

Offline

#6 Yesterday 20:19:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,833
Website GitHub

Re: RFC: With Zero theme, don't install any default content

Crossed wires, sorry. I thought you meant you deleted the sections and pages, as in got rid of them completely. If they’re merely empty, they still exist and txp should be happy.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB