-
Notifications
You must be signed in to change notification settings - Fork 0
Adding content
Currently content is added in a static way, meaning you need to upload the content to the website. The Tsama roadmap does make provision for database content but it is yet to be developed.
Images or other media content can be uploaded to the /content/media/visual/images
folder.
Tsama stores its images under the default
folder there.
Pages are added in the /content/pages/library/
folder.
First you need to create a folder named after the key value (used in urls) for your page. E.g. My Awesome Page can have a key of my-awesome-page
Within your folder create 3 files.
index.php
This file is used to redirect people attempting to access you folder directly via the website. It should contain the following code:
<?php header("Location: /"); ?>
yourpage-key.info.php
Tsama use this file to determine how it should display the page. The info is also used in navigation to determine the title of the page. If we take "My Awesome Page" as an example you will name the file the exact same as the folder name with the .info.php added, e.g. my-awesome-page.info.php
The content for the info file is as follows:
<?php
namespace Tsama;
$articleNfo = array(
$articleKey, //keyName, for site paging. Do not change this. It is automatically created
$pageUrl, //url Do not change this. It is automatically created
"My Awesome Page", //name for titles Change this according to your page title
"", //icon url
$visibility, //ARTICLE_VISIBILITY_PUBLIC or ARTICLE_VISIBILITY_REGISTERED
"default", //layout. Optional. Change if page use a different layout.
"default" //theme. Optional. Change if page use a different theme.
);
?>
Lastly you can add your the file where most of you code will reside. You must name it the exact same as your folder name but with .php added as the file type. E.g. my-awesome-page.php
In this page you will add your output code for the page. This can be php
and HTML
and is specific to the scope of your page and your content.
In order to access your page you simply add /page/page-key
or /page-key
(Because the page service is always the default service this will work as well)
Example: If you have a page key of my-awesome-page
you will add /page/my-awesome-page
to access your page. You can also use /my-awesome-page
.
As an url it will look as follows: http://tsama.local/page/my-awesome-page
There is an easier way though to create links to your pages and that is through Tsama's Nav service.
NEXT » Adding Navigation «