Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Help with some txp:php
I know from the FAQ that I need to use <code><txp:php></code> to do the following, but I am having trouble writing the php. Any help would be much appreciated!
I want to add the name of the commenter to the alt attribute of the gravatar image produced by the glx_gravatar plugin in the following way:
<code><a href=”<txp:comment_web />”><txp:glx_gravatar default=“default.gif” alt=”<txp:comment_name />‘s site” /></a>
</code>
The link is working fine, it’s just the alt attribute I’m having trouble with. Thanks a lot!
Offline
#2 2006-04-07 04:02:45
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Help with some txp:php
<a href="<txp:comment_web />"><txp:php>echo glx_gravatar(array(
'alt' => comment_name(array()).'’s site',
'default' => 'default.gif'
));</txp:php></a>
:)
Offline
Re: Help with some txp:php
Thanks a lot Mary!
It is working, except that the <code><txp:comment_name /></code> tag is being automatically wrapped in the link to the site— I forgot that this was the default way that tag works. This messing up the alt attribute.
Is there any way to get to the name without generating the automatic link?
Thanks again for your help. :)
Offline
#4 2006-04-07 18:22:44
- KurtRaschke
- Plugin Author
- Registered: 2004-05-16
- Posts: 275
Re: Help with some txp:php
<txp:php>
global $thiscomment;
extract ($thiscomment);
$gravatar = glx_gravatar(array(
'alt' => $name.'’s site',
'default' => 'default.gif'
));
echo "<a href=\"$web\">$gravatar</a>";
</txp:php>
-Kurt
kurt@kurtraschke.com
Offline
Re: Help with some txp:php
Perfect! Thanks so much Kurt and Mary! :)
Offline
Pages: 1