Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2015-06-22 11:58:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,452
Website GitHub

Re: Textpattern themes: a plan

NicolasGraph wrote #291796:

I didn’t know if same form names in different themes could cause problems with the db.

They will today, but if we introduce a new ‘theme’ column and set it up properly, then multiple themes can use the same Form name without issue.


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

#92 2015-06-22 12:01:19

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

Re: Textpattern themes: a plan

Or we can not use the database at all?

Offline

#93 2015-06-22 12:05:28

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Textpattern themes: a plan

Bloke wrote #291797:

They will today, but if we introduce a new ‘theme’ column and set it up properly, then multiple themes can use the same Form name without issue.

Ok, thanks. It is also nice to use the form type as a prefix to sort the forms.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#94 2015-06-22 12:06:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,452
Website GitHub

Re: Textpattern themes: a plan

philwareham wrote #291798:

Or we can not use the database at all?

That too. But see here.


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

#95 2015-06-22 12:07:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,452
Website GitHub

Re: Textpattern themes: a plan

NicolasGraph wrote #291799:

Ok, thanks. It is also nice to use the form type as a prefix to sort the forms.

Yeah, I like that too. It might be even better if we get to define our own Form types as well :-) But then again, it might not work with themes as that would imply creating Types on the fly when a theme is installed.


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

#96 2015-06-22 12:15:56

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Textpattern themes: a plan

Bloke wrote #291791:

I was thinking more like:

  • Themes
    • abc_theme
      • Pages
        • default.txp
        • about.txp
      • Forms
        • article.default.txp
        • misc.footer.txp
        • section.layout.txp
      • Styles
        • cobalt.txp

Here’s how the default 4.6 theme looks like:

/home/www/textpattern.dev/_templates/default_4.6-dev
├── forms
│   ├── article_listing.article.html
│   ├── comment_form.comment.html
│   ├── comments.comment.html
│   ├── comments_display.comment.html
│   ├── default.article.html
│   ├── files.file.html
│   ├── images.misc.html
│   ├── plainlinks.link.html
│   ├── popup_comments.comment.html
│   ├── search_input.misc.html
│   └── search_results.article.html
├── pages
│   ├── archive.html
│   ├── default.html
│   └── error_default.html
└── style
│ ├── default.css
│ └── ie8.css

3 directories, 16 files

As for the extension, I settled on .html because of the automatic syntax highlighting in editors. You could use .txp and add specific txp:tags to the editor’s available languages if you so desire. Now if Type becomes part of Themes, then the above forms listing would have default.html instead of default.article.html.

I’ve been using Textpattern for many years, there are things in the backend that I’ve never used, like article form preview, or the tag builder, or form type as I’ve pointed out here. As TXP moves forward, if certain legacy features pose a dilemma, a mental roadblock, then my vote is for ctrl-x.

Offline

#97 2015-06-22 16:15:39

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: Textpattern themes: a plan

Since I use flat files for my templates, I’ve been dealing with .txp file extensions for years, in several editors. I’ve had no trouble at all getting editors to treat .txp files as HTML.

For fellow vim users, this is what your .vimrc file needs:

au BufNewFile,BufRead *.txp set filetype=html

It is important, though, to retain a separate file extension for stylesheets, and .css works fine for that. It’s the default extension for stylesheets handled by cnk_versioning.

Offline

#98 2015-06-22 16:22:43

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

Re: Textpattern themes: a plan

I also use the .txp file extension without any trouble (in Panic Coda) so as long as that filename can also be used in addition to .html I’m fine with your suggestion.

Offline

#99 2015-06-22 17:08:04

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: Textpattern themes: a plan

I agree with the discussions around the theme folder structures – they should definitely be isolated form each other.

The whole section issue though, is for me a massive issue.

99.9999% of the sites i have built with Textpattern have been company website selling a product or service. They may have had a blog on the side as a subsection.

This means Textpattern’s context sensitive and natural “lets display everything that exists on the home page chronologically” totally goes out the window. I usually create a Home section a pull a sticky from it into the default page template, thus faking a home page.

If we cannot control creation and naming of sections during theme installation, this definitely for me makes it less useful.

Last edited by CodeWalker (2015-06-22 17:11:14)

Offline

#100 2015-06-22 17:14:36

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Textpattern themes: a plan

philwareham wrote #291822:

