Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2016-06-14 09:43:45

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299701:

Dammit. I wonder if it’s possible to un-revert reverted code? :-)

I still have the code in my Hive theme repo – it’s only reverted in the Textpattern repo whilst I decided how to progress. I will either revert the revert or reinstate the changes. You will then need to amend the filename and how the config.php refers to the file (as I don’t know how to code that bit). Give me a few minutes to do the above.

Offline

#74 2016-06-14 09:45:10

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Feedback to: Textpattern CMS 4.6.0 beta released

OK, it’s reverted my revert! Stef do you want to work your magic on it, I will then transfer the changes back to my original theme repo. :)

Offline

#75 2016-06-14 10:02:42

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

Re: Feedback to: Textpattern CMS 4.6.0 beta released

philwareham wrote #299707:

OK, it’s reverted my revert!

Yay, nice one.

do you want to work your magic on it

Sure, I’ll do it at lunchtime. Do we want to go with a fixed location file, called custom.css? A different name? Or a user-specified filename? And what of .js? Worth adding a similar thing in there too, if I can figure it out?


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

#76 2016-06-14 10:28:19

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299710:

Yay, nice one.

Sure, I’ll do it at lunchtime. Do we want to go with a fixed location file, called custom.css? A different name? Or a user-specified filename? And what of .js? Worth adding a similar thing in there too, if I can figure it out?

A custom JS file would be of benefit to people, I’m sure. I don’t have a personal preference on how these files are labelled – the ability to have a user specified name makes sense, to lessen the risk of overwrites during upgrades.

Offline

#77 2016-06-14 12:12:18

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

Re: Feedback to: Textpattern CMS 4.6.0 beta released

philwareham wrote #299713:

A custom JS file would be of benefit to people, I’m sure.

Done it in my local repo, along with the CSS. Works well; good fallback. Users don’t have to do anything besides add the custom.css or custom.js file to the theme’s relevant assets folder. But if they want to rename one, for example:

define('admin_custom_css', 'my_custom_file.css');

That will override the custom.css file name: best of both worlds. Likewise you can set admin_custom_js if you wish, or just use custom.js by default. Lots of scope for modding a theme without making a new one. Mmmm custom bot_wtc goodness :-)

Got any ideas on some JS functionality to include in custom-example.js? I’ll do a tiny bit more testing and commit this for now, but if you find any juicy JavaScript as an example of what people might want to do, add it to the repo as custom-example.js. Cheers!


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

#78 2016-06-14 12:19:00

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299719:

Done it in my local repo, along with the CSS. Works well; good fallback. Users don’t have to do anything besides add the custom.css or custom.js file to the theme’s relevant assets folder.

So it will only work if a theme includes an assets folder ? Or if the user adds that folder ?
I’ve never used an assets folder on any project, personally.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#79 2016-06-14 12:36:31

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

Re: Feedback to: Textpattern CMS 4.6.0 beta released

phiw13 wrote #299721:

So it will only work if a theme includes an assets folder ? Or if the user adds that folder ?

Currently it’ll only work in Hive or Hive Neutral! It’s part of the html_head() function, which core itself does not define. It’s down to the theme to do that.

The upshot is, you can benefit from this in two ways in your own themes:

  1. extend hive or hiveneutral, create an assets/css or assets/js folder in your theme’s folder and tell your users to drop customisations in there, exactly like they would for a core theme.
  2. modify your themename.php file, override html_head() with your own code and you have the option to do the same as the core does if you wish (copy ‘n paste, then tweak), with the extra flexibility to be able to define where you want those custom files to live inside your theme’s directory structure. Or not include them at all. Or allow multiple custom files, or, well, whatever you want: it’s your theme!

In both case, people can use the override filename feature if they wish, as long as in the second method you code support for 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

#80 2016-06-14 12:43:44

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

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Of course, the downside to having custom files reside in each theme is that you need to copy them over to your other themes… or symlink them from somewhere else. Otherwise, if you switch theme, you lose the customisations.

Having a central location would be grand (in a way1), but that’s probably a much larger change to core, which is probably not such a good idea at this late beta stage. I could look into it, and though. And if it’s not a massive amount of effort, could give it a whirl.

1 EDIT: but here, if you have theme-specific customisations, a central location isn’t such a good idea, as some misplaced code could break your other themes.


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

#81 2016-06-14 12:53:59

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299724:

Of course, the downside to having custom files reside in each theme is that you need to copy them over to your other themes…

I think this is the best solution personally. Customisations should be targeted at a specific theme – if you want to customise another theme either copy the customisations over or write new ones.

Offline

#82 2016-06-14 13:01:48

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

Re: Feedback to: Textpattern CMS 4.6.0 beta released

philwareham wrote #299725:

I think this is the best solution personally.

I concur. And if someone’s hell-bent on sharing files, they can symlink to a central location outside of the admin-themes directory.


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

#83 2016-06-14 13:23:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299723:

Currently it’ll only work in Hive or Hive Neutral! It’s part of the html_head() function, which core itself does not define. It’s down to the theme to do that.

Oh, I see what you did. OK, that is much easier to reuse / implement that I first understood, with the added benefit that a third party theme can customise the path. Cool.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#84 2016-06-15 11:55:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: Feedback to: Textpattern CMS 4.6.0 beta released

Bloke wrote #299723:

Currently it’ll only work in Hive or Hive Neutral! It’s part of the html_head() function, which core itself does not define. It’s down to the theme to do that.

Ok. I have it running for Sandspaces (at least my local copy). Bits of copy, bits of paste, a couple of edits and it was all done. Thing works nicely – both the default custom.css and the user-decides-on-crazy-name.csscases.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB