English > Scripts and Templates
What's the right way to use maxvalues in a template?
daddydave:
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.
--- Code: ---{%value=actors maxvalues="3"}
--- End code ---
The whole line for that is:
--- Code: ---<p><strong>(IMDB Rating:{%value=imdbrating}) Actors: {%value=actors maxvalues="3"} Director: {%value=directors maxvalues="1"}</strong> {%value=description} </p>
--- End code ---
nostra:
You need to create a separate template file for the values and then use the following syntax in main template:
--- Code: ---{%value=actors template="pages\actor.ptm" maxvalues="3"}
--- End code ---
daddydave:
Thanks, nostra!
daddydave:
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?
rick.ca:
--- Quote ---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?
--- End quote ---
I noticed the same thing recently, and wondered how I managed to do that. I wonder if the automatic updater put them there.
Navigation
[0] Message Index
[#] Next page
Go to full version