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, biapar, Willr, Ingo, swaiba, simon_w

Adding Hyperlink to another site from SilverStripe


Go to End
Reply


17 Posts   2049 Views

Avatar
Sue

Community Member, 26 Posts

22 July 2011 at 5:47am

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

Avatar
zenmonkey

Community Member, 532 Posts

22 July 2011 at 7:00am

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

Avatar
Sue

Community Member, 26 Posts

22 July 2011 at 7:07am

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)!

Avatar
zenmonkey

Community Member, 532 Posts

22 July 2011 at 7:16am

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

Avatar
Sue

Community Member, 26 Posts

22 July 2011 at 7:24am

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

Avatar
Sue

Community Member, 26 Posts

26 July 2011 at 4:48am

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

Sue

Avatar
zenmonkey

Community Member, 532 Posts

26 July 2011 at 5:01am

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

Avatar
Sue

Community Member, 26 Posts

26 July 2011 at 5:04am

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?

Go to Top