Re: Custom index in a folder

Andy Altepeter <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Organization Bethel University
Message-ID <[email protected]>
Hi Jonny,

I don't believe an extension like this exists in the public realm.  It 
wouldn't be too difficult to write, however.  You could use my Silva Custom 
AutoTOC source (http://zope.org/Members/aaltepet/SilvaCustomAutoTOC) as a 
basis for this FirstPublishedContent type.  I suggest this code, as opposed 
to something with Silva (like Silva AutoTOC), because it is already it's own 
package.  If you're not familiar with developing in Silva, it would be easier 
to start with a Silva extension than pulling stuff out of the imposing Silva 
core.

 Strip out pretty much everything in the CustomAutoTOC class, add a function 
to get the first published document in the container.  The edit view will be 
very basic, and the public/preview views will call this firstPublished method 
and either render or redirect to it (whichever you want to do).  You will 
need to dig into the Silva api to learn how to get the first published (try 
looking at methods in Folder, or perhaps there is an adapter for this).

You'll also want to add a ContainerPolicy for this, so when a folder is 
created this type of content can be added as the default index item.

HTH,
Andy

On Friday 07 April 2006 11:07 am, Jonny Perl wrote:
> Hello,
>
> In my Silva installation, I have some publications in the root, and
> within these publications I have folders. Within these folders I have
> documents, but since none of these is explicitly introductory, I have
> given them all semantically relevant id's, and there is no document
> called 'index'.
>
> My problem is that when a folder is requested (in the form
> 'http://mysite/publication/folder'), the user is just taken to a blank
> folder.
>
> Is there a way in which when 'http://mysite/publication/folder' is
> requested I can force Silva to link to
> 'http://mysite/publication/folder/document' where 'document' is the
> default to the first published document in the folder?
>
> I'm using silva version 1.0.2. Apologies if this has been dealt with
> before - I was able to dig up a few discussions of the problem but
> couldn't see a solution.
>
> Thanks in advance for any help.
>
> Jonny
> _______________________________________________
> silva-dev mailing list
> [email protected]
> https://infrae.com/mailman/listinfo/silva-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.