Code Generator
Using the Code Generator (CMS Setup > Code Generator), you can quickly create customized code for your index page and detail page viewers.
The Code Generator homepage lists the available generators as links: List Page, Detail Page, Combo Page, RSS Feed, and Category Menu. Click a generator to open its options page, where you choose a section from the Select Section dropdown and configure the generator’s options.
Creating a News List (Index) Page
Section titled “Creating a News List (Index) Page”- Click the List Page generator link to show a list of one or more records
- From the Select Section dropdown, choose News
- Configure the Viewer Options for the News index. For example, select “Show # records per page…” and specify a number such as 5
- Click the Show Code button to generate the PHP code
The List Page generator is suitable for news, blogs, FAQs, quotes, job listings, and similar sections.
Creating a News Detail (Article) Page
Section titled “Creating a News Detail (Article) Page”- Click the Detail Page generator link to show details about a single record
- From the Select Section dropdown, choose News
- Configure the Viewer Options for the News detail page
- Click the Show Code button to generate the PHP code
The Detail Page generator works for a news story, blog post, featured client, About Us page, contact page, and similar pages.
Viewer Options for List Page
Section titled “Viewer Options for List Page”How Many:
- Show all records on one page
- Show the first # records only
- Show # records per page with prev & next page links
Record Sorting:
- Default — uses the same sorting as the editor (recommended)
- Random — show records in random order
Show Uploads:
- Show all uploads
- Show # uploads
- Don’t show uploads
Allow Searching — filter results based on search form input (disable for multiple viewers on one page)
Expert Mode — don’t show instructions or extra HTML in generated code. This checkbox appears on every generator, and the setting is remembered per browser.
Viewer Options for Detail Page
Section titled “Viewer Options for Detail Page”Which Record:
- Single record sections: load the first record in the database
- Multi record sections: get the record # from the end of the URL (e.g.,
viewer.php?record_title-3) - Custom: load a specific record #
Show Uploads — same show all / show # / don’t show options as the List Page generator
Viewer Options for Combo Page
Section titled “Viewer Options for Combo Page”The Combo Page generator creates a single page that handles both views: a list of links to records, and full details for the currently selected record.
Select Section — the section to generate the viewer for
How Many:
- Show all records
- Show the first # records only
Title/Name field — the field used as the link text for each record in the list. The dropdown loads the chosen section’s text field, text box, and WYSIWYG fields.
Show Uploads — same show all / show # / don’t show options as the List Page generator; applies to the detail record
Feed Options for RSS Feed
Section titled “Feed Options for RSS Feed”Select Section — the section to generate the feed from
How Many:
- Show all records
- Show the first # records only
Feed Title / Feed Link / Feed Description / Feed Language — the feed’s channel details: name, website URL, description, and language code (e.g., en-us). All four are required.
Title field and Description field — the fields used for each item’s title and description; both required. The dropdowns load from the chosen section’s text field, text box, and WYSIWYG fields.
Viewer Options for Category Menu
Section titled “Viewer Options for Category Menu”Select Section — only category sections are listed
Category Format:
- Show All
- One Level
- Two Level
- Breadcrumb
Output HTML Style:
- Unordered List (UL, LI tags)
- Indented Text
Default Category:
- None — no category will be selected
- First — the first category will be selected
- Category — a specific category you choose will be selected
Category Root (under Advanced Options) — for menu branches; only categories below this one will be displayed
Using the Generated Code (Show Code)
Section titled “Using the Generated Code (Show Code)”Clicking Show Code on any generator opens the Show Code page, which displays the generated PHP code.
Save this code
Section titled “Save this code”Save the code and modify it to match your site design. The page’s instructions suggest a filename of the form {table}-{suffix}.php (for example, blog-list.php for a List Page), but you can choose your own name. The generated page is plain by default to make it easier to drop the code into an existing site template.
Next, upload the file to your desired location on the site. For example, you might upload to: http://www.example.com/blog.php
Update the Viewer URLs
Section titled “Update the Viewer URLs”Once you’ve saved and uploaded your generated code, update the Viewer URLs for the corresponding section (the Show Code page’s instructions link there directly):
- Navigate to CMS Setup > Database Editor
- Select the modify option for your section (for example, Blog)
- Click the Viewers tab on that page
- Enter the URL where you uploaded the generated code
This lets the program know where the pages are located.