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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Access "Parent" information from within a contol

Go to End

2 Posts   592 Views


Community Member, 48 Posts

26 June 2012 at 2:46pm

Edited: 26/06/2012 2:47pm

I have a gallery page, inside which, I have a control to output photos. However. From within this control, I need to access some information in the "Parent" ie the gallery, not the photos. I thought I could accomplish this using $Parent.xxxx however this doesn't appear to work.

How can I access this (code below shows the $Parent.xxxx attempt)

<div id="thumbs" class="navigation">
				<ul class="thumbs noscript">
					<% control Photos %>
						<a class="thumb" href="$PaddedImage(990,655).URL" title="$Title">
							<img src="$Thumbnail(179,119).URL" alt="Title #16" />
						<div class="caption">
							<% if Parent.GalleryText %>
								<div class="image-desc">$Parent.GalleryText</div>
							<% else %>
								<div class="image-title">$Title</div>
								<div class="image-desc">$Description</div>
							<% end_if %>
					<% end_control %>


Community Member, 48 Posts

26 June 2012 at 2:58pm