Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » $SiteConfig.Tagline not working within a loop

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

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

Page: 1
Go to End
Author Topic: 750 Views
  • RichMcNabb
    Avatar
    Community Member
    34 Posts

    $SiteConfig.Tagline not working within a loop Link to this post

    Hi,

    I have added a company tagline which I can access from ss templates using $SiteConfig.Tagline. However I am having trouble when trying to access the tagline within a loop:

    <% control Branches %>
          <div class="office_location"><a name="$Name" id="$Name"></a>
             <div class="office_details">
                <h2>$Name CDP Office</h2>
                <p>$Location $SiteConfig.Tagline</p>
             <div class="office_map"> <a href="$GoogleMap" target="_blank"><img src="$LocationMapImage.LocationMap.URL" alt="View the $Name CDP office on Google maps" title="View the $Name CDP office on Google maps" width="$LocationMapImage.LocationMap.Width" height="$LocationMapImage.LocationMap.Height" /></a>
                <p class="view_google_map"><a href="$GoogleMap" target="_blank" title="View the $Name CDP office on Google maps">View Google map directions &raquo;</a></p>
             </div>
          </div>
          <div class="clear"> </div>
    <% end_control %>

    I suspect the problem may be when I am accessing the branches it is unable to locate information outside of that. Is there any way I could make it globally acessiable.

    Any help would be greatly appreciated. Cheers!

    - Rich McNabb

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: $SiteConfig.Tagline not working within a loop Link to this post

    yep, when in a loop you move to that "context". to access the top level context try...

    <p>$Location $Top.SiteConfig.Tagline</p>

  • RichMcNabb
    Avatar
    Community Member
    34 Posts

    Re: $SiteConfig.Tagline not working within a loop Link to this post

    Thanks swaiba that works great!!

    I have one more question about accessing another page. I have 3 training pages:

    TrainingIntro.php (introduction with a training schedule download)
    > TrainingHolder.php (course subjects listed)
    >TrainingPage.php (course overview)

    On TrainingIntro.php I can access the the pdf download by using $TrainingScheduleDownload.URL. However on TrainingPage.php I can't and am not sure how I would go about accessing something that is 2 levels above.

    Would I need a function that gets the info from TrainingIntro or can I specify a page directly using something like (training-intro)$TrainingScheduleDownload.URL

    Any help would be fantastic. Thanks again.

  • RichMcNabb
    Avatar
    Community Member
    34 Posts

    Re: $SiteConfig.Tagline not working within a loop Link to this post

    Found it!!

    $Page(Training).TrainingScheduleDownload.URL

    750 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.