Alan Hogan

Feed
  

The “Pages” Database Table

A description of the fields or columns in the “Pages” database table of HS-CMS

Overview

Each of your sites will have its own Pages table.

In theory, this table is created when you run the automated

All the pages in your HS-CMS powered site, even if they are actually static files and not ever touched by HS-CMS, should have at least one entry in this table. Fields, values, and implications are listed below.

Fields

Column: id

This is the page ID and, is more accurately, a unique id for the row in the database. Do not specify its value ever; MySQL should automatically assign one. If you do assign it, it needs to be unique.

Other tables, such as one containing comments, can use this field as a “foreign ID.”

Column: url

This is the URL the public can see, after the domain. The url field should never contain opening or trailing slashes, with the exception of the home page, which is just a slash: /

Thus the following are examples:

/
about
company/history
learn/css/hacks
contact

(If this seems bizarre, well maybe it is. I borrow convention from Drupal here, and improve upon it; at least you have no node/foo URLs! Also, fewer slashes means quicker typing and fewer mistakes!)

If you want the trailing slash I just told you to avoid, that’s ok. There is a configuration option to use trailing slashes. However you should still not add them here. (Subject to change.)

It is worth noting that in the case of app pages, any requests not matching another page but beginning with the app’s url will be handled by the app. If they should really result in a 404, it is the application’s job to raise that error.

Also, this is the “match” part of an alias. If the URL ends with the percent sign, %, that symbol considered a wildcard and the URL will, like apps (which do not require the asterisk), match URLs beginning with that URL. (If an app does not want the expanded matching capabilities, it should be a ‘dynamic’ page instead.)

Column: type

This field is just an ENUM, or list of several allowed values, but is very complex in its implications.

Please see the Type field of the Pages table page.

Column: format

This is a VARCHAR(255) and you can specify any valid list of comma-separated formats.

Valid formats include markdown, xhtml, php, and any other formats you install.

Column: file

If this is a page or app of some sort, this field needs to contain the relative path to the content for this page from hscms/sites/yoursite/content/ It should not start with a slash. Note that this can include pages not in your /content/ folder — a useful way to to share pages between sites, for example. WARNING: This is a potential security risk, AND the editing of such a page would only show up as a revision in one site. Examples of non-alias file fields:

  • aboutus.text
  • contact.php
  • foo/bar.xhtml
  • ../../../copyrights/_HS_Copyrights_READ_ME.text

Important: For alias-type pages, “file” is not the path to a file, but rather the exact URL of the real page. No asterisk is ever necessary in this field, even for wildcard aliases. Note, if this is an alias to a page on your site (same domain), you don’t need (and, for portability, shouldn’t put) the http://example.com part of the URL. So if you have resume redirect to cv, don’t put http://example.com/cv in the file, just put cv.

Column: description

Obviously, a description of the page. Will be used in the meta description tag (which shows up on search engines) and across the site, say, in lists. Should not include HTML or anything special. This field is a TEXT field.

Column: status

The status is fairly straightforward, except for that it is represented by a tinyint to save space. Values:

  • -1 indicates draft and is not publicly viewable, but is intended to be so soon.
  • 0 indicates hidden and only viewable by the administrator(s).
  • 1 indicates published and fully viewable by anyone.

Other possible values could be added in the future, such as sticky, promoted, deleted, spam, etc.,

Column: created

This field is of the MySQL DATETIME type, and stores the creation date and time in YYYY-MM-DD HH:MM:SS format, 24-hour time, in the UTC timezone.

It should indicate when the material was first published, but is your discretion if you wish to use this field for the time your content was added to your HS-CMS powered website (automatic/leave blank) or when published anywhere (i.e., backdate).

Column: updated

This field is also of the MySQL DATETIME type, and stores the date and minute of the last content update in YYYY-MM-DD HH:MM:SS format, 24-hour time, in the UTC timezone.

It should be initialized to the same value as created.

Column: tags

Tags is simply a comma-separated list of tags, up to 255 characters of them (i.e. it is VARCHAR(255)). (Unicode characters which are two bits may cut down this limit.) In theory you should be able to convert this column to TEXT

Column: comments_enabled

  • 3 forces comment reading & writing
  • 2 allows comment reading & writing (rules such as time limit may apply)
  • 1 displays comments but disables writing
  • 0 allows for default, based on rule & page type
  • -1 disallows comment reading or writing

Column: render_engine

This can be left blank for the default rendering engine, or filled in with a rendering engine short name. VARCHAR(127).

Column: skin_andor_theme

This column, which can be left blank, is a VARCHAR(255) which should be handled entirely by your rendering engine. Hint: Use IDs, not strings, to avoid using too many characters.

Column: robot_friendly

  • 1 to override the default robot visibility to allow bots
  • 0 for the default robot visibility (that is, allow robots to crawl it based on page type)
  • -1 to override the default robot visibility to disallow bots

Contact

If you have questions after carefully reading this page or have corrections to suggest, please do not hesitate to contact me.

Original content, graphics, and code © Alan J. Hogan 2000–2008. Contact me.

Other work © respective authors.

Site map