Jump to content

Link field


gregory
 Share

Recommended Posts

Hi,

Unless I'm misunderstanding something here, what you want is actually a Page field. In your template files you can output the URL of the selected page:

<?php if ($page->page_field_name): ?>
    <a href="<?php echo $page->page_field_name->url; ?>"><?php echo $page->page_field_name->title ?></a>
<?php endif; ?>

Does that sound about right?

  • Like 1
Link to comment
Share on other sites

'pages' and 'links' sound plural to me. If that's the case, you still use Page field ('Page Reference' in UI) but iterate over it. May look like this:

foreach($page->page_field_name as $link)
	echo "<a href='{$link->url}'>{$link->title}</a>";

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...