Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • wildlife 54 posts 74 karma points
    Jul 05, 2010 @ 06:44
    wildlife
    0

    Changing templates?

    I have the Autofolder package working on an Events List section and a News List section of the site.  The folders create yearly and monthly date folders to hold my Event and News Items.  The template for Events List is Events List and the template for News List is News List.  I want those to stay as they are.  However, I would like the template used by the automatically generated monthly folder pages to be Events List Month and News List Month.  That way I can set up different things on the monthly pages than how I have it on the main pages. 

    The way things currently work is I have to change the template manually each time a new Autofolder is created when I create new News Items and Events Items. 

    I'd like to see if there is any way to use the different templates automatically?

     

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 05, 2010 @ 09:15
    Dirk De Grave
    0

    wildlife,

    You can set a default template on the document types for Event List Month and News List Month, so whenever such a folder gets created, it will get this template by default.

     

    Hope this helps.

    Regards,

    /Dirk

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 05, 2010 @ 09:37
    Matt Brailsford
    0

    Hey,

    I would suggest (what I think Dirk is also suggesting) is to create seperate doc types for the different month folders, then you can just configure autofolders differently for news and events using the relevant doc type. You can then tell each doc type to use it's relevant template as the default, and this will automatically get used (You may need to write a script to update any existing items).

    If you did want to use one doc type, with multiple templates though, your best bet would probably be to write an event handler to automaticaly switch the template based upon the type of item.

    Many thanks

    Matt

  • wildlife 54 posts 74 karma points
    Jul 06, 2010 @ 09:11
    wildlife
    0

    Dirk:  I don't have Events List Month or News List Month document types.  I just set up templates for those to use with the automatically generated folders because there were things I wanted done differently on the monthly pages from how it was being done using the Events List and News List templates.  I suppose I could add Events List Month and News List Month document types, but wouldn't Autofolders still create the monthly folders using the parent document type, leaving me in the same boat?

    Matt:  I'm afraid that if I mess around with how things are configured, that I'll not only force myself to have to redo all the existing news and events pages, but I'll somehow manage to mess up the existing functionality.  I'm not very advanced with all of this. 

    Here's what someone else set up for us in the config file.  This person isn't available to make further adjustments at this time so I'm very reluctant to mess with anything that he has working:

    <?xml version="1.0" encoding="utf-8" ?>
    <settings>
    <folderProviders>
    <folderProvider alias="DateFolderProvider_Simple"
    assembly="/bin/AutoFolders"
    type="AutoFolders.Providers.DateFolderProvider">
    <property alias="MonthFormat">MM</property>
    <property alias="YearFormat">yyyy</property>
    </folderProvider>
    <folderProvider alias="DateFolderProvider_ByProperty"
    assembly="/bin/AutoFolders"
    type="AutoFolders.Providers.DateFolderProvider">
    <property alias="MonthFormat">MM</property>
    <property alias="YearFormat">yyyy</property>
    <property alias="DateField">beginDate</property>
    </folderProvider>
    </folderProviders>

    <autoFolders>
    <autoFolder docType="News Item"
    folderProviderAlias="DateFolderProvider_Simple"
    folderDocType="News Area"/>
    <autoFolder docType="Event Item"
    folderProviderAlias="DateFolderProvider_ByProperty"
    folderDocType="Events List"/>
    </autoFolders>

    </settings>

    If it would be an easy adjustment, I guess I could try it.  But if there's a risk of messing up how it works now, I'd rather just switch the templates manually than doing that.  I'm guessing what I'd have to do is change

    folderDocType="Events List" and folderDocType="News Area"  

    to

    folderDocType="Events List Month" and folderDocType="News Area Month"

    after creating those document types.  Would there be anything more to it than that?  And then would I have to rebuild all the existing pages if I do that?

    I think I'm liking the sound of your event handler thought better, just because I have a feeling I'm going to mess EVERYTHING up if I try this approach.  I'm fearing that I'll have to rebuild the existing pages, but that something won't work the same when I get done and then I'll be over my head in trying to figure it out.  So I'd rather try an approach that wouldn't involve that.  I already have the existing month folders set to use the month template (adjusted manually), so I wouldn't have to make any modifications there that would force me to rebuild anything.  This event handler would just apply to new month folders that get created.  Is setting up an event handler to switch the template on just the month pages generated by Autofolders something that is easy to do?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 06, 2010 @ 09:34
    Matt Brailsford
    0

    From the looks of your config, it already seems like you have seperate doc types for the month folders of News and Events.

    In news, you are using a doc type called "News Area" for the month folders, and in events you are using a doc type called "Events List". In which case you should just be able to tell "News Area" to use use your "News List Month" template by default, and tell "Events List" to use your "Events List Month" template by default (assuming these doc types are only ever used for the month folders).

    You would still need to go through any month folders you currently have set up, and change their templates manually (In the properties tab) but it should use the right template from now on.

    Just a note, I am assuming in that you know the difference between a doc type and a template as some people sometimes say one thing, meaning the other, so if I'm mistaken, please let me know.

    Matt

  • Mirela Budaes 44 posts 94 karma points
    Jul 06, 2010 @ 14:09
    Mirela Budaes
    0

    Hi,

    I haven't worked with the Autofolders package but if the other sugestions don't work, you could take a look at alternative templates.

    http://www.nibble.be/?p=42

    It helped me have a mobile site by applying different templates to the same content.

    And maybe use UrlRewriting to apply these templates only to the autofolders pages.

     

    Good luck,

    Mirela.

  • wildlife 54 posts 74 karma points
    Jul 11, 2010 @ 05:29
    wildlife
    0

    Matt:  The main News Area page and the main Events List page are those document types and they should not use the month templates.  They should use the News Area and Events List templates as they currently are.  *HOWEVER*, all future uses of these document types should be month folders newly created by Autofolders.  I won't be creating any more content using Events List or News Area document types that will need to use the Events List or News Area templates.  So if I change the default template for these document types to the corresponding month templates now, that would serve to have all future creations of this type use that template, but it wouldn't change the existing ones, right?  If so, that would solve it for me.

    Mirela:  Thanks for the tip.  I'll look at that next after checking if Matt's suggestion works.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 11, 2010 @ 10:17
    Matt Brailsford
    0

    Hey,

    That is almost correct. You are correct that changing the alias to your new doc type alias would mean all new entries would use the new month folders, and as long as you don't change any old entries, these will continue to use the old month folders. The only difference is, if you republished an old entry, it would then use the new month folder aswell. If you are not changing your old entries, then this probably isn't a worry.

    Matt

  • wildlife 54 posts 74 karma points
    Jul 12, 2010 @ 05:41
    wildlife
    0

    OK, I switched them.  It looks like this will work.  The main events list page and the main news area page will not be changing.  If I do have to republish them at any point, I'll make sure to switch their templates if necessary.  The amount of times this will happen will be far less than the amount of times new month pages will be added.

    Thanks a bunch for the simple solution.

     

Please Sign in or register to post replies

Write your reply to:

Draft