← Back to DAGDA | Support | Source: https://github.com/bryantara/txp-h5bp-theme
Skip to content

About

The Textpattern CMS default theme (as of v4.5 onwards)

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

txp-h5bp-theme: the Textpattern CMS default theme (4.6 branch)

Please note: Textpattern 4.6 onwards will drop support for Internet Explorer 7

This project is the default theme that ships as standard with Textpattern CMS as of v4.5 onwards. It is intended as a starting point for new users learning the Textpattern CMS for the first time or existing users that want to adapt their current code for modern standards, and is not intended as a finished production theme (though you could use it as such if you want to).

Features

  1. The code is commented throughout with helpful information to help you learn some of the techniques and tags available within Textpattern.
  2. Current best practices gathered from all over the web – in particular the HTML5 Boilerplate.
  3. Mobile first structure.
  4. Responsive CSS layout adapts to various device screen sizes, from 320px to over 1280px.
  5. Adheres to the Schema.org microdata format.
  6. Includes Sass version of CSS for rapid development.
  7. No images used at all.
  8. Tested on a wide range of devices, browsers and operating systems.

You can see the latest version of the theme running at http://www.philwareham.co.uk/.

Before you begin (fresh installs)

Adjust Textpattern preferences

Essential

  1. Check ‘Automatically append comments to articles?’ is set to ‘no’. More info.
  2. Check you have the latest Textpattern language database update, new data was added to the Textpattern language server from 31/08/11 onwards specifically to support this theme. Go to the preferences, language tab – if you are not already running the latest language version there will be a prompt to update next to your installed languages. Click on ‘update’ and an up-to-date language table will be automatically loaded.

Recommended but optional

  1. You may decide you don’t want to leave Textpattern managed images files loose in the ‘images’ directory – it may be tidier (and more secure) to create an additonal ‘cms’ directory within the ‘images’ directory and use that for any Textpattern managed images instead. You then set the Textpattern advance preference ‘Image directory’ to your new directory ‘images/cms’. Make sure that PHP is able to write to ‘images/cms’ (usually chmod 777) – you can also set the original ‘images’ directory back to something more secure (such as chmod 755).
  2. Removing ‘sbl.spamhaus.org’ from the advanced preference ‘Spam blacklists (comma-separated)’ may yield a (very minor) speed increase.
  3. You might want to set ‘New comment means site updated?’ to ‘Yes’ since search engines like fresh content.

Delete surplus forms

There were a number of forms and pages that formed part of the original default theme for Textpattern. For the most part we will be reusing those existing forms with our own code. However, there are some forms you can safely remove from the system as we will not be using them (in fact the original default Textpattern theme does not require them either – they are mostly left over from earlier versions of Textpattern and not used any more).

You can safely delete the following forms from your fresh install:

  • link (link type form)
  • lofi (article type form)
  • noted (link type form)
  • single (article type form)

How to use these files

Textpattern differs from many CMS solutions in that it stores the all template files (used to build the final page a browser sees) directly in the database as ‘styles’ (the CSS styling), ‘pages’ (the main page templates) and ‘forms’ snippets of code and logic that form building blocks within the ‘pages’.

However, many coders like to use their preferred IDE (integrated development environment) to write code and leverage all the tools within those applications provide to make code writing easier. That means you will have to copy/paste from your IDE into the corresponding parts of the Textpattern admin-side which adds a bit of time.

With CSS files you could simply use external stylesheet and link in the traditional way (see below). However there is another solution in the form of the ‘cnk_versioning’ Textpattern plugin, which effectively moves the ‘styles’, ‘pages’ and ‘forms’ back out of the database and into external directories for easier editing – a good solution when used in combination with an IDE. If you do use that plugin then dropping the files from this project into your correspondingly named directories will suffice. Detailed information on how to use cnk_versioning is available at the Textpattern forum.

CSS

/css/default.css

You can either copy/paste the whole stylesheet into admin area → presentation → style → default, and link as:

<txp:css format="link" />

or serve as an external stylesheet and link as (for example):

<link rel="stylesheet" href="/css/default.css">

There are advantages/disadvanatges to both methods…

Keeping style within the database by using the first method means you can make adjustments to the code without the need for FTP or a text editor, but is less flexible because you either lose the tools available in a dedicated IDE (integrated development environment) or have to paste your new code from the IDE which is time consuming. You can however make use of versioning tools such as ‘cnk_versioning’ Textpattern plugin to streamline this process somewhat (see above). Serving CSS from a mySQL database is significantly slower than serving as a static file.

