Steve Castledine March 11 2010 06:39:10 AMDenny had a question:
I want to have a 'Home' page that starts when the blog is opened, then I want to have a link that will take me to the Blog and I want to do all this with the .nsf file.
So I took and made a copy of the 'Home Page' found within the 'Page Templates'. I then renamed the copy to "Blog" and saved it.
Next I changed the 'Home Page to look like what I wanted.
Now my question is this, How do I Call the new page I made from my top menu or is this not possible and I'm going about it all wrong?
Makes sense to answer this and provide some detail on the template structure at the same time.
Where are the Template and how do I set them
Templates are found within the "Advanced > HTML Templates" section of the application. Which ones are used are determined by the wizard "Site HTML Templates" which can be found under "Advanced > Configuration" menu button "Wizards > Site HTML Templates". These settings are also repeated in the main configuration document but the wizard makes it easier to access.
There are two types of templates "page" and "item". Page templates determine the layout for entire pages, whereas item templates determine html per row of displayed data which would be each of your blog posts.
There are also "block" templates but these are just used for repeating parts of html. So if you have a home page, a document, search etc there will be a common sidebar, header etc so we can use block templates for these to save us maintaining this in many places. They are inserted into the page templates using <$DXTemplateBlock Name="block name"$>.
When you create a new blog, then the default layout is created automatically using these page, block and item templates. Then the configuration is updated to point to these templates (there is an obviously located script library which does this, within the design).
A potential theme manager would store a collection of these templates, config settings, together with any css and images required as a "theme".
So from the top the blog or website could just be one page, the home page. You would have a "page" template with nothing but html, set the site/homepage template to be this and you would have a very basic "static" site.
There would be no functionality however, and any content you add would not appear here. So this is where the "tags" come in, they insert the data/functionality where you want it within your html. For the homepage you would simply add a tag <$DXContent$> and this will insert the latest blog posts.
As part of answering Denny's question, note that the homepage template is the only one (aside from maybe the archive template) where you can put html in and it can be called directly. Although it doesn't have it own "link" it just knows that if the base ".nsf" is called in the url then the homepage should be displayed. Otherwise templates are just for defining layout and are not accessible directly.
So onto the next part, you may have told the application (via the page template) to display the latest posts on the homepage via the tag, however you have not told it how to display them so nothing will happen. This is where the item templates come in, you create one of these with the html you want per row, add the data you wish to display (again using tags - see the link to the tags at the end and also the default templates) and set in the template wizard under "Site Item Template".
For a basic site, the final thing you would do is create a new page template for the "full page posts" themselves by copying the html you used for home and creating a new template and setting it to be used from the template wizard. You would remove the <$DXContent$> tag and replace with the html you would have used for an item template (as its only 1 document not many).
The same theory works for the archive, search etc pages. I will write a follow up on the comments system.
Launching specific Templates
I've titled this part to answer Denny's question really, as I have already said you cannot directly launch a template as they are just "layout instructions". So if you want to create something that you can launch, you would create your page template and then either create a new post, or a static page via "Resources > Web Pages" and link the template to it.
To tell the application to use the template for this page, you select "Show HTML Options" from within the page or document, then select the "document template" to use.
When you access the document or page via its permanent url then this template/layout will launch. Incidentally, the url can be set manually via "Show Advanced" and "Page Name" . Obviously you can also use the content and data within the page/post if you wish by inserting the usual tags into the template.
So as you can see you could use this feature to create a specific look for any of your blog posts or static web pages. It works as a "waterfall" system, with the master template settings in the wizard/configuration, a second level of settings in the category documents (if you use them) and a final override directly in the pages themselves.
Wiki Article on themes and tags
Converting a theme from Wordpress part 1 and part 2
- Comments