Sort keys and see-also links

by Peter Tyrrell Monday, August 15, 2005 9:55 AM

Trying to decide whether to post something that might be useful, or to just spaz out completely. I guess it's time for an inform-o-post so as to retain justification for this blog being on the And-O-Not web-o-site.

Um, okay. <rustle> Sure to be something back here. <squelch> Ew. Not that.

Alright, so you're using sort keys with WebPublisher and you want them sort keys to be see-also links. But what's this? WebPublisher just don't do that!? No prob, Bob. Wrap the sort key in a div tag. Give div tag a unique ID (use RecordID, for instance). Call the following from a script block immediately following the div tag:

<div id="SeeAlso[RecordID]"> [SortKey:Level1] </div><script> GetSeeAlso('SeeAlso[RecordID]', '[FieldName]') </script> Reference the following javascript from the page: function GetSeeAlso(TargetID, Field) { var Target = document.getElementById(TargetID); var CleanValue = Target.innerHTML.replace(/<font>]+>/, ''); CleanValue = CleanValue.replace(/<\/font>/, ''); var SeeAlsoLink = CreateSeeAlsoLink(CleanValue, Field); Target.innerHTML = SeeAlsoLink; } function CreateSeeAlsoLink(value, field) { var str = "?AC=SEE_ALSO&QF0=" + field + "&QI0==" + value + dbtw_params; var link = "<a href='" + str + "'>" + value + "</a>"; return link; }

And that does the trick. A see-also link built from a sort key.


blog comments powered by Disqus

Month List