Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#151 2018-01-09 12:54:16
Re: Textpattern themes: a plan
Sounds good. I’ll make Nicolas aware of this and we’ll figure something out with regards getting the content of the relative path pref so it can be used.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#152 2018-01-09 15:16:31
Re: Textpattern themes: a plan
philwareham wrote #308582:
Probably all themes I’d make would have at least some assets within the bundle that need to be public-facing. The default theme (in setup) is the exception to the rule since I implicitly designed that to not have any JavaScript or external assets (apart from the Google font).
I’ve been working on doing a Textpattern version of HTML5 Up’s Massively. You can see my current progress.
And it includes an assets folder, which I think is pretty standard in third-party html themes these days.
Bloke wrote #308578:
Not sure what would happen if the themes path wasn’t web accessible though. Fail I guess.
I don’t really see the point of making a .css or .js file inaccessible.
<link rel="stylesheet" href="<txp:site_url />assets/css/main.css" />
<txp:assets type="css" name="main" />
It depends on how far you want to go.
<script src="<txp:site_url />assets/js/jquery.min.js"></script>
<txp:assets type="js" name="jquery" min="y" />
Offline
#153 2018-01-09 15:34:10
Re: Textpattern themes: a plan
michaelkpate wrote #308586:
You can see my current progress.
Nice!
it includes an assets folder, which I think is pretty standard
Yeah, I think we’re going to go with an enforced web-accessible themes directory (which you can rename in prefs) but it’ll be a relative path like the images pref. For anyone wanting more security, we can look into being able to split a theme into private/public sections in multi-site setups.
It depends on how far you want to go.
Exactly:
<txp:asset_list type="styles, js">
<txp:asset format="link" />
</txp:asset_list>
OR how about:
<txp:asset theme="my-other-theme" type="form/article" name="shared-form" />
<txp:asset theme="base-theme" type="js" name="jquery" />
OR:
<txp:site_url /><txp:pref name="skin_dir" />/<txp:page_url type="skin" />/js/my-library.js
:-)
The question is whether we want to permit disk-based access to content that is usually served from the DB (Pages, Forms and Styles in this case). Currently, we can’t output Pages unless they are associated with a Section, whereby they are served automatically. Does it make sense to permit a Page template to be output from disk inside your Theme? Maybe a Page from another Theme?
Since we need to permit Stylesheets to be output as well as other assets like images and javascript, why not Pages and Forms too? Conceptually, Pages are no different to a Form, it’s just that Txp ties them to Sections in the database by convention. Exporting your Theme to disk would open up more functionality, but would it make it more confusing to have two ‘assets’ – one served from the DB and one from disk that may or may not be in sync? <txp:output_form form="article_list" /> (DB) vs <txp:asset type="form" name="article_list" /> (disk).
Not sure. Thoughts welcome from all, as always.
Last edited by Bloke (2018-01-09 15:35:27)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#154 2018-01-09 16:09:51
Re: Textpattern themes: a plan
Bloke wrote #308587:
The question is whether we want to permit disk-based access to content that is usually served from the DB (Pages, Forms and Styles in this case). Currently, we can’t output Pages unless they are associated with a Section, whereby they are served automatically. Does it make sense to permit a Page template to be output from disk inside your Theme? Maybe a Page from another Theme?
Not really IMO. Pages and Forms templates (and Styles if you wish to use them – although I won’t be, in favour of proper file-based CSS) should be stored and then accessed only in the database.
And we have already prevented public access to .txp files in the .htaccess.
Otherwise everything becomes needlessly over-complicated and very breakable.
Offline
#155 2018-01-09 16:14:44
Re: Textpattern themes: a plan
philwareham wrote #308588:
Pages and Forms templates (and Styles if you wish to use them – although I won’t be, in favour of proper file-based CSS) should be stored and then accessed only in the database.
That’s fine by me. Nice and simple.
So what’s best? An asset tag (and possible container for looping over assets) of some description to output additional stuff that automatically takes the path into account and spits out valid URLs? Or something that allows you to build the URLs by hand by exposing the prefs and relevant theme settings? Or is there some bit of both we can offer?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#156 2018-01-09 16:30:13
Re: Textpattern themes: a plan
Can we extend the <txp:site_url /> tag with theme directory via an attribute maybe. I don’t want to make it too complex by declaring asset types.
<txp:site_url theme="my-theme-name" />assets/css/main.css
Which would dynamically output both the themes path and the skin name, e.g.
https://example.com/my-theme-folder/my-theme-name/assets/css/main.css
Don’t know – just thinking aloud.
Offline
#157 2018-01-09 16:51:02
Re: Textpattern themes: a plan
Curious: is there any roadmap wish list that would include a preference to output all files to a flat directory? i.e. not having to rely on rah_flat plugin ? It seems that with Themes this preference would be another useful feature.
…. texted postive
Offline
#158 2018-01-09 17:02:01
Re: Textpattern themes: a plan
We could probably extend it so that it outputs the current theme path instead of just the theme name (although that’s available anyway).
<txp:site_url type="theme_path" />
Or something like that? It’d probably need a special condition to handle it, but then it’s high time we allowed it to output the path to files and images too, so the effort wouldn’t be entirely wasted.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#159 2018-01-09 17:05:19
Re: Textpattern themes: a plan
OK, that sounds viable. Let’s do that :)
Offline
#160 2018-01-09 17:57:00
Re: Textpattern themes: a plan
bici wrote #308591:
is there any roadmap wish list that would include a preference to output all files to a flat directory? i.e. not having to rely on rah_flat plugin ?
You shouldn’t have to rely on rah_flat anyway from 4.7.0 onwards, unless you’re wanting to import prefs and Sections too. No plans to introduce an auto-output in core. From what I hear of rah_flat (other than it’s good) is that it can be quite devastating if the production status is flipped and you forget something. Wouldn’t want to do that in core!
Plugins will be able to do so easily though. All a plugin really needs is a bunch of hooks to also call the ‘export’ routine whenever you do some UI action. A handful of lines of code, I expect. Otherwise, you’ll just have to remember to click ‘export’ every now and again to dump the DB to the file system.
(unless by ‘flat directory’ you mean not in a pages/forms/styles directory structure. In which case, no plans for this at all).
Last edited by Bloke (2018-01-09 17:57:21)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#161 2018-01-09 18:28:46
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:
- 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.
- 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
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#163 2018-01-09 19:15:01
Offline
#164 2018-01-09 19:35:16
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
Re: Textpattern themes: a plan
giampablo wrote #308599:
e da il film: https://www.youtube.com/watch?v=thb8Ov_bW_oCome fosse antani con scappellamento a destra costantinato ammaliti.
… Do NOT use google to translate absolute nonsense!
e che caz!
Last edited by bici (2018-01-09 19:38:12)
…. texted postive
Offline