Personal Video Database
English => Development => Scripts and Templates => Topic started by: daddydave on August 27, 2010, 06:40:33 pm
-
I'm starting to piddle around a little with templates. I am trying to get a template to display only the first 3 actors for the movie but it is displaying the whole list. I must have something wrong.
{%value=actors maxvalues="3"}
The whole line for that is:
<p><strong>(IMDB Rating:{%value=imdbrating}) Actors: {%value=actors maxvalues="3"} Director: {%value=directors maxvalues="1"}</strong> {%value=description} </p>
-
You need to create a separate template file for the values and then use the following syntax in main template:
{%value=actors template="pages\actor.ptm" maxvalues="3"}
-
Thanks, nostra!
-
One other thing, I was going to try to figure out this on my own using the existing templates as examples, but I am quite stumped.
I got it to work just as you said above using a subtemplate if the subtemplate contains only {%value} but this smashes the list of actor names up together without spaces. And if I do so much as put a comma to the right, I end up seeing the actual code {%value} in the output (along with the comma). I tried putting in some things in the main template as well, but without really understanding. So my new question is: is there an easy way to make it show commas in between the names?
Thanks again for all advice.
BTW I have noticed for a while that I have some of the ptm files from Plugins\Templates folder duplicated in Plugins folder itself. Is this normal or did I screw something up downloading extra templates from the forum into the wrong folder?
-
BTW I have noticed for a while that I have some of the ptm files from Plugins\Templates folder duplicated in Plugins folder itself. Is this normal or did I screw something up downloading extra templates from the forum into the wrong folder?
I noticed the same thing recently, and wondered how I managed to do that. I wonder if the automatic updater put them there.
-
In the main template, I have
{%value=actors maxvalues="3" template="ddlist\actor.ptm"}
In the subtemplate, I have
{%param=name}
This results in me seeing output to the effect of:
<strong>(IMDB Rating:6.3) Actors: {%param=name}{%param=name}{%param=name} Director: Robby Grewal</strong>
If I change the subtemplate to {%value}, it displays the actors names instead of the {%param=name} code but I am not sure how to get commas in there because the built-in templates seem to have no problems displaying commas in between the actors and I can't figure out how they do it.
-
Adding a comma after {%value} should, actually do the trick.
If you use {%param=name}, then you need to call the field in the main templates with params="full"
-
Perfect, I was going to ask you if there was anyway to get rid of the last comma without having to use Javascript, but then I decided to use · instead of a comma, so it doesn't matter. Thanks again, Nostra.