This little tutorial will get you started on some more advanced templates, and how to get them working. I'll be using fairly advanced actinic terms, and ideas, so if you're new, perhaps look at some help files first. This one isnt for noobs, sadly. This is more of a set of concepts than a tutorial really.
This is an RSS feed template. If you dont know what an RSS feed is, then you're in the wrong topic.
To start with, i'll be using a new section. right click on your root icon in the site tree, using the deisgn tab and create a new section. Call it 'RSS'. the filename could be something like 'rss-newproducts.php' but it does not really matter. We'll deal with the filename later.
For its template, select the template tab, and choose new. Give it a name you think is appropriate, and use 'none' as its basis. thats right. a totally blank template.
the editor might drop you to the editing of this template. type something in the editor and press the page preview button. you should get only what you typed, with no website. if you did this correctly, even viewing the source will yeild an empty page, with nothing but the test text you typed.
Got that? good, then we can start building our rss.
Paste this block into your blank template, making sure to remove any junk you just typed in there as a test:
Use your noggin and replace any items neccesarry for your site.
Note the use of php, to generate the date built. we use an actinic block to loop our items in the rss feed.
Now, we need to create the template for looping the items.
Open Design > Library and click the Layouts tab. Right click in a blank space and select 'New Layout Type'. Call it RSS. Make it of 'List' Type and make sure the list is set to 'New Products List'. Now, Right click on your new RSS type and create a new Layout. Call it 'FeedItem'.
right click on your new rss layout and click edit. paste this into it:
nearly there.
now, right click your RSS Layout type and this time click new selector.
Name: RssItems
Prompt: RssItems
Palce of setting: Site
In the values tab, ensure that your newly created RssIrem, is in the right column.
Did it work? go back to your designer and preview the page using the single page preview on your button bar. you might want to view the source of the page, to check your markup.
How can an rss reader get to this file? well, first of all, a limitation in actinic prevents you from using the xml or the rss file extentsion. we can get around this by tricking the browser with our htaccess files, available under linux servers only.
this htaccess example will take transparently rewrite the url of the php file listed second and let the rss client access it at rss.xml
this is only an example, and there are obviously going to be problems. Please, someone try this on their catalog, and post some solutions to the problem. If you are posting simple 'doesnt work' or 'cant get it to work' things then please, stop yourself. Think of the children.
Well, idea machine. Spin true!
This is an RSS feed template. If you dont know what an RSS feed is, then you're in the wrong topic.
To start with, i'll be using a new section. right click on your root icon in the site tree, using the deisgn tab and create a new section. Call it 'RSS'. the filename could be something like 'rss-newproducts.php' but it does not really matter. We'll deal with the filename later.
For its template, select the template tab, and choose new. Give it a name you think is appropriate, and use 'none' as its basis. thats right. a totally blank template.
the editor might drop you to the editing of this template. type something in the editor and press the page preview button. you should get only what you typed, with no website. if you did this correctly, even viewing the source will yeild an empty page, with nothing but the test text you typed.
Got that? good, then we can start building our rss.
Paste this block into your blank template, making sure to remove any junk you just typed in there as a test:
HTML Code:
<?xml version="1.0"?> <rss version="2.0"> <channel> <title>New products</title> <link>http://www.thisshopsite.com</link> <description>New Products feed for my site</description> <language>en-us</language> <pubDate><actinic:block php="true" >echo date('l dS \of F Y h:i:s A');</actinic:block></pubDate> <lastBuildDate><actinic:block php="true" >echo date('l dS \of F Y h:i:s A');</actinic:block></lastBuildDate> <generator>Actinic V8</generator> <managingEditor>yourmail@YOURSITE.com</managingEditor> <webMaster>yourmail@YOURSITE.com</webMaster> </channel> </rss>
Note the use of php, to generate the date built. we use an actinic block to loop our items in the rss feed.
Now, we need to create the template for looping the items.
Open Design > Library and click the Layouts tab. Right click in a blank space and select 'New Layout Type'. Call it RSS. Make it of 'List' Type and make sure the list is set to 'New Products List'. Now, Right click on your new RSS type and create a new Layout. Call it 'FeedItem'.
right click on your new rss layout and click edit. paste this into it:
HTML Code:
<item> <title><Actinic:Variable Name="ProductName"/></title> <link><actinic:variable name="ProductLink" /></link> <description><actinic:variable name="ProductDescription" /></description> <pubDate>14:12 30/11/2007</pubDate> <guid><actinic:variable name="ProductLink" /></guid> </item>
now, right click your RSS Layout type and this time click new selector.
Name: RssItems
Prompt: RssItems
Palce of setting: Site
In the values tab, ensure that your newly created RssIrem, is in the right column.
Did it work? go back to your designer and preview the page using the single page preview on your button bar. you might want to view the source of the page, to check your markup.
How can an rss reader get to this file? well, first of all, a limitation in actinic prevents you from using the xml or the rss file extentsion. we can get around this by tricking the browser with our htaccess files, available under linux servers only.
Code:
RewriteEngine on RewriteBase / Options +FollowSymLinks RewriteRule ^rss\.xml$ rss-newproducts.php
this is only an example, and there are obviously going to be problems. Please, someone try this on their catalog, and post some solutions to the problem. If you are posting simple 'doesnt work' or 'cant get it to work' things then please, stop yourself. Think of the children.
Well, idea machine. Spin true!
Comment