7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Giving a set a title
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 615 Views |
-
Giving a set a title

14 February 2010 at 8:44am
I want to give each list of posters that gets generated a unique rel tag. So the first list of posters will have something like rel="movie-1" and then the second list of posters has rel="movie-2" like this code. Is there a way to give a DataObjectManager a Title or something?
<ul>
<li><a rel="set-1">item 1</a></li>
<li><a rel="set-1">item 2</a></li>
</u><ul>
<li><a rel="set-2">item 2</a></li>
<li><a rel="set-2">Item 4</a></li>
</ul><% control Children(4) %>
<h3><a href="$Link">$Title</a></h3>
<h4>Sypnosis</h4>
<p>$Content</p>
<h4>Posters</h4>
<% if Posters %>
<ul class="posters clear">
<% control Posters %>
<li>
<a href="<% control PosterImage %>$URL<% end_control %>" title="$PosterName" rel=""><% control PosterImage %><% control CroppedImage(125,188) %><img src="$URL" alt="$PosterName" /><% end_control %><% end_control %><span></span></a>
</li>
<% end_control %>
</ul>
<% else %>
<h5>No Posters Yet</h5>
<p>Do you have a poster for this movie? Please <a href="contact">send it to us</a> so we can add it to the site.</p>
<% end_if %>
<% end_control %> -
Re: Giving a set a title

14 February 2010 at 9:50am
There are a number of ways to do it.
rel="movie-$Pos" will give you the number of the record's position. Starts with 1.
Or, since you know the ID is guaranteed unique, you can always do
rel="movie-$ID"
-
Re: Giving a set a title

14 February 2010 at 9:54am
That would generate something like this.
<ul>
<li><a rel="movie-1">item-1</a></li>
<li><a rel="movie-2">item-2</a></li>
<li><a rel="movie-3">item-3</a></li>
</ul><ul>
<li><a rel="movie-1">item-1</a></li>
<li><a rel="movie-2">item-2</a></li>
<li><a rel="movie-3">item-3</a></li>
</ul>I want to generate something like this.
<ul>
<li><a rel="movie-1">item-1</a></li>
<li><a rel="movie-1">item-2</a></li>
<li><a rel="movie-1">item-3</a></li>
</ul><ul>
<li><a rel="movie-2">item-1</a></li>
<li><a rel="movie-2">item-2</a></li>
<li><a rel="movie-2">item-3</a></li>
</ul> -
Re: Giving a set a title

14 February 2010 at 10:23am
Just tried it. It doesn't generate anything just rel="movie-"
-
Re: Giving a set a title

14 February 2010 at 10:45am
Well, you get the idea, though. It's just the foreign key that ties the object to the parent. So whatever your has_one relationship is from Poster to its containing page, use that, e.g. $PosterHolderID, or whatever you're using.
| 615 Views | ||
|
Page:
1
|
Go to Top |