The second (and recommended) method of serving as an external stylesheet is much more flexible though it relies on you having FTP access to change the CSS files. This static file is quicker for a browser to load, so your page will render slightly faster.

/css/default.scss

Sass version of the CSS file, users familiar with the Sass language can utilise this optional source file for rapid development of their own themes.

JavaScript

/js/css3-mediaqueries.js

Makes Internet Explorer 6-8 test and apply CSS3 media queries. This script can be removed if you don’t intend to support IE less than version 9 (remember to also remove the corresponding link in the page <head> section of page templates).

/js/html5shiv.js

Provides basic HTML5 support for Internet Explorer versions 6-8. This script can be removed if you don’t intend to support IE less than version 9 (remember to also remove the corresponding link in the page <head> section of page templates).

Forms

The forms follow the cnk_versioning standard of labelling, in that ‘xxxx.misc.txp’ is a misc type form, ‘xxxx.article.txp’ is an article type form, etc. This is only for file structure, when you actually create new forms within Textpattern you should not include the ‘.xxxx.txp’, just the first part of the filename. See the analytics form description below.

/forms/article_listing.article.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to display listings of articles and is called from the ‘default.txp’ page when viewing category lists of articles, and the ‘archive.txp’ page when viewing the archive list of articles.

/forms/comment_form.comment.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to format the form for inputting comments.

/forms/comments_display.article.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to display all the comments features, and calls other comment type forms.

/forms/comments.comment.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to display the individual comments.

/forms/default.article.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to display the written article, either as an individual article of part of a set of articles. When called on an individual article basis this form also calls the ‘comments_display.article.txp’.

/forms/files.file.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. You can call this form from within an article by simply using <txp:file_download id="xxx" /> (you don’t need to specify a form name as ‘files’ is the default form for files) – you can also call this form from within other any other forms and pages using the same method (just mind your <p>’s).

/forms/images.misc.txp

Create a new form in the system with name of ‘images’ and type of ‘misc’, then copy/paste the code from this file into it. This form can optionally be used in your page/form templates. You could also, for example, display article_images by inserting the following code into a written article…

notextile. <txp:images form="images" />

…you should use the notextile. prefix in this instance because the HTML <figure> tag cannot be wrapped inside a <p> tag.

/forms/plainlinks.link.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. You can call this form from within a form, page or article by using <txp:linklist /> (you don’t need to specify a form name as ‘plainlinks’ is the default form for links).

/forms/popup_comments.comment.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Used to display the comment system in a new window if you set ‘Comments mode’ to ‘popup’ in the Textapttern preferences. If you don’t need the popup comments feature (quite likely) then you can safely remove this form from the system.

/forms/search_input.misc.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. Note that this form makes use of the following tag…

<txp:text />

…which is used to target language strings from the database ‘txp_lang’ table for the language you set in the Textpattern preferences. For example to display ‘Search’ in your chosen language the tag would be:

<txp:text item="search" />

You can get a idea of the items you can target with this tag by looking through the specific language file within the textpattern → lang directory which was created as part of your installation. You would probably not use this tag very often unless you were designing a multi-language site as it adds needlessly to the amount of PHP database calls (that is also true for other tags such as <txp:site_name />) – it’s included here purely as an example of what the tag is for.

/forms/search_results.article.txp

Copy/paste over the existing form of the same name that was part of the standard Textpattern install. This form displays the search results, if any exist.

Pages

/pages/archive.txp

This page template is utilised when viewing a list of articles.

Copy/paste over the existing page of the same name that was part of the standard Textpattern install.

/pages/default.txp

This page template is utilised as the standard page layout.

Copy/paste over the existing page of the same name that was part of the standard Textpattern install.

/pages/error_default.txp

This page template is utilised when viewing a page error (such as a 404 page not found).

Copy/paste over the existing page of the same name that was part of the standard Textpattern install

Design patterns Textile/HTML reference page

/design-patterns-page.textile

This is a reference file you can use when authoring themes, it contains many of the valid HTML5 tags (and their equivalent Textile format where available) that should be accounted for in your designs. Paste this code directly into a Textpattern article (please note that some HTML5 tags are not fully supported by browsers yet).

License

Non-core components:

  • jQuery: MIT/GPL
  • jQuery Cookie: MIT/GPL
  • Google Code Prettify: Apache License v2.0
  • ResponsiveSlides.js: MIT

Everything else:

Released under the GNU General Public License, see license.txt for terms and conditions.

About

The Textpattern CMS default theme (as of v4.5 onwards)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors