[title sub="Written by Chris Graham"]Composr Tutorial: Adding standalone pages of content (via Comcode)[/title]

You may easily add new pages of information to Composr by making a 'Comcode page'.

A Comcode page is a page in the system that you can edit either via a [concept]WYSIWYG[/concept] editor, or a very simple [concept]mark-up language[/concept] called Comcode, or a combination of both.

This documentation is written using Comcode in fact.

If you want to write a page without any special formatting, you can just type it out in plain-text, and this will usually be valid Comcode and display as you would expect it to. You can then add 'tags' to identify things such as titles and links.

This tutorial covers some basic information relating to Comcode pages.

[contents]decimal,lower-alpha[/contents]

[title="2"]Default pages[/title]
[surround]
[media width="150" description="The list of Comcode pages to be edited/deleted" float="right"]data_custom/images/docs/tut_comcode_pages/comcode_pages.png[/media]
Comcode pages may be selected for editing either:
[list="a"]
[*] From Admin Zone > Content > Pages (Comcode pages), which gives you a table to choose from.
[*] By clicking the edit link underneath a page being viewed.
[*] Directly editing the txt file for the page in a text editor of your choosing.
[/list]
[/surround]

The default Comcode pages are...
[html]
<table class="columned-table results-table autosized-table">
	<thead>
		<tr>
			<th>Zone</th>
			<th>Page</th>
			<th>Purpose</th>
			<th>Likelihood you will want to edit this</th>
		</tr>
	</thead>

	<tbody>
		<tr>
			<td><em>All</em></td>
			<td><kbd>panel_*</kbd></td>
			<td>Panels are special pages that sit alongside all pages in a zone. They are like shared borders.<br />Composr 10+ does not use left/right panels by default. Some are there out-of-the-box in the system, but blank. If you do panels you can set them up by editing them like normal pages.</td>
			<td>Possible</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>home</td>
			<td>This is the default front-page.</td>
			<td>Very likely</td>
		</tr>
		<tr>
			<td>Site</td>
			<td><kbd>home</td>
			<td>This is the default front-page of the Site zone. It only exists if you do not have the "Single public zone" configuration option (Admin Zone > Setup > Configuration > Site options > Structure) enabled. If "Single public zone" is not enabled then this page is usually used for logged-in users only.</td>
			<td>Very likely</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>sitemap</kbd></td>
			<td>The Site Map, which by default, is automatically generated using a special block.</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>_rules</kbd></td>
			<td>Site rules (or Terms of Service), also shown when joining the website or when join declarations are changed which forces all members to re-agree to them (<kbd>rules</kbd> also exists, which just wraps around <kbd>_rules</kbd> so that it looks good also as a standalone page).</td>
			<td>Very Likely (The Setup Wizard has templates)</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>privacy</kbd></td>
			<td>Privacy Policy (generated automatically by Composr by default).</td>
			<td>Likely (the default does not include everything such as data breach procedures)</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>keymap</kbd></td>
			<td>Keymap of shortcuts, promoted to users on screen-readers (i.e. partially-sighted/blind users).</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>404</kbd></td>
			<td>Shown when requested content cannot be found. We have default [tt].htaccess[/tt] rules pointing broken links to here. This isn't called by Composr when something has found internally to be missing. A missing page in Composr will use the [tt]MISSING_SCREEN.tpl[/tt] template. A missing resource (e.g. category, entry, ...) will use [tt]WARN_SCREEN.tpl[/tt] (as it's just another typoe of warning).</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>recommend_help</kbd></td>
			<td>Usage instructions on recommending the site. Only installed if the <kbd>recommend</kbd> addon is installed.</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Welcome</td>
			<td><kbd>feedback</kbd></td>
			<td>This provides a feedback form, linked from the footer.</td>
			<td>Likely (e.g. to put your contact information)</td>
		</tr>
		<tr>
			<td>Site</td>
			<td><kbd>help</kbd></td>
			<td>Help for your site. Contains default information on points, etc.</td>
			<td>Very Likely</td>
		</tr>
		<tr>
			<td>Site</td>
			<td><kbd>userguide_comcode</kbd></td>
			<td>A basic user-focused guide on Comcode.</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Site</td>
			<td><kbd>popup_blockers</kbd></td>
			<td>Information about how to disable pop-up blockers. Only installed if the <kbd>chat</kbd> addon is installed.</td>
			<td>Not likely</td>
		</tr>
		<tr>
			<td>Site</td>
			<td><kbd>userguide_chatcode</kbd></td>
			<td>Help for the chat system. Only installed if the <kbd>chat</kbd> addon is installed.</td>
			<td>Not likely</td>
		</tr>
	</tbody>
</table>
[/html]

[title="2"]URLs[/title]

[surround]
Like any page in Composr, a Comcode page is accessed by using:
[tt]http://yourbaseurl/<zone>/index.php?page=<page-name>[/tt]

Actually If you are using a URL Scheme, then it may be something else (depending on which [page="_SEARCH:tut_url_schemes"]URL Scheme[/page] you use):
 - [tt]http://yourbaseurl/<zone>/pg/<page-name>[/tt]
 - [tt]http://yourbaseurl/<zone>/<page-name>.htm[/tt]
 - [tt]http://yourbaseurl/<zone>/<page-name>[/tt]
[/surround]

[title="2"]Adding a new page[/title]

[surround]
[media width="150" description="The easy way to add a Comcode page" float="right"]data_custom/images/docs/tut_comcode_pages/comcode_pages_easyadd.png[/media]
There are three ways to add a new Comcode page in Composr.

Method 1:
[list="a"]
[*] Click the browser address bar
[*] Just type in the URL to where you want the page to be
[*] Click the given link to add the missing page
[/list]
[/surround]

[surround]
[media width="150" description="Choosing to add a page" float="right"]data_custom/images/docs/tut_comcode_pages/add_page_box.png[/media]
Method 2:
[list="a"]
[*] Go to Admin Zone > Content > Pages (Comcode pages)
[*] Scroll down to the bottom
[*] Choose your zone, and type a page codename to use
[/list]

You can optionally also select a template to use to help you get started. We will cover templates further down.
[/surround]

Method 3: by manually adding a [tt]txt[/tt] file in the [tt]pages/comcode_custom/(language code)[/tt] directory of the zone you want to add the Comcode page.

[box="A note about manually adding Comcode pages"]
By default, when you add a new txt file for a Comcode page, the Comcode page will be validated and will go live. If you have the [tt]validation[/tt] addon installed and do not want new Comcode pages to go live by default, you can go to Admin Zone > Setup > Configuration > Content editing options > Comcode, and untick (uncheck) "Validate new Comcode pages". With this unticked (unchecked), new Comcode pages manually created (or pulled from Git) will not be validated until you manually validate them.

Note that they will not show up in the list of content needing validated until the first time someone tries to load the page. They will also not show up under Content > Pages (Comcode pages) until the first time someone tries to load them.
[/box]

[title="3"]Proceeding to edit the page[/title]

[surround]
[media width="150" description="The edited Comcode page looks like this" float="right"]data_custom/images/docs/tut_comcode_pages/comcode_pages_view.png[/media]
[media width="150" description="Editing a Comcode page" float="right"]data_custom/images/docs/tut_comcode_pages/comcode_pages_edit.png[/media]
Once the Comcode page editor is open, you can pretty much just type your page in.

This screen is exactly the same both for adding a new page and editing an existing page.


[b]If WYSIWYG is on[/b]:

[indent="20"]
You'll have a nice editor to use.
[/indent]

[b]If WYSIWYG is off[/b]:

[indent="20"]
You'll pretty much type plain-text, with small diversions to indicate special formatting (most notably, the [tt]title[/tt] tag, which every page should include).

See the [page="_SEARCH:tut_comcode"]Comcode and the attachment system[/page] tutorial for an explanation of Comcode.
[/indent]

[title="2"]Deleting pages[/title]

You can delete a Comcode page from the bottom of its edit form or by simply deleting its txt file from the filesystem ([tt](zone)/pages/comcode_custom/(language code)[/tt]).
[/surround]

[title="2"]Page templates[/title]

[media float="right" thumb="0" framed="0"]data_custom/images/docs/advantage.png[/media]
There are a number of built-in page templates available. These are shown when you add a new page from Admin Zone > Content > Pages.

The templates are designed to help you in the following ways:
 - So you don't need to think too hard about what kind of pages your site would benefit from
  - Note we don't provide an FAQ page template because we have a default FAQ catalogue instead
 - So you get some reasonable default layouts and graphics (any website benefits greatly from professional design, but the samples are enough to get most sites started)
 - Specific and detailed advice you can work to, particularly on how to structure persuasive or engaging articles (we think we've saved you a lot of self-education here, bringing together techniques from journalism, PR, sales, and brand marketing, into a single set of convenient techniques)

The templates are stored in the [tt]data/modules/cms_comcode_pages/<lang>[/tt] directory, and new ones or overrides may be placed in the [tt]data_custom/modules/cms_comcode_pages/<lang>[/tt] directory. The template file format is raw Comcode, exactly how Comcode pages are also stored on disk. All templates should have a Comcode [tt]title[/tt] tag, which forms the title of the page template.

[title="2"]Hiding pages from the Sitemap[/title]

There may be cases where you don't want a Comcode page to appear in your Sitemap. The easiest way to solve this is to preface the name of the Comcode page with an underscore (_). For example, pages named [tt]_test[/tt] and [tt]_example[/tt] will not show on the Sitemap due to starting with the underscore symbol. Be aware this does not actually prevent people from accessing the page (if you want to fully hide a page, you will need the [tt]validation[/tt] addon and to turn validation to off when editing the page).

[concepts
 1_key="Comcode page"   1_value="A Composr page written in Comcode, editable from inside Composr"
]Concepts[/concepts]

[title="2"]See also[/title]

 - [page="_SEARCH:tut_comcode"]Comcode and the attachment system[/page]
 - [page="_SEARCH:tut_wysiwyg"]WYSIWYG editing[/page]
 - [page="_SEARCH:tut_adv_comcode"]Advanced Comcode[/page]
 - [page="_SEARCH:tut_adv_comcode_pages"]Using blocks[/page]
 - [page="_SEARCH:tut_url_schemes"]URL Schemes in Composr[/page]
 - [page="_SEARCH:tut_seo"]Improving your search engine ranking[/page]
 - [page="_SEARCH:tut_accessibility"]Helping improve site accessibility for disabled users[/page]

{$SET,tutorial_tags,Pages,Content,core_comcode_pages,Structure and navigation,novice}{$SET,tutorial_add_date,Aug 2008}{$SET,tutorial_summary,How to add new pages, using Comcode. It couldn't be simpler to do: Comcode pages almost look like plain text.}[block]main_tutorial_rating[/block]
