Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Giving a set a title


Reply

6 Posts   731 Views

Avatar
VictorH

14 February 2010 at 8:44am Community Member, 29 Posts

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 %>

Avatar
UncleCheese

14 February 2010 at 9:50am 4085 Posts

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"

Avatar
VictorH

14 February 2010 at 9:54am Community Member, 29 Posts

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>

Avatar
UncleCheese

14 February 2010 at 10:17am 4085 Posts

What about rel="movie-$ParentID"?

Avatar
VictorH

14 February 2010 at 10:23am Community Member, 29 Posts

Just tried it. It doesn't generate anything just rel="movie-"

Avatar
UncleCheese

14 February 2010 at 10:45am 4085 Posts

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.