I also use the .txp file extension without any trouble (in Panic Coda) so as long as that filename can also be used in addition to .html I’m fine with your suggestion.

.txp is fine, nobody really uses that extension.

I can configure Notepad++ to recognize .txp as HTML, and with a special txp:tag syntax file, I could get KomodoIDE to recognize TXP tags within a .txp document. Actually, in hcg_templates I can configure the extensions for Pages, Forms and Styles for export and import. Over the years I’ve experimented with different extensions, and the plugin ships with .page, .form and .css as extensions.

Whenever we have a finalized directory structure, naming scheme and where does this Themes folder reside, I can change my plugin to reflect said changes and start making some Themes. I can call it hcg_themes, keep the old plugin around for historical purposes.

Offline

#101 2015-06-24 22:07:18

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

Re: Textpattern themes: a plan

Off topic slightly but because it was mentioned in the thread, the admin-layout-update branch is back on the GitHub project where the pages/forms pages are much wider (without tag builder – which I will find another way of housing).

Offline

#102 2015-06-24 23:17:13

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Textpattern themes: a plan

philwareham wrote #292012:

Off topic slightly but because it was mentioned in the thread, the admin-layout-update branch is back on the GitHub project where the pages/forms pages are much wider (without tag builder – which I will find another way of housing).

Installed it, playing around with, mucho like.

Got this error on installation (didn’t get it with either 4.5.7 or 4.6-dev).

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/www/zendstudio/textpattern-alu/textpattern/setup/txpsql.php on line 31

Offline

#103 2015-06-24 23:22:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,452
Website GitHub

Re: Textpattern themes: a plan

hcgtv wrote #292013:

Deprecated: mysql_connect():

That’s a PHP time bomb waiting to explode. Needs attention in fairly short order.

Unsure why it didn’t bitch in 4.6-dev master, as the setup routines between branches should be the same. Meh, weird. Either way it’s an annoying, but known, fault that requires time and some grunt work to fix.


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

#104 2015-06-25 20:52:14

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

Re: Textpattern themes: a plan

Bloke wrote #292014:

Either way it’s an annoying, but known, fault that requires time and some grunt work to fix.

Anything that can be farmed out to other (helpful) grunts, Steffykins?

Offline

#105 2015-06-25 21:27:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,452
Website GitHub

Re: Textpattern themes: a plan

gaekwad wrote #292084:

Anything that can be farmed out to other (helpful) grunts, Steffykins?

Anyone who knows about PDO, sure, be my guest.

PHP have (rightly) dropped direct MySQL support in favour of the (mostly improved) PDO. It does have glaring omissions — like having to manually create IN parameter lists, when array support would be far more logical — but on the whole it’s a truckload better.

The PHP team are still supporting mysqli, which could be a quick fix as the functions are broadly similar. So it could be a simple case of going through txplib_db.php and everywhere you see mysql_*, replace it with mysqli_* and hope. Doubt it’s that simple as I bet the parametric nature of the calls will require tweaks to our DB layer, but something along those lines would certainly shut the warnings up and give us time to think. And it’s less invasive than a full PDO switch.

Longer term we probably need to move to PDO in some capacity. That opens up the possibility of supporting other database engines (w00t!), although we would need to weed out the MySQL-specific hacks that are dotted around the place first. We could just swap all mysql_* calls for PDO-esque calls and refactor all the safe_*() calls to build parameter lists and it’d work, but you end up reinventing quite a bit as most of the time you want to load your data from the database into objects (we currently load ours into arrays, which are nice and simple, albeit not as well structured as objects). That then becomes an ORM. So the other option is to save all that hassle of writing your own ORM and use an existing framework.

But that comes with baggage. Things like Doctrine or Propel are behemoths that would potentially quadruple the size of Txp, twice over. You don’t have to use the whole library I suppose, but while it gives you a leg up (once you’ve learnt the API, which is no mean achievement) it’s akin to using the Symfony PHP framework. That’s something ridiculous like 38MB of cruft and OO before you’ve written a line of code. Not my idea of fun and lightweight. I did find NotORM which would be my favoured approach as it’s tiny (about 50KB) and does everything Doctrine does (and more) in a far simpler package. But it’s arguably not as well supported as the big boys so I doubt it’ll get adopted.

You sign on the dotted line I guess and makes your choice …


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

Board footer

Powered by FluxBB