Author Topic: Export template: HTML List (English + German)  (Read 189750 times)

0 Members and 4 Guests are viewing this topic.

Offline beeman147

  • Member
  • *
  • Posts: 1
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #100 on: October 23, 2011, 05:16:23 am »
Hi...
I was planning (and had started) to write a modern standards based html/css export template myself...

But then I stumbled on this!

I was taking a similar approach but mine would not have been as good, so that saves me work I guess  ;D

I was asking a question, but I solved it myself...

Congrats on a great implementation  ;)

bee
   

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #101 on: October 28, 2011, 01:49:27 am »
You're welcome! Thanks for the kudos!  :)

Offline fejao

  • Member
  • *
  • Posts: 6
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #102 on: November 17, 2011, 12:40:02 am »
Hi there svenne, Im a little lost right now I could give you a tip
Have you tried to avoid the duplication of the titles doing something like a little if()else ?

if(title=orig_title)
   write ("title");
else
   write ("title - orig_title");

It's kind of annoying having the title duplicated if you have the title as the same as the original title.

If you could point in which file I should try to modify this it could help

Thanks in advance

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export templates: HTML List/Frames (English + German) + Print Layout
« Reply #103 on: November 17, 2011, 12:23:54 pm »
Hi fejao,
if...else would be nice, of course...  ;)  However, things can be done with #StringReplace. It looks a little bit more complicated, though. The file of interest is movieiframe.ptm...
Code: [Select]
{#StringReplace '{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=origtitle}' '</p>'}' '
  <h2>Original Title</h2><p id="otitle">'}' '
  <h2>Original Title</h2><p id="otitle">{%value=title}

The statement will be processed from inner to outer {}-brackets. Newlines within single quotes are treated just as newline characters.
#StringReplace... will replace the whole thing with an empty string if <h2>Original Title</h2><p id="otitle">{%value=origtitle}</p> equals <h2>Original Title</h2><p id="otitle">{%value=title}</p>.
#ConditionAdd... and #ConditionAddFirst... are for the case that the "original title" field is empty in the first place. Any HTML code that would be associated with it should then be omitted.

- I updated all of the templates: "HTML Frames", "HTML List", and "HTML Print Layout".
- I changed the behaviour of the menu in "HTML List" as I already did with "HTML Frames".
« Last Edit: February 29, 2012, 12:12:37 pm by svenne »

Offline lch

  • Member
  • *
  • Posts: 12
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #104 on: January 16, 2012, 02:39:08 am »
Hi svenne,

I love the print layout. Just what I was looking for.

I wonder if you could:
- include viewdate among the details
- allow to trim actors field (sometimes it's huge; two or three lines should do the trick)
- add an option to set the size of the poster (I would like to print a pdf file to be viewed
on my iphone

Thanks for the great work anyway.

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #105 on: January 17, 2012, 05:02:56 pm »
Hi lch,

I added two additional functions to print layout now:

- you can set maximal poster dimensions (max-width, max-height)
- you can trim the actors lists to a maximal number of entries

I think I won't add the viewdate now (the idea rick mentioned was to include this and the personal rating, not too bad... but I'm short on time now. Perhaps I will add this in february, combined with a function that allows to show or hide it).

But if you tell me where you want the viewdate to show up (just below the title? Or below the file specs?) I will tell you where you'd have to add what line... It won't be complicated, I promise!  ;)
« Last Edit: February 29, 2012, 12:12:56 pm by svenne »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #106 on: January 18, 2012, 03:15:00 am »
You might have wisely ignored this...

Maybe you can persuade him to add [Viewed date] to the templates, along with an option to sort by that. If he's going to go to the trouble, it would make sense to include [Rating], and include both at or near the top of the information presented—perhaps right-justified opposite the title.

...but just to be clear, I now realize such sorting options are not really necessary. A list of movies viewed can be sorted by date viewed prior to export, and that's how they will be ordered in the report. If they've been re-sorted by one of the report options, a refresh will return them to the original order. Maybe the options dialog should include a note, "Refresh to return to original order." Or, to be clever, add an option to "Return to original order" that does the same thing. It would be a clue to the user that if the sort order they want isn't listed, they do have the option of exporting the list in the required order.

Quote
But if you tell me where you want the viewdate to show up (just below the title? Or below the file specs?) I will tell you where you'd have to add what line... It won't be complicated, I promise!

If been tinkering with movieiframe.ptm, and having difficulty understanding the conditional statements. Perhaps you could help by illustrating how to add just below the title [viewdate] (if there is one), followed by [rating] (if not 0) then [imdbrating] (if not 0). Thanks.

Offline lch

  • Member
  • *
  • Posts: 12
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #107 on: January 18, 2012, 11:12:06 am »
hello svenne,

thanks but i don't see any new options... it looks exactly like previos version.
what am i doing wrong?  where am i supposed to change poster size and actors limit?


Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #108 on: January 18, 2012, 01:18:38 pm »
After export (when opened in your browser) the functions are integrated into the menu on the right... Did you replace the old plugin in .\Plugins\Templates\?

Offline lch

  • Member
  • *
  • Posts: 12
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #109 on: January 20, 2012, 02:37:46 pm »
hello svenne,

yes it works. got confused with plugins folder instead of template folder.

thanks a bunch for the update: it's great.
 
now, could the viewdate be displayed as first detail
above original title (same font)?

as pointed out, sorting takes care of itself: so all is missing now is
viewdate!!

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #110 on: January 23, 2012, 12:38:31 pm »
Hi!
To have the viewdate appear above 'Original Title' replace the following line (quite at the end of "HTML Print Layout.ptm", line 275)
Code: [Select]
      <h3 class="genre">Genre</h3><p class="genre">{#StringReplace '{%value=genre}' '{%value=genre}' '('}{#ConditionAdd <> '' '{%value=genre}' ')'}</p>{#StringReplace '{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=origtitle}' '</p>'}' 'with
Code: [Select]
      <h3 class="genre">Genre</h3><p class="genre">{#StringReplace '{%value=genre}' '{%value=genre}' '('}{#ConditionAdd <> '' '{%value=genre}' ')'}</p>{#StringReplace '{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=viewdate}' '</p>'}' '
      <h3>Seen Date</h3><p>'}' '
      <h3>Seen Date</h3><p>{%value=title}</p>' ''}{#StringReplace '{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=origtitle}' '</p>'}' '
It looks complicated because of the StringReplace statements. I added those so that empty fields (including their headers) aren't displayed at all. Here, I made viewdate behave the same way now.
« Last Edit: January 23, 2012, 12:40:19 pm by svenne »

Offline lch

  • Member
  • *
  • Posts: 12
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #111 on: January 26, 2012, 01:16:27 am »
thx mate, works like a charm.

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #112 on: January 26, 2012, 09:40:28 am »
You're welcome! :)

@rick.ca:
Quote
...movieiframe.ptm (...) conditional statements (...) [viewdate] (...) [rating] (...) [imdbrating]...
I didn't forget about that. Will be addressed soon...
« Last Edit: January 26, 2012, 09:42:48 am by svenne »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #113 on: January 26, 2012, 09:14:12 pm »
Quote
I didn't forget about that. Will be addressed soon...

Thanks. No rush. I'm more interested in understanding the method of skipping empty fields, so I can make modifications as the need arises.

Offline ouafouaf

  • Member
  • *
  • Posts: 21
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #114 on: February 03, 2012, 12:03:36 pm »
Hello there!
Wanted to export my list using your template, which I hadnt used for many months, when a wild bug appeared.

The export goes well, no message, then the html page opens in firefox.
But the files folder wasnt created correctly, it is called "%fname%_files". So yeah nothing works.

Looking around in the template code, I tried to figure out a way around this. I managed to make the thing work by simply replacing all the call for "%fname%_files" as well as "{%value=233}_files" by simply "files". But the film images still wouldn't show up...
I believe the problem is not in the code but somewhere in my pvd config or my system ?

I use windows 7 x64 pro, and pvd 0.9.9.21.
Any idea ? :)

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #115 on: February 21, 2012, 04:27:42 pm »
@rick.ca
The code looks confusing. But it is not as complicated as it seems. There also is a newline character that might add to confusion...
 
Ok, we want to have some HTML code exported along with a value (whenever it is not empty)...

The exported HTML code should look like this:

...\n
  <h2>Header a</h2><p>Value a</p>\n
  <h2>Header b</h2><p>
Value b</p>\n
  <h2>Header c</h2><p>Value c</p>\n
...


Note that I added \n to visualize the newline characters.
The blue HTML code is the one associated with {%value=b}. It should be added to {%value=b} if not empty.

We can use ConditionAdd to add the trailing </p> to the value:
{#ConditionAdd <> '' '{%value=b}' '</p>'}

(<> '' = "if it is not empty")

If  {%value=b} is empty then the whole statement will result in an empty string. So we can use ConditionAddFirst with that statement in the same manner to add the other part of the HTML code:
{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=b}' '</p>'}' '\n  <h2>Header b</h2><p>'}

Remember: \n is a newline character. So in fact the code looks like this:
Code: [Select]
{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=b}' '</p>'}' '
  <h2>Header b</h2><p>'}


Let‘s add this to the example given in the beginning. It must be added directly to the previous HTML line:

...
  <h2>Header a</h2><p>{%value=a}</p>{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=b}' '</p>'}' '
  <h2>Header b</h2><p>'}

  <h2>Header c</h2><p>{%value=c}</p>
...


The same code without colors:
Code: [Select]
  <h2>Header a</h2><p>{%value=a}</p>{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=b}' '</p>'}' '
  <h2>Header b</h2><p>'}
  <h2>Header c</h2><p>{%value=c}</p>



@ouafouaf
Any idea what was changed since your last export?
Since {%value...} and %fname% was not replaced by PWD’s export engine there might be a more severe problem... not only affecting the files folder.
Aren't there problems with other export templates, too?
« Last Edit: February 21, 2012, 04:44:32 pm by svenne »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #116 on: February 21, 2012, 11:05:58 pm »
Quote
The code looks confusing. But it is not as complicated as it seems. There also is a newline character that might add to confusion...

Yes, that's it exactly. My brain had a hard time grasping that, with the #ConditionalAddFirst, the first part of the result came at the end of the statement—on a new line. Thanks for the clear explanation.

Offline arj0n

  • User
  • ***
  • Posts: 32
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #117 on: February 28, 2012, 04:12:15 pm »
Svenne, somehow the 'show newest 25 entries' option doesn't seem to work...
(using "HTML Frames + HTML List (English)" from the first post)
« Last Edit: February 28, 2012, 04:15:02 pm by arj0n »

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #118 on: February 28, 2012, 09:14:05 pm »
Are there problems in "HTML List" or "HTML Frames" or in both? Doesn't happen anything at all?
Both work fine for me on IE and firefox.
"Show newest 25 entries" should display the last 25 movie records added to your database (this refers to the field "Date added" in Personal Video Database).
Do you use firefox? Then type Ctrl+Shift+J. The error console pops up. Delete the log, retry "show all" and "show newest 25 entries" and tell me if errors show up.

Offline arj0n

  • User
  • ***
  • Posts: 32
    • View Profile
Re: Export template: HTML List (English + German)
« Reply #119 on: February 29, 2012, 09:37:45 am »
I use the "HTML Frames" template in Firefox v10.0.2.
There's no difference in showing 'all' or 'the 25 newest', all records keep being shown.

Removed the log in the error console. When switching tabs in FF the console says:

Error: Components.classes['@mozilla.org/extensions/manager;1'] is undefined
Source File: chrome://imdb_preview/content/imdb_preview.js
Line: 1143

Edit:
* in IE9 the same problem occurs: no difference in showing 'all' or 'the 25 newest'.
* Tried running Firefox in safemode to disable all addons: problem still persists.
« Last Edit: February 29, 2012, 09:46:01 am by arj0n »