Jump to:

22992 Posts in 11842 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Adding Hyperlink to another site from SilverStripe

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 2 3
Go to End
Author Topic: 1549 Views
  • Sue
    Avatar
    Community Member
    26 Posts

    Adding Hyperlink to another site from SilverStripe Link to this post

    How can I add a link to another website from a StripeSite had have it show up in the navigation. The current code for Navigation.ss in Themes>tlmweb>templates>Includes is

    <div id="navigation">
    <div id="topnav">
    <div id="links">
    <ul>
    <% control Menu(1) %>   
    <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>
    <% end_control %>
    </ul>
    </div>
    <div id="arrow_container"><div id="top_arrow"></div></div>
    </div>
    <hr>
    <div id="subnav">
    <div id="arrow_container"><div id="sub_arrow"></div></div>
    <div id="links">
       <ul>
    <% control Menu(2) %>
                <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>
    <% end_control %>
    </ul>
    </div>
    </div>
    </div><!-- END NAVIGATION -->

    I want to add a link called "Gallery" to point to http://www.site.com (obviously not the link, but for coding only - I can replace it with the correct link)

    I have been told this is where to do the changes but I have tried all of the placements of the html code and it doesn't show up on the site.

    Also, (this because I am new to SilverStripe) there is another theme called blackcandy in the theme folder and it has a Navigation.ss - but I assume (I know) that the change has to be made in the theme that applies to the site - or is the site theme built on blackcandy. Not sure how the structure of SilverStripe works.

    I have tried to search the SilverStripe site and forums for help but can't find the answer so please help and if you can please actually give the correct code to use.

    thanks
    Sue

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    Sue, just place the link just outside <% control Menu() %> block but before the </ul>. You have to flush the cache after you make the change for it show up. Just add ?flush=1 to the end of the URL in your browser. So http://www.site.com/my-page/?flush=1

  • Sue
    Avatar
    Community Member
    26 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    Hello again - thanks!

    I missed the flush step - so I'll try again. Does this just get done on the one theme or is it possible that themes are built on another?

    Sue

    PS got the gallery set up by doing a c name (ie www.gallery.mysite.com)!

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    Each theme in the themes directory is a standalone theme. In SS2.3 you set the theme in mysite/_config.php

  • Sue
    Avatar
    Community Member
    26 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    Got it! it was the flush that I didn't know about. Now I am on my way to getting the job done and it is only with your help that I got to this point.

    Sue

  • Sue
    Avatar
    Community Member
    26 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    That worked perfectly. Now how do I hard code a link in the site map??

    Sue

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    Well you can add <li><a href="http://gallery.mysite.com" title="Go to the Gallery" class="Link"><span>Gallert</span></a></li> outside one of the <% Menu %> control bloack or you can add a new Redirector Page to your site via the CMS

  • Sue
    Avatar
    Community Member
    26 Posts

    Re: Adding Hyperlink to another site from SilverStripe Link to this post

    That sounds like what I did on the navigation.ss in the theme - I now need to add this to the site map - what file creates the site map?

    1549 Views
Page: 1 2 3
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.