Light-weight, fast, simple and powerful!
Translations of this page?:


The link() function by default produces the title of the current page wrapped in HTML hyperlink tags.1) For example, in an out-of-the-box Wolf install, for the “About Us” page, this code:

<?php echo $this->link(); ?>


<a href="">About us</a>


link() can take two arguments: the first to give the title for the link (so overriding the default page title), the second can be used for other link parameters.

See also: linkById()


1. Link with different text

Assuming that “About Us” is still the “current” page, then this code:

<?php echo $this->link('Click here!'); ?>

will produce this link:

<a href="">Click here!</a>

2. Link with Title text, adding parameter

To retain the default title, but add a further parameter, this code:

<?php echo $this->link($this->title, ' class="info"'); ?>

will produce this link:

<a href="" class="info">About us</a>

To produce links of pages other than the current one, see the "find" function.

1) Consult the documentation on $this-> to find out what the “current” page is in different situations.
functions/link.txt · Last modified: 2011-09-12 00:46 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 / design by yello studio / Wolf CMS Inside