View Single Post
Old 02-26-2014, 02:22 PM   #11
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by svda View Post
Here's my feedback :

...

@eschwarz, your solution is missing the {title} at the end of the string I want to write.
Otherwise, perfect! Haven't found out yet where to put the last {title}

I'm trying to learn from the examples I get, so thanks to both of you.
Whoops, sorry. Here, I've added it:

PHP Code:
program:
    
strcat(
        
template("{author_sort}/{title}/{author_sort} - {series:|[|}"),
        
ifempty(
            
finish_formatting(
                
field("series_index"),
                
'0>3',
                
' ',
                
'] '
            
),
            
finish_formatting(
                
format_date(
                    
field('pubdate'),
                    
'yyyy'),
                
'',
                
' (',
                
') '
            
)
        ),
        
field('title')

At the end, I added one more entry to strcat, the final field('title').

(I also fixed an error where the date didn't have a space appended to separate it from the title.)



If you are trying to learn how this all works, a good resource is the calibre manual entry on templates, which also lists the different functions available. See here: http://manual.calibre-ebook.com/template_lang.html and ask questions if you need help understanding how it all works!

Last edited by eschwartz; 02-26-2014 at 02:26 PM.
eschwartz is offline   Reply With Quote