cms_selflink tag


Creates a link to another CMSMS content page inside your template or content. Can also be used for external links with the ext parameter.

   How to use?

Just insert the tag into your template/page like:

{cms_selflink page="page_alias"}

   Available parameters

  • page - Page ID or alias to link to.
  • dir anchor (internal links) - New option for an internal page link. If this is used then anchorlink should be set to your link.
  • anchorlink - New paramater for an internal page link. If this is used then dir ="anchor" should also be set. No need to add the #, because it is added automatically.
  • urlparam - Specify additional parameters to the URL. Do not use this in conjunction with the anchorlink parameter
  • tabindex="a value" - Set a tabindex for the link.
  • dir start/next/prev/up - Links to the default start page or the next or previous page, or the parent page (up). If this is used page should not be set.

Note! Only one of the above may be used in the same cms_selflink statement!!

  • text - Text to show for the link. If not given, the Page Name is used instead.
  • menu 1/0 - If 1 the Menu Text is used for the link text instead of the Page Name
  • target - Optional target for the a link to point to. Useful for frame and javascript situations.
  • class - Class for the <a> link. Useful for styling the link.
  • id - Optional css_id for the <a> link.
  • more - place additional options inside the <a> link.
  • label - Label to use in with the link if applicable.
  • label_side left/right - Side of link to place the label (defaults to "left").
  • title - Text to use in the title attribute. If none is given, then the title of the page will be used for the title.
  • rellink 1/0 - Make a relational link for accessible navigation. Only works if the dir parameter is set and should only go in the head section of a template.
  • href - If href is used only the href value is generated (no other parameters possible). Value is page alias or ID.
    Example: <a href="{cms_selflink href="page_alias"}"><img src="" /></a>
  • image - A url of an image to use in the link.
    Example: {cms_selflink dir="next" image="next.png" text="Next"}
  • alt - Alternative text to be used with image (alt="" will be used if no alt parameter is given).
  • width - Width to be used with image (no width attribute will be used on output img tag if not provided.).
  • height - Height to be used with image (no height attribute will be used on output img tag if not provided.).
  • imageonly - If using an image, whether to suppress display of text links.
    Example: {cms_selflink dir="next" image="next.png" text="Next" imageonly=1}
  • ext - For external links, will add class="external and info text.
    Warning: only text, target and title parameters are compatible with this parameter
  • ext_info - Used together with "ext" defaults to (external link).
  • assign - Assign the results to the named smarty variable.

   Syntax examples

<a href="{cms_selflink href='page_alias'}"><img src="" /></a>
<a href="{cms_selflink href=65}">foo</a>
{cms_selflink dir='next' image='next.png' text='Next'}
{cms_selflink dir='next' image='next.png' text='Next' imageonly=1}
{cms_selflink ext='' text='CMS Made Simple website'}