|
Admin > Code Generator
Using the Code Generator, you can quickly create some customized code for your index page and detail page viewers.
Below we will go through the steps to create the code for a News List page and Detail page.
Steps to create a News List (index) page:
- Choose News from the Select Section dropdown list and choose the Viewer Type radio button for List page. This will publish a page that shows a list of one or more records.
- Choose the Viewer Options for your "News" index. For example, in the "How Many" section, I will select the radio button for "Show 10 records per page..." and replace 10 with 5. Now the News index is limited to 5 records per page (with prev $amp; next page links).
- After all options are selected, click the "Show Code" button to generate the code.
Steps to create a News detail (article) page:
- Choose News from the Select Section dropdown list and choose the Viewer Type radio button for Detail page. This will publish a single record.
- Choose the Viewer Options for your "News" detail page (see . The default options are used in most situations but additional options are available for sites with unique requirements.
- After all options are selected, click the "Show Code" button to generate the code.
Note:The Viewer Options for List Page and the Viewer Options for Detail Page are different. See below for more details.
- Create New Viewer
- Select Section
- From the dropdown list, choose the section to generate PHP code for. The section list includes all the sections you have created.
- Viewer Type
- List page - show a list of one or more records. The List page viewer type can be used to generate code for an index pages.
Some example index pages: news, blog, faqs, quotes, job listings etc.
Detail page - show details about a single record. The Detail page viewer type can be used to generate code for single pages. Some examples of single pages: news story, blog post, featured client, about us page, contact page etc.
- Viewer Options for List Page
-
- How Many
-
Show all records - displays all the records from the section on one page
Show the first # records only (replace # with the number of records that you want to show)
Show # records per page with prev & next page links (replace # with the number of records that you want to show per page)
- Record Sorting
-
Default - use same sorting as editor (recommended)
Random - show records in random order
Advanced: Use this MySQL "Order By" clause (example: "date DESC, title")
- Show uploads
- Leave this box checked to output the code to show file uploads on your viewer page.
- Allow Searching
- Filter results based on search form input (disable for multiple viewers on one page)
- Filter Results
- Advanced: Only show results that match this MySQL "Where" clause
- Viewer Options for Detail Page
-
- How Many
-
Show all records - displays on the records that are
Show the first # records only
Show # records per page with prev & next page links
- Record Sorting
-
Default - use same sorting as editor (recommended)
Random - show records in random order
Advanced: Use this MySQL "Order By" clause (example: "date DESC, title")
- Show uploads
- Leave this box checked to output the code to show file uploads on your viewer page.
After choosing the Section, Viewer Type (either List Page or Detail Page) and Viewer Options, click the "Show Code >>" button to generate the PHP code.
|