English > Scripts and Templates

Export template: HTML List (English + German)

<< < (24/37) > >>

svenne:
@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: ---{#ConditionAddFirst <> '' '{#ConditionAdd <> '' '{%value=b}' '</p>'}' '
  <h2>Header b</h2><p>'}
--- End code ---


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



@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?

rick.ca:

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

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.

arj0n:
Svenne, somehow the 'show newest 25 entries' option doesn't seem to work...
(using "HTML Frames + HTML List (English)" from the first post)

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

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

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version