Author Topic: trouble using XML template  (Read 13092 times)

0 Members and 1 Guest are viewing this topic.

Offline CAD

  • Older Power User
  • *****
  • Posts: 168
  • I've got my eye on you!
    • View Profile
trouble using XML template
« on: August 17, 2009, 06:54:20 am »
im having trouble creating a template. Hoping soemone can help :)

i have changed latest xml export plugin to call a template file as per http://www.videodb.info/forum_en/index.php?topic=1017.0
if i call the param option, pvd crashes.

XML.ptm contains:
Code: [Select]
HEAD%
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
%HEAD%
<movie>
{%value=52 template="tpl\actors.tpl param="full"}
<title>{%value=title}</title>
<snip>

in tpl\actors.tpl contains:
Code: [Select]
%HEAD%<actor>%HEAD%
<name>{%param=name}</name>
<role>{%param=role}</role>
%FOOT%</actor>%FOOT%


if i remove param="full" setting then xml output looks like:
<movie>
<actor>
<name>{%param=name}</name>
<role>{%param=role}</role>
</actor>

any ideas :) anyone :)


 
« Last Edit: August 23, 2009, 03:32:45 am by rick.ca »
three fingered salutation

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: trouble using template
« Reply #1 on: August 17, 2009, 11:08:09 am »
try
{%value=actors template="tpl\actors.tpl param="full"} instead of {%value=52 ...
Gentlemen, you can’t fight in here! This is the War Room!

Offline CAD

  • Older Power User
  • *****
  • Posts: 168
  • I've got my eye on you!
    • View Profile
Re: trouble using template
« Reply #2 on: August 18, 2009, 07:10:11 am »
sorry
Quote
try
{%value=actors template="tplactors.tpl param="full"}
didn't work.

In my .ptm file I have
Code: [Select]
<movie>
{%value=actors template="tplactors.tpl" maxvalues="3" param="full"}

maxvalues works (limits no of entries to 3) IF param="full" is not included, but i don't get any data.
output file looks like:
Code: [Select]
<movie>
<actor>
<name>{%param=name}</name>
<role>{%param=role}</role>

<name>{%param=name}</name>
<role>{%param=role}</role>

actors.tpl contains:
Code: [Select]
%HEAD%<actor>%HEAD%
<name>{%param=name}</name>
<role>{%param=role}</role>
%FOOT%</actor>%FOOT%

what am i doing wrong :(


three fingered salutation

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: trouble using template
« Reply #3 on: August 18, 2009, 11:06:36 am »
Ups, sorry. It should be params:

{%value=actors template="tplactors.tpl" maxvalues="3" params="full"}
Gentlemen, you can’t fight in here! This is the War Room!

Offline CAD

  • Older Power User
  • *****
  • Posts: 168
  • I've got my eye on you!
    • View Profile
Re: trouble using template
« Reply #4 on: August 19, 2009, 03:01:00 am »
Yay - this works. :)

Note. For others who have struggled (like me) the options in tpl does not require the "s"

so my .ptm file contains:
Code: [Select]
<movie>
{%value=actors template="actors.tpl" maxvalues="3" params="full"}
....
....
and the actors.tpl file contains:
Code: [Select]
%HEAD%<actor>%HEAD%
<name>{%param=name}</name>
<role>{%param=role}</role>
%FOOT%</actor>%FOOT%
NB: the NO "S" in %param :D
three fingered salutation

Offline CAD

  • Older Power User
  • *****
  • Posts: 168
  • I've got my eye on you!
    • View Profile
Re: trouble using template
« Reply #5 on: August 20, 2009, 07:25:56 am »
sorry to be a nuff nuff  ;)
i'm trying to limit the no of tags being returned.
this value doesn't have multiple params. I can't find how to pass this to tpl file.

in ptm file i have
<movie>
{%value=tags template="tags.tpl" maxvalues="3"}
...
...
in tags.tpl file i have
Code: [Select]
<tag>{%value=tags}</tag>nb. i have tried %params=tags, %value=tag, %value=tag, tag, tags, %tags etc.

output from this is
Code: [Select]
<tag>{%value=tag}</tag><tag>{%value=tag}</tag><tag>{%value=tag}</tag>pls pls hlp. :)

Also would it be possible to have "maxvalues=<value>" understandable under main .ptm file without calling template. Then we can limit no of entries directly from there without having to create a template for every section where we only want to limit the no of entries.
like:
Code: [Select]
<movie>
<director>{%value=directors maxvalues=2}</director> or
<tags>{%value=tags maxvalues=5}</tags>
....
....
three fingered salutation

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: trouble using template
« Reply #6 on: August 20, 2009, 03:59:27 pm »
Unfortunately it is not possible with the current version of the plugin to limit number of such values, but I will improve the plugin in this regard in the next version.
Gentlemen, you can’t fight in here! This is the War Room!

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: trouble using template
« Reply #7 on: August 20, 2009, 08:25:10 pm »
Wait, my answer was regarding your suggestion: <tags>{%value=tags maxvalues=5}</tags>

The other way using aditional template files should work:
in the main template:
Code: [Select]
{%value=tags template="pages\tags.tpl" maxvalues="3"}in pages\tags.tpl:
Code: [Select]
<tag>{%value}</tag>
Gentlemen, you can’t fight in here! This is the War Room!

Offline CAD

  • Older Power User
  • *****
  • Posts: 168
  • I've got my eye on you!
    • View Profile
Re: trouble using template
« Reply #8 on: August 21, 2009, 12:57:06 am »
Thanks Nostra - You're awesome  :D

This works a treat when you know what variables go where  ;)
for benefit of others I have:
Code: [Select]
<movie>
{%value=tags template="tags.tpl" maxvalues="3"}
...
...
In main export plugin.
and
Code: [Select]
%HEAD%<tag>%HEAD%{%value},%FOOT%</tag>%FOOT%in the called .tpl file.

output looks like:
Code: [Select]
<movie>
<tag>Rancher,Marshal,New Mexico,</tag>
;D

three fingered salutation

 

anything