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 /

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

Linking to Specific Pages

Go to End

7 Posts   4538 Views


Community Member, 2 Posts

26 February 2009 at 1:27pm

I am trying to find how you can link straight to a page via the templates without an luck.

First Example: I would like to have the Logo link to the homepage, is there a function for this or do I just need to do this manually?

Second Example: I would like to link to a Trademarks page that is not on the menu or search anywhere, same question as above.



Community Member, 400 Posts

2 March 2009 at 1:30am

I think doing it manually will make things much easier for you :)


Community Member, 5 Posts

6 June 2009 at 11:19am

I'd like to know this answer as well.

Carbon Crayon

Community Member, 598 Posts

7 June 2009 at 2:16pm

You need to create a function which returns the page you want to link to.

Something like:

public function GetHomePage(){

return DataObject::get_one("HomePage");


You can then use $GetHomePage.Link to return the URL.

If you need to be more specific then you can add a filter to the query.



Community Member, 400 Posts

8 June 2009 at 4:58am

Hi, I created a widget with which you can select any Page type and list them on any of the web pages you prefer. Hope this will be useful.

Check it out, I am posting a ZIP file, I am on windows at the moment :) will post the widget at the widget list soon as I get in to my laptop :P

Would like to hear any comments about this widget

Attached Files
Samba Sam

Community Member, 85 Posts

4 November 2009 at 2:01pm


What would I use to link my logo to my homepage, if I don't have a specific HomePage type.
My homepage uses the default Page Type.

This doesn't work:
public function GetHomePage(){return DataObject::get_one("HomePage");}

Is there something I could do with <% control Page(home) %>?

I know I could just use a href="/" , but I am curious about how to link to specific pages in a generic template.


Carbon Crayon

Community Member, 598 Posts

4 November 2009 at 2:05pm

hmm, well if you cant do it with a class name then you are left with any of the other column in the database, Title, ID, URLSegment etc.

If you can't find a way to define it in a database query (or some other logic) then I guess you would have to hard code it....