Technically, the resourcefields of a document include every field in the site_content table of the MODX database. Most MODX users don’t need to know that, however, because the resource fields are available to you in several other ways. Here is a list of all the resource fields you are likely to use. The terms at the left refer to the actual field names in the site_content table in the MODX Database. These are the names that you will use in any resource tags referring to these fields. The word or phrase in parentheses is the term used in the MODX Manager (and on the MODX Forums) to refer to the field. If we are referring to the field as it is used in code, we’ll generally use the term on the left. If we are referring to it in reference to the Manager user interface, we’ll usually use the term in parentheses.
Not all of these fields are editable in the Manager.
Because the following list is for reference purposes, the actual field name in the database is listed first (followed by the term used in the Manager in parentheses), and the list is alphabetical. In the section that follows, however, we’ll discuss setting the fields in the Manager on the Create/Edit Resource panel. In that section, the term used in the Manager will come first, and we’ll describe them in the order they appear on the Manager screen.
Resource fields
« a lia s (text — Alias)
■ cacheable (int 0/1 — Cacheable)
■ class_key (int — Class Key of the Resource)
* content (text — Resource Content)
■ content_type (int — Content Type)
» createdon (date — Created On date)
* createdby (int — Created By User ID Number)
■ deleted (int 0/1 — Deleted)
* deletedby (int — Deleted By User ID Number)
* deletedon (date — Date of Deletions)
■ descrip tio n (text — Description)
« editedon (date — Edited On date).
» editedby (int — Edited By User ID number)
■ hidemenu (text — Hide From Menus)
■ id (int — Resource ID)
* in tr o te x t (text — Summary)
■ is fo ld e r (int 0/1 — Container)
> lin k _ a ttrib u te s (text — Link attributes)
* lo n g title (text — Long Title)
■ menuindex (int — Menu Index)
* m enutitle (text — Menu Title)
■ p a g e title (text — Page Title)
■ parent (int — Parent Resource)
» pub_date (date —Publish Date)
* published (int 0/1 — Published)
■ publishedby (int — Published By User ID Number)
* publishedon (date — Published On)
* ric h te x t (int 0/1 — Rich Text
■ searchable (int 0/1 — Searchable)
> tem plate (int — Template ID number)
* unpub.date (date — Unpublish Date)
■ uri_override (int 0/1 — Freeze URI)
« u ri (string — URI)
In the following sections, we’ll refer to the fields by the prom pts on the Create/Edit Resource panelin the Manager because that’s what you’ll see when you enter the field values in the Manager. We’ll put the actual field name in parentheses at the top of each section. For the pagetitle field, for example, the prompt in the Manager is simply
“Title” even though pagetitle is the actual field name.
You set the values of some of the fields in the form on the right side of the Create/Edit Resource panel. You set others in the Page Settingstab. Some are created automatically when you perform actions on the resource (e.g., createdon). They are all resource fields, however, and all of the ones on the list above are available by using resource tags.
Remember that when you refer to a field in code or in a MODX tag, you need to refer to the actual database field name rather than the label used in the Manager.
Although the field captions in the Manager begin with uppercase letters, all the actual field names are in lowercase. If you capitalize a letter in a resource tag, MODX won't recognize the tag and nothing will appear in place of the tag.
Let’s look at the fields in more detail. As we mentioned above, the headings in this section are reversed from the list above. They have the Manager term for the field first, and then (in parentheses), the actual name of the database field. The term in parentheses is what you must use to refer to the field in code or in MODX tags. We’ll start with the fields that are set on the Create/Edit Resource panel:
Resource ID (id)
We discussed the Resource ID (id field) earlier. A Resource IDis a unique number that identifies a resource in MODX. The Resource ID is shown in parentheses next to the resource’s name in the Resource tree of the MODX Manager. It also shows at the top of the Create/Edit Resource panel. It is sometimes referred to as the document identifier or the document ID,but Resource IDis the correct term for it because it also is used for Weblinks, Symlinks,and Static Resources.When used to refer specifically to a document, though, especially on older documentation or MODX Forum posts, you may still see it called a document ID.
MODX automatically assigns Resource IDs when you create a new resource. Users some
times ask how they can change them because after a while, the numbers can get large and out of sequence. If you are a MySQL wizard, you could change them directly in the database, but MODX strongly recommends that you never change Resource ID numbers
for example, assume that these numbers will never change, and altering the IDs could cause problems that would be hard to spot and even harder to fix. Most MODX users just get used to the numbers being arbitrary, and front-end users will never see them.
If you really care about the numbering sequence, you can build your site structure on paper and create the documents in order. That way, the Resource ID numbers will be in sequence. Remember, too, that you can reuse Resource IDs by unpublishing obsolete documents rather than deleting them (or deleting them but not emptying the trash) and just editing their resource fields rather than creating a new document. That will keep your Resource ID numbers lower. Generally, though, it’s a lot easier just to live with the IDs that MODX assigns.