Announcement

Collapse
No announcement yet.

V8 Advanced Templating: Automated RSS Feeds

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    V8 Advanced Templating: Automated RSS Feeds

    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:

    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>	
    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:

    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>
    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.

    Code:
    RewriteEngine on
    RewriteBase    /
    Options +FollowSymLinks
    RewriteRule ^rss\.xml$ rss-newproducts.php
    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!

    #2
    Gabe this is a sort of help

    Well i know we were talking about this, well it is in use here, all though i have no data in the feed Still investigating why but

    http://rawair.co.uk/acatalog bottom of the section list in the left column has a section called RSS click on that and you will get this page http://rawair.co.uk/acatalog/RSS.html

    so it works, sort of but why no data, im still investigating so if anyone has any ideas feel free to offer them

    D

    Comment


      #3
      OK can anyone assist in this one, I have taken Gabes idea and also created a RSS layout for best sellers aswell, but i can not seem to pull any data up, the RSS page works but that is about it

      i have run through a checked everything, partly why i decided to try it with best sellers. The new layout was set to list, and one for best sellers and one new products but alas i am stumped.

      Any help would be appreciated
      D

      Comment


        #4
        Transcript from helping Darren fix his RSS up.

        11:36:09 ‹Gabriel› morning.
        07/12/2007 11:36:12 ‹Gabriel› sorted your rss?
        07/12/2007 11:48:03 ‹darren b› gabe i have no idea why the rss does not output anything
        07/12/2007 11:48:58 ‹darren b› im stumped, i have been back over the whole process, thats why i tried it on the best sellers list just incse i got somethign wrong
        07/12/2007 11:50:43 ‹Gabriel› i see.
        07/12/2007 11:51:15 ‹Gabriel› want to go over it, if you ahve time?
        07/12/2007 12:00:53 ‹darren b› did you see the page with the rss on
        07/12/2007 12:01:09 ‹darren b› i guess this is what it should look like but with some data in it
        07/12/2007 12:01:54 ‹Gabriel› ok, well, let me go through it.
        07/12/2007 12:02:08 ‹darren b› ok
        07/12/2007 12:02:12 ‹Gabriel› open the library.
        07/12/2007 12:02:37 ‹darren b› 2secs
        07/12/2007 12:02:39 ‹Gabriel› layouts tab.
        07/12/2007 12:02:53 ‹Gabriel› right click, on the root icon and click new layout.
        07/12/2007 12:03:10 ‹Gabriel› call it rss.
        07/12/2007 12:03:26 ‹Gabriel› select 'list' as its type.
        07/12/2007 12:03:45 ‹darren b› can i call it something else as i already have rss in it
        07/12/2007 12:03:45 ‹Gabriel› in the dropdown, choose 'new products list'.
        07/12/2007 12:03:49 ‹Gabriel› sure.
        07/12/2007 12:03:59 ‹Gabriel› 'newproductsrss'
        07/12/2007 12:04:37 ‹darren b› ok done that clicked ok
        07/12/2007 12:04:41 ‹Gabriel› right click on your new rss (its empty, with no plus symbol)
        07/12/2007 12:04:55 ‹darren b› yep it is
        07/12/2007 12:05:04 ‹Gabriel› new layout.
        07/12/2007 12:05:16 ‹Gabriel› call it 'rssitem'
        07/12/2007 12:05:17 ‹darren b› yep
        07/12/2007 12:05:25 ‹Gabriel› (or anything you want really)
        07/12/2007 12:05:35 ‹darren b› based on nothing
        07/12/2007 12:05:37 ‹darren b› ?
        07/12/2007 12:05:37 ‹Gabriel› based on none.
        07/12/2007 12:05:55 ‹darren b› ok done
        07/12/2007 12:05:59 ‹Gabriel› right clikc on your rss icon again, and click new selector.
        07/12/2007 12:06:15 ‹darren b› yep
        07/12/2007 12:06:24 ‹Gabriel› set the name and prompt to :RssNewItems
        07/12/2007 12:06:49 ‹darren b› yep
        07/12/2007 12:06:56 ‹Gabriel› click 'available to site'
        07/12/2007 12:07:05 ‹Gabriel› click the values tab.
        07/12/2007 12:07:07 ‹darren b› k
        07/12/2007 12:07:13 ‹Gabriel› move your new template into the right column.
        07/12/2007 12:07:23 ‹darren b› k
        07/12/2007 12:07:25 ‹Gabriel› press ok.
        07/12/2007 12:07:32 ‹Gabriel› now, right lick on the template we made.
        07/12/2007 12:07:39 ‹Gabriel› edit.
        07/12/2007 12:07:56 ‹Gabriel› paste this: <actinic:variable name="ProductName" /><br>
        07/12/2007 12:08:00 ‹Gabriel› press ok.
        07/12/2007 12:08:15 ‹Gabriel› close the library.
        07/12/2007 12:08:32 ‹darren b› k
        07/12/2007 12:08:41 ‹Gabriel› in your design, ANYWHERE in the design.
        07/12/2007 12:08:52 ‹darren b› yep
        07/12/2007 12:08:54 ‹Gabriel› start typing Rss.. and it'll suggest the template we made.
        07/12/2007 12:08:59 ‹Gabriel› use it.
        07/12/2007 12:09:36 ‹darren b› oooh hang on
        07/12/2007 12:09:42 ‹Gabriel› i used it in that new page, rss.html.
        07/12/2007 12:09:52 ‹Gabriel› now. this is the list, with only product names.
        07/12/2007 12:09:56 ‹Gabriel› this is the framework.
        07/12/2007 12:10:03 ‹darren b› lyou mean on my standard layout
        07/12/2007 12:10:04 ‹Gabriel› does it work?
        07/12/2007 12:10:20 ‹Gabriel› well, you made a blank template diddnt you? from the template?
        07/12/2007 12:10:29 ‹Gabriel› you can use this in that template.
        07/12/2007 12:10:35 ‹darren b› yer did that yesterday
        07/12/2007 12:10:50 ‹Gabriel› this example only uses the product names.
        07/12/2007 12:11:31 ‹darren b› oh **** me it worked lol
        07/12/2007 12:11:46 ‹darren b› ok i pasted the rss code into the layout
        07/12/2007 12:11:52 ‹darren b› last time
        07/12/2007 12:11:53 ‹Gabriel› like opening the template we just made and typing this: http://actinic.pastebin.com/maef0667
        07/12/2007 12:11:55 ‹Gabriel› into it.
        07/12/2007 12:12:18 ‹Gabriel› then using the new RssItem thing we made in our rss page.
        07/12/2007 12:12:21 ‹Gabriel› got it ok?
        07/12/2007 12:12:23 ‹Gabriel› good stuff.
        07/12/2007 12:12:25 ‹Gabriel› have fun!
        07/12/2007 12:12:34 ‹Gabriel› brb, lunnch time.

        NOTE: that this is fairly advanced template editing stuff, so this was to get the list working properly, for the rss part, particularly validation, you're on your own!

        Comment


          #5
          OK now some of the code needs to be changed to allow for illegal characters in the feed.

          you need this code
          Code:
              <item>
                <title><![CDATA[<Actinic:Variable Name="ProductName"/>]]></title>
                <link><actinic:variable name="ProductLink" /></link>
                <description><![CDATA[<actinic:variable name="ProductDescription" />]]></description>
                <pubDate>14:12 30/11/2007</pubDate>
                <guid><actinic:variable name="ProductLink" /></guid>
              </item>
          This will alow the use of . / - in your product short and long description, because you feed will not work, it might show bits in FF but an error on IE (thanks Gabe)

          OK can anyone help with the product link problem

          RSS feeds can not use non standard characters, for things like &amp;NOLOGIN=1 which obviously appears in the link

          So has anyone any ideas on how to create proper links to the products, but apart from that it works really well

          D

          Comment


            #6
            http://community.actinic.com/showthread.php?t=32892

            use code posted here to generate flat links.

            ttfn.

            Comment


              #7
              OK then Gabe and every one else

              Managed to get the thing working, need to rip out code already there, chnaged productReference to ProductID and still works ok, down side you really need SPP's as it links the the section, unless you go down Normans route in the other thread and link to the product itself

              But hey it's good, just a small problem with illegal charachters, well fullstops being change to . funny in the product long description its fine not the short desription but we have it working - cheers Gabe

              you can see these here
              http://kitesrus.co.uk/acatalog/RSS_New_Products.html
              http://kitesrus.co.uk/acatalog/RSS_Best_Sellers.html
              http://rawair.co.uk/acatalog/RSS_Best_Sellers.html
              http://rawair.co.uk/acatalog/RSS_New_Products.html

              D

              Comment


                #8
                What this means for Actinic:

                A real time RSS feed (xml file), uploaded as your shop gets updated.

                I would suggest having about 30 items in your lists, and using shop side blockifs to limit them there, while having them displayed fully in the feeds. This gives a lot more data to work with.

                So, now that we ahve an rss feed, what can we do with it? Well for starters, Actinic is now ripe for a web 2.0 mashup. We can syndicate our data to other palces. For example, I can use an asp or php based rss reader to display these items on someone elses page. I can create a javascript component, that loads an rss and then displays it.

                This construct opens the door to some interesting affiliation concepts.

                Comment


                  #9
                  I also think that Actinic towers should take this information and create some built in feeds for their version 9.

                  It would be VERY easy to do and take little effort, for a lot of worth.

                  Comment


                    #10
                    Originally posted by gabrielcrowe
                    I also think that Actinic towers should take this information and create some built in feeds for their version 9.

                    It would be VERY easy to do and take little effort, for a lot of worth.
                    Gabe i could not agree more, this tool has loads of advantages and as always its another thing to get you sites out there in the big wide world.

                    As always Gabe does the hard work i do the testing

                    D

                    Comment


                      #11
                      Hi

                      I spotted this little trick a few days ago and thought I would give it a shot.
                      I've set it up as per instructions but in my 8.5.2 it produces an error.
                      Can some one explain what the message in the image I have included means.
                      http://www.flickr.com/photos/18831425@N03/2120528666/

                      regards Tony
                      Your one stop shop for spares.
                      Washing Machine Spare Parts

                      Comment


                        #12
                        it looks like you diddnt start with blank templates.

                        try again with blanks this time. you can only paste into these blank templates, what is shown here, no more.

                        you have extra markup in there.

                        Comment


                          #13
                          Hi

                          I don't think it's the blank templates as I have repeated that step over many times and it doesn't cause a problem. I can see clean xml in view source of preview.
                          When I add my RssItem into the template it produces the errors.
                          The variable name ProductLinks have the additional Reward Discount variables attached to them by default.
                          Are they meant to be in there?

                          regards Tony
                          Your one stop shop for spares.
                          Washing Machine Spare Parts

                          Comment


                            #14
                            this was discussed in the thread too, and it was decided that the php filename hack was required to create a flat link.

                            actinic (correctly) creates markup around the raw llink, and this isnt what's supposed to happen in xml.

                            Comment


                              #15
                              Re:

                              I can't even get this to work been through it loads of times and it doesn't seem to want to display and the url for this is www.allsportsawards.co.uk/acatalog/rss-feed.php
                              i've created the htaccess file but for some reason when i test it on the server it states that this is an incorrect protocol. i don't seem to get why this isn't working i have checked all the common mistakes and gone over several times but when i insert the layout at the bottom of the blank page the link <actinic:variable name="rssfeed" /> when you double click on this the code then appears but nothing appears on screen. Does this effect me that i am using actinic version 9.0.5? why can't i get this too work? please help asap.

                              Comment

                              Working...
                              X