Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-01-18 01:37:01
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Url only links
Hi all,
Is there any way that it is possible to output only the url of <code><txp:link /></code>, say <code><txp:link_url /></code> for instance, I know this doesn’t work but added to give an idea of what I’m looking for.
What I would like to do is;
<code><dt class=“links-list”><txp:link /></dt>
<dd><txp:link_description /></dd>
<dd><a href=“url only here”>Visit site</a></dd></code>
Just to make the link really obvious.
Any help appreciated :)
Graham.
Offline
#2 2006-01-18 07:44:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Url only links
The only way I can think of is adding it to the link description, or make it the link title.
Offline
#3 2006-01-18 10:04:13
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Re: Url only links
> doggiez wrote:
> The only way I can think of is adding it to the link description, or make it the link title.
Hi Els,
I’m afraid I’m being a bit greedy and want the url, title and description. Could be a tag request I guess?
Cheers,
Graham.
Offline
#4 2006-01-18 15:24:21
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Url only links
bancroft wrote:
Could be a tag request I guess?
Yep, or a plugin request.
Offline
Re: Url only links
You could probably do that with PHP, stripping the url away from the appropriate array and display it. Look at the source, or wait for a dev’ to tag along.
Offline
#6 2006-01-18 16:18:47
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Url only links
The funny thing is, according to the tag builder in the ‘form’ tab, there is a tag <txp:link_text />
(link text only). It just doesn’t seem to output anything…
Offline
#7 2006-01-18 19:09:29
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Re: Url only links
> The funny thing is, according to the tag builder in the ‘form’ tab, there is a tag <txp:link_text />
(link text only). It just doesn’t seem to output anything…
Yeah I saw that here and tried it but nothing happened as you say.
Unfortunately being a bit of a newbie, plugins and php stripping are beyond me so I think I’ll just make do until I can grow some new brain cells ;)
Thanks for your replies, very much appreciated.
Graham.
Last edited by bancroft (2006-01-18 19:09:49)
Offline
#8 2006-01-18 21:06:31
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Url only links
I found a way. But you have to hack taghandlers.php.
Find (in function linklist, around line 207):
<code>
while ($a = nextRow($rs)) {
extract($a);
$linkname = str_replace(“& “,”& “, $linkname);
$link = ‘<a href=”’.doSpecial($url).’”>’.$linkname.’</a>’;
$linkdesctitle = ‘<a href=”’.doSpecial($url).’” title=”’.$description.’”>’.$linkname.’</a>’;
$thislink = $a;$out = str_replace(“<txp:link />”, $link, $Form);
$out = str_replace(“<txp:linkdesctitle />”, $linkdesctitle, $out);
$out = str_replace(“<txp:link_description />”, $description, $out);$outlist[] = parse($out);
}
</code>
and replace it with
<code>
while ($a = nextRow($rs)) {
extract($a);
$linkname = str_replace(“& “,”& “, $linkname);
$link = ‘<a href=”’.doSpecial($url).’”>’.$linkname.’</a>’;
$linkdesctitle = ‘<a href=”’.doSpecial($url).’” title=”’.$description.’”>’.$linkname.’</a>’;
$linkurl = doSpecial($url);
$thislink = $a;$out = str_replace(“<txp:linkurl />”, $linkurl, $Form);
$out = str_replace(“<txp:link />”, $link, $out);
$out = str_replace(“<txp:linkdesctitle />”, $linkdesctitle, $out);
$out = str_replace(“<txp:link_description />”, $description, $out);$outlist[] = parse($out);
}
</code>
You’ll then have a tag <txp:linkurl />
.
Last edited by doggiez (2006-01-18 21:07:13)
Offline
#9 2006-01-18 21:39:12
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Re: Url only links
Hi Els,
Just tried it and it works a treat, thank you very much indeed :)
All the best,
Graham.
Offline
#10 2006-01-18 22:13:36
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Url only links
My pleasure :)
I see now that in the code the second & is not shown as it should, this should be & # 3 8 ; (without the spaces).
Offline
#11 2006-01-18 22:37:07
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Re: Url only links
> My pleasure :)
> I see now that in the code the second & is not shown as it should, this should be & # 3 8 ; (without the spaces).
Amended, and thank you again, you’ve made my day :)
Cheers,
Graham.
Last edited by bancroft (2006-01-18 22:37:42)
Offline
Pages: 1