So, how do I build a site?
- OLD Ariadne >
- Library >
- Ariadne 2.6 >
- FAQ >
>>Hello,
>>
>>I am trying to understand Ariadne from a traditional web development
>>approach, where I create a html page called Index.html
>>
>>This page loads when a visitor asks for the url.
>>So far, I am only able to get Ariadne to come up in explorer mode.
Ariadne uses a different approach. Instead of pages that have only one 'look', you create objects, which may have a number of 'looks' or 'views'.
You can define a new look, by creating a template. The default template is called 'view.html'. You can access a specific template by adding it to the end of a path in the url, e.g.:
http://www.example.com/ariadne/loader.php/some/object/template.html
So, you just need to define a template called 'view.html' and show the content of each object wrapped in a fixed layout. e.g.:
<html>
<head>
<title><pinp> echo $nlsdata->name; </pinp></title>
</head>
<body>
<h1><pinp> echo $nlsdata->name; </pinp></h1>
<p><pinp> echo $nlsdata->summary; </p>
<pinp> ShowPage(); </pinp>
</body>
</html>
This does not yet include any navigation however. You can create that automatically by using the Ariadne specific functions ls() and parents()
To add a list of children (subdirectories and files) of an object (directory), add something like this:
<ol>
<pinp> ls('show.html'); </pinp>
</ol>
You need to define the new template 'show.html', e.g.:
<li>
<a href="<pinp> echo make_url(); </pinp>"><pinp>
echo $nlsdata->name;
</pinp></a>
</li>
To add a 'bread crumbs' trail to the root of the site at the top of the page, do something like:
<body>
<p><pinp> parents('show.link.html', currentsite()); </pinp></p>
<h1><pinp> echo $nlsdata->name; </pinp></h1>
and add a template show.link.html:
<a href="<pinp> echo make_url(); </pinp>"><pinp>
echo $nlsdata->name;
</pinp></a>
Now, you must define templates for a class (object type, e.g. Page, Directory, Addressbook, etc.) If you define a template for the class Page, it will also be used by Directory and Addressbook, since they inherit the data and templates from Page.
The function ShowPage()
for example is defined in the class Page (ppage
), and can be used in all the descendant classes, but not in objects of type File, or Calendar Item, for example. The full list of class inheritance and a list of available data ($data->
and $nlsdata->
) entries and functions per class is
available in the reference (http://www.ariadne-cms.org/library/2.4/manuals/reference/classes/).
For more information, take a look at the tutorials at http://www.ariadne-cms.org/library/2.4/howtos/