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 Specific Pages


7 Posts   2561 Views


26 February 2009 at 1:27pm Community Member, 2 Posts

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.



2 March 2009 at 1:30am Community Member, 395 Posts

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


6 June 2009 at 11:19am Community Member, 5 Posts

I'd like to know this answer as well.

Carbon Crayon

7 June 2009 at 2:16pm Community Member, 598 Posts

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.



8 June 2009 at 4:58am Community Member, 395 Posts

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

4 November 2009 at 2:01pm Community Member, 85 Posts


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

4 November 2009 at 2:05pm Community Member, 598 Posts

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....