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.

Template Questions

Linking to an internal page


Reply

4 Posts   497 Views

Avatar
c1rcask8a

22 February 2013 at 10:07am Community Member, 4 Posts

Hi,

In one of my templates I want to hardcode a link to the contact page this is what I've got:

<a href="$BaseHref/contact-us/" id="askBtn" class="largeBtn">Ask A Question</a>

However the link produced is:

http://localhost/infoandtrack//contact-us/

Which still works but is there a better variable to use than $BaseHref which won't add the extra slash?

Thanks!

Avatar
c1rcask8a

22 February 2013 at 10:13am Community Member, 4 Posts

Ahh figured it out!

<a href="./contact-us/" id="askBtn" class="largeBtn">Ask A Question</a>

Avatar
c1rcask8a

22 February 2013 at 10:30am Community Member, 4 Posts

Got given a better answer,
In the controller on Page.php:

public function ContactPage() {
   return UserDefinedForm::get()->filter('ParentID', '0')->first();
}

Then back to my link:

<a href="$ContactPage.Link" id="askBtn" class="largeBtn">Ask A Question</a>

Avatar
c1rcask8a

22 February 2013 at 10:31am Community Member, 4 Posts

This is incase the client changes the page name etc..