Textpattern CMS support forum

You are not logged in. Register | Login | Help

#161 2018-01-09 18:28:46

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Re: Textpattern themes: a plan

I am with Michael and Phil here, no need for over-complex solutions.
For instance, a bundled theme distribution could include two folders:

  1. Assets, containing a sub-folder for js files, one for proper css files, an img folder, a font folder etc. The folder should be uploaded in the root as it is.
  2. Themes, containing my-theme-name, with pages, forms and style. My-theme-name should be uploaded to Themes directory, as it is.

After importing, all skin pages will already have the correct file/path i.e.

<link rel="stylesheet" href="<txp:site_url />assets/css/main.css" />
<script src="<txp:site_url />assets/js/jquery.min.js"></script>

Finally, in the bundle, a read-me file with instructions…

I tested everything on my NAS device playing with Brahm’s (and Michael) Clean Blog for Textpattern upgrading to Textpattern-4.7.0-dev and to Bootstrap 4.0. I changed some tags, too.
You can see the theme in action here

Just my 2 eurocents…

Offline

#162 2018-01-09 18:38:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

Re: Textpattern themes: a plan

giampablo wrote #308595:

For instance, a bundled theme distribution could include two folders

Themes should be self-contained wherever possible as that allows simpler import/export BUT there’s no reason you can’t have a “base” theme that contains assets like js/images/fonts/etc and then each “true” theme (as far as Txp is concerned) contains pages/forms/styles directories. This is the minimum structure:

themes
   -> theme1
      -> pages
         -> default.txp
         -> error_default.txp
      -> forms
         -> article
            default.txp
            article_list.txp
         -> misc
            some-stuff.txp
         -> files
            files.txp
         ...
      -> styles
         default.css
   -> theme2
      -> pages
         -> default.txp
         -> error_default.txp
         -> blog.txp
      -> forms
         ...      

For this reason, we can’t have any “fixed” paths in the code as you don’t know what the themes folder is called (as it could be changed by the client). The name of the theme is also changable. Allthough a theme itself can hard-code links to assets inside it, a client may relabel the theme name, so it’d always be best practice to use a tag that outputs “my theme name” instead of relying on hard coded values. That’s what I’d like to get out of a tag.


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

#163 2018-01-09 19:15:01

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,504
Website

Re: Textpattern themes: a plan

giampablo wrote #308595:

You can see the theme in action here

Prematurata alla supercazzola o scherziamo!


…. texted postive

Offline

#164 2018-01-09 19:35:16

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Re: Textpattern themes: a plan

bici wrote #308597:

Prematurata alla supercazzola o scherziamo!

Come fosse antani con scappellamento a destra costantinato ammaliti.
… Do NOT use google to translate absolute nonsense!

Offline

#165 2018-01-09 19:37:36

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,504
Website

Re: Textpattern themes: a plan

giampablo wrote #308599:

Come fosse antani con scappellamento a destra costantinato ammaliti.
… Do NOT use google to translate absolute nonsense!

e da il film: https://www.youtube.com/watch?v=thb8Ov_bW_o

e che caz!

Last edited by bici (2018-01-09 19:38:12)


…. texted postive

Offline

#166 2018-01-10 00:35:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

Re: Textpattern themes: a plan

Bloke wrote #308592:

We could probably extend it so that it outputs the current theme path instead of just the theme name (although that’s available anyway).

Okay, low-key approach for now. Extended functionality in the page_url tag to go along with the new relative path themes pref:

<txp:page_url type="images_path" />
<txp:page_url type="themes_path" />
<txp:page_url type="skin_path" />
<txp:page_url type="skin" />

Outputs:

https://example.org/images
https://example.org/themes
https://example.org/themes/some-theme-name
some-theme-name

Yeah, yeah I know it’s ugly to use skin but this tag unfortunately exposes our internals a bit and since we’re using ‘skin’ internally to differentiate from the already-taken ‘theme’ for admin-themes, we’ll have to live with it. If it bothers people, we can add an exception to the tag so that it translates ‘skin’ into ‘theme’ so the nicer name can be used.


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

#167 2018-01-10 02:53:14

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,716
Website

Re: Textpattern themes: a plan

Bloke wrote #308604:

Okay, low-key approach for now. Extended functionality in the page_url tag to go along with the new relative path themes pref:

<txp:page_url type="images_path" />...

Simple, clean approach – and it works well in a very quick test. Theme authors can now include all kind of resources in their theme.

Yeah, yeah I know it’s ugly to use skin but this tag unfortunately exposes our internals a bit and since we’re using ‘skin’ internally to differentiate from the already-taken ‘theme’ for admin-themes, we’ll have to live with it. If it bothers people, we can add an exception to the tag so that it translates ‘skin’ into ‘theme’ so the nicer name can be used.

Hmm, skin is a bit weird, but it doesn’t bother me much, but maybe that is just because I’ve been looking at that word too often while testing TXP 4.7 dev.

Offline

#168 2018-01-10 03:04:15

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,716
Website

Re: Textpattern themes: a plan

Bloke wrote #308604:

Okay, low-key approach for now. Extended functionality in the page_url tag to go along with the new relative path themes pref:

One question on this: When looking at the Preference panel > Admin I see we now have two entries: Themes base path with (default) value: /Users/user/Sites/_txp472/themes and skin_dir with value themes.

Does that mean I could have different locations on the file system ? Or is the first entry now obsolete pending removal?

Offline

#169 2018-01-10 08:29:19

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,555
Website

Re: Textpattern themes: a plan

Agree. A simple, clean approach.

Bloke wrote #308604:

If it bothers people, we can add an exception to the tag so that it translates ‘skin’ into ‘theme’ so the nicer name can be used.

It’s no bother for those in the know but it something that would need explaining in the docs, in the forum etc. themes_root (or themes_base_path), theme_path and theme (or theme_name) would be obvious.

phiw13 wrote #308606:

One question on this: When looking at the Preference panel > Admin I see we now have two entries: Themes base path with (default) value: /Users/user/Sites/_txp472/themes and skin_dir with value themes.

Does that mean I could have different locations on the file system ? Or is the first entry now obsolete pending removal?

That would interest me too.


TXP Builders – finely-crafted code, design and txp

Offline

#170 2018-01-10 09:21:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,787
Website

Re: Textpattern themes: a plan

jakob wrote #308608:

themes_root (or themes_base_path), theme_path and theme (or theme_name) would be obvious.

Yeah. I was trying to avoid the use of ‘path’ in a way because it’s not a path (as in file path) but couldn’t think of anything better so went with it. We could certainly tweak the names to remove references to ‘skin’. I think that’d be better.

phiw13 wrote #308606:

two entries: Themes base path … and skin_dir

Log out and back in again. The old one will get purged on login.


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