This post originated from an RSS feed registered with PHP Buzz
by Forum One.
Original Post: Thinking Like SyntaxCMS: Components of SyntaxCMS
Feed Title: Syntax Framework
Feed URL: http://blog.syntaxcms.org/rss.php?version=0.91
Feed Description: Finally, a place to answer Syntax questions
This is part of a series on how to think like SyntaxCMS.
Content Types
The fundamental idea of a SyntaxCMS site is the content type. This is analogous to a "class" in object-oriented programming. In the API documentation and the programmer tool, you will see it referred to as a "datatype", but it's easier to communicate the idea of it to non-technical people by using the term "content type". A content type is any uniform type of data you want users to be able to access. Included are such content types as Events, Articles, Documents, and Third Party Links. Likely you have different types of content you'll want to maintain a directory or listing of on your site, such as Member Organizations. In addition, you can think of the parts of an interactive tool as content types. For example, a blog consists of Posts, Comments, and Trackbacks.
If you were programming a site from scratch using Object-Oriented Programming (OOP) you might think in these terms. SyntaxCMS frees you up from the from-scratch programming and database design you would ordinarily have to do, so you can spend your time thinking about how to break your site's content into structured content types. Accordingly, a record you create in the database is a content object. Much of what you do in programming SyntaxCMS is the manipulation of content objects. SyntaxCMS will let you use a web-based interface to define, edit, and delete properties of content types and will generate classes and other code to let you manipulate them in your site.
Site Sections
A special case of a content type is the site section. Site sections are special in that they can be thought of in two ways. First, they act like flat HTML pages in a navigation tree like you may remember from the Bad Old Days. However, they are easier in that they can be created on the fly, there are tools to let SyntaxCMS automagically generate the navigation for them and update it when you rearrange the site sections, and their content can be edited in a form in the administrative tool. Second, they can be thought of as "containers" for arbitrary collections of content objects.
Each content object has the built-in capability to be "published" to a site section. If your organization is holding a conference, you may wish to display events, conference papers, and general information articles in a single place separate from any calendar or document library your site may contain. Simply create a site section with the necessary introductory text and manually select the appropriate content objects and publish them to that section.
But what if you want to separate out some key articles or events for that conference? By default, SyntaxCMS comes with the ability to publish in two ways: normal and "featured". SyntaxCMS gives you the ability to filter how something has been published to a site section and display content accordingly. But what if you have "featured" documents, "key" documents, and run-of-the-mill documents? SyntaxCMS lets you expand the number of publishing types to as many as you like. Just set up a couple of defines and you're set.
Pick Lists
What if you are or are working with a records-management or information architect-type person who wants a way to classify all your content objects across the site, so they can be categorized and searched for? In other words, what if you want a "controlled vocabulary", like a standard list of countries?
The SyntaxCMS way is to create a pick list. Essentially, it's a small database table that contains your vocabulary and lets you put access to it in any appropriate content type. So all your site authors have to do is put in their article content and pick which country or countries it applies to. Then you can either let SyntaxCMS create a browseable list for you, or you can cleverly use it to group or filter lists of content elsewhere on the site.
Modules
The way you construct the complex behaviors and filtering of content types is through modules. Modules can also stand alone, which is good for more complex behavior like the included Calendar module in SyntaxCMS. Each module is made up of capabilities, which can either be called through the API or addressed directly in the browser. Capabilities are just basic PHP scripts which can share a library of classes or functions with the rest of the module.
Templates
Templates are used throughout SyntaxCMS. They are simply PHP files, but they follow a couple of conventions: they are named .tpl, they contain only display logic, and to every extent possible, they do not use print or echo statements to produce HTML, but rather switch context out of PHP whenever possible.
Templates can be global, site section, or module templates.
Global templates are used throughout the CMS and are found in /private/templates/ and in various subdirectories.
A special subdirectory is /private/templates/section/, which contains custom site section templates. To override the default section template (/private/templates/section.tpl), just place a template with the same file path and name in that subdirectory. So if a site section is found at http://www.syntaxcms.org/section/test/my_section/, a custom template for it would be found at /private/templates/section/test/my_section.tpl.
Module templates are found in the templates subdirectory of each module (/private/modules/{module name}/templates/). For most modules, there is list.tpl, listitem.tpl, listitem-featured.tpl, and detail.tpl. list.tpl controls how a list of items will be displayed, listitem.tpl controls how each individual list entry will be displayed, listitem-featured.tpl controls how featured items will be displayed, and detail.tpl controls how a detailed view of a content object is displayed. SyntaxCMS will automatically look for these before using the default templates (in the general module), so their naming is important.
Admin Application
This is the application that site administrators will use to create and update content.
DBasis (Developer Administration)
This is the application developers use to create and update content types, set CMS-wide preferences, and view and edit the complete content of a site.