Etomite Community Forums: forming links with titles and alt text - Etomite Community Forums

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

forming links with titles and alt text how to get database fields from target link

#1 User is offline   TomD 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 4
  • Joined: 26-February 07

Posted 05 June 2009 - 08:48 PM

I know you can form a link to an internal page by using <a href="[~visitors~]">visitors</a>

Is there a way to get to the database fields of the target so they can be used in the link?
Using [*pagetitle*] returns the current page, not the one that is being targeted.

Example using the above, is there a way to get pagetitle and longtitle of visitors so the link could be formed like this:

<a href="[~visitors~]" alt="[*visitor's pagetitle*]" title="Go to [*visitor's pagetitle*]">visitors</a>

#2 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,061
  • Joined: 10-August 06
  • Location:Brisbane, Queensland, Australia

Posted 05 June 2009 - 09:58 PM

Etomite works with templating and the placeholders you are using take the info directly from the page being rendered. To substitute other information, you will need to write a snippet. One that would do what you are requiring would be quite easy...

Something like:
Snippet: link_snippet

$page=isset($page) ? $page : $etomite->documentIdentifier;
$url=$etomite->makeURL($page,'','');
$pageInfo=$etomite->getPageInfo($page, $active=1, $fields='id, pagetitle, alias, longtitle');
$text=isset($text) ? $text : 'default text';

$output=
"<a href=\"'.$pageInfo['alias'].'\" alt=\"'.$pageInfo['longtitle'].'\" title=\"'.$pageInfo['pagetitle'].'\">'.$text.'</a>";
return $output;


Then call this in the page where you want the link:

[!link_snippet?page=24&text=visitors!]

will display the required info (not tested).

#3 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,061
  • Joined: 10-August 06
  • Location:Brisbane, Queensland, Australia

Posted 06 June 2009 - 10:26 PM

After more thought on this, it makes we wonder why you would do this and not just hard-code the link in instead of using a snippet and targeting the page in the snippet call. It would be far easier, quicker and cleaner to just manually put the link to the page in your template and type in the pagetitle and longtitle of the target.

That is, unless you want automatically generated link information for some reason.

If so, the link being generated must be RELATIVE to any given starting variable. For example- relative to the page you are currently on: a parent, a child, or the ID +5 or the alias less the first 3 letters in the name etc, or relative to the time of the day or day of the week or a session cookie value.

Most of the many navigation snippets create dynamic links like this and may be appropriate for what you are doing if you need more than just a hard-coded link.

#4 User is offline   cathode 

  • Etomite Staff
  • Icon
  • Group: Staff
  • Posts: 648
  • Joined: 21-November 05
  • Location:Indiana, U.S.

Posted 08 June 2009 - 05:08 PM

View PostCris D., on Jun 6 2009, 06:26 PM, said:

After more thought on this, it makes we wonder why you would do this and not just hard-code the link in instead of using a snippet and targeting the page in the snippet call. It would be far easier, quicker and cleaner to just manually put the link to the page in your template and type in the pagetitle and longtitle of the target.

That is, unless you want automatically generated link information for some reason.

If so, the link being generated must be RELATIVE to any given starting variable. For example- relative to the page you are currently on: a parent, a child, or the ID +5 or the alias less the first 3 letters in the name etc, or relative to the time of the day or day of the week or a session cookie value.

Most of the many navigation snippets create dynamic links like this and may be appropriate for what you are doing if you need more than just a hard-coded link.


if you use [~23~] where 23 is the ID of the page you're linking to, then you don't have to worry about a possible page alias change down the road. When using SEF URL's this method will generate agood clean link that looks like '/visitors.html" or whatever.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users