Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_bio : store additional biographical info about your users
Or perhaps this untested update to johnstephens’ solution…
<txp:thumbnail id='<txp:smd_bio_info author=''<txp:mem_profile var="name" />'' items="avatar" label="" />' />
(note the dual single quotes around the mem_profile tag to stop the thumbnail’s ID from prematurely finding the solitary single quote and thinking it’s the end of its attribute. It makes a difference on some tags — don’t ask! More on Textbook)
Last edited by Bloke (2009-09-15 23:23:01)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: smd_bio : store additional biographical info about your users
johnstephens wrote:
Single quotes are required to parse
txp:tag
s withintxp:tag
s.
Thank you!!!
This does most certainly work:
<txp:thumbnail id='<txp:smd_bio_info author='<txp:mem_profile var="name" />' items="avatar" label="" />' />
Today has been too good in TXP forum world. There are a number of people on the forums here who have answered all the many of my questions within minutes as if the whole purpose of the forum was for people to wait on me. :) Thank you all.
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Re: smd_bio : store additional biographical info about your users
I am very impressed by power, usability, smooth integration to TxP, and overall elegance of smd_bio. And I am sorry to leave it and installing rss_author_info instead.
Since I have already made a separate section for author profiles with implemented <txp:author link="1" />
on my multi-user site, I lack only one feature — to display a portrait (photo, picture, avatar) next to the author’s name like in this forum.
All went well on admin side. On Extentions: Bio Config tab I have made one bio item named photo, selected type — Image. On Admin: Users tab — a drop-down selection of author photos appears.
While selectet, e.g. 52.jpg, its thumbnail 52t.jpg appears below and even hover infotip <img src="http://localhost/local.on.lt/images/52t.jpg" alt="Tomas" title="Tomas Baranauskas" width="64" height="64" /><br/>
with this picture popups. But really the big 52.jpg version is displaying instead of 64×64 thumbnail 52t.jpg on this author’s live articles.
If only one small picture 53.jpg is associated with the author, it is shown on the bottom of Edit author settings, although not over his item on the list — hover popups only <br/>
and background color — instead of the thumbnail. Although 53.jpg picture now is shown on this author’s live articles as should.
Offline
Re: smd_bio : store additional biographical info about your users
Vienuolis wrote:
I lack only one feature — to display a portrait (photo, picture, avatar) next to the author’s name like in this forum.
Thanks for the kind words — I made the plugin specifically handle photos in a user’s bio so it should work like Example 3 in the plugin help.
<txp:smd_bio_info items="photo" label="">
<txp:thumbnail id="{smd_bio_photo}" />
</txp:smd_bio_info>
That will display a small author’s photo on the page — assuming a thumbnail exists. If you wish to do some clever stuff like determine if the author has a photo or not, you can combine this with txp:variable and then take action to display an alternative (a ‘no photo’ picture, perhaps). Or use the ability of smd_bio to limit the x and y dimensions of the displayed photo by putting 64
in the ‘size’ field of your photo item which will set both dimensions to the same size.
I admit that the output on the admin side is a little bit rubbish. I intend to eventually allow you to configure which items are displayable in the hover tooltip via some plugin prefs — at the moment it shows an image thumbnail (if there is one) and text items only.
Remember that you can alter the layout of the bio items on the admin side if you create a stylesheet called smd_bio
. Combining that with the ‘order’ field should allow you some degree of control over the input fields on the Admin->Users tab.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: smd_bio : store additional biographical info about your users
And shown quirky. The tag <txp:smd_bio_info items="foto" break="" />
is converted to HTML as <p><br/ class=" smd_bio_foto">Author's photo</br/>53</p>
— as an item title and an ID number instead of the picture itself. Also with non-removable break:
Author's photo
53
The portrait is shown only by the extended code:
<txp:smd_bio_info items="foto" class="author-photo" label="" wraptag="p" break="">
<txp:image id="{smd_bio_foto}" />
</txp:smd_bio_info>
Offline
Re: smd_bio : store additional biographical info about your users
Vienuolis wrote:
The tag
<txp:smd_bio_info items="foto" break="" />
is …an item title and an ID number instead of the picture itself.
It’s designed that way! Since I have no idea how you wish to format the picture — as a thumb, a full size pic, on hover, in a lightbox, etc — I decided not to limit you to one particular method of display. So the photo type only outputs the ID number of the photo and it’s up to you to do something with it.
Also with non-removable break:
That’s an unfortunate side effect of the labeltag. If you set label=""
and still have a labeltag
set to something (it is set to the item’s name by default) the core function I use in the plugin automatically inserts a <br />
. Rather annoying. To remove the br you are right, you need to specify labeltag=""
as well. If I find a decent way round this I’ll implement it in the next version.
I don’t know why the class is set with an extra space at the start though nor why it attaches itself to the erroneous first ‘br’ — I’ll have to look into that, thanks for letting me know.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: smd_bio : store additional biographical info about your users
I am sorry, I was not so quick in appending my report. Thanks for your explanation. One only question left: would be reason of setting default <txp:smd_bio_info type="image" />
(or name, items insted of type) behavior to simply display an image in its context? With no error actions if some image does not exist?
Offline
Re: smd_bio : store additional biographical info about your users
About the break tag. I think in most cases it will less appropriate than simple :
between a field name and its container. E.g. RealName: Name Surname. When answer should be more than one line, <dl><dt>Definition term:</dt><dd>definition data</dd></dl>
would fit better than <br />
, I guess.
Offline
Re: smd_bio : store additional biographical info about your users
Vienuolis wrote:
<txp:smd_bio_info type="image" />
… simply display an image in its context? With no error actions if some image does not exist?
Hmmm I tried to do that first but it was too limiting. Some people wold complain that outputting the thumbnail by default is “wrong”; others would complain if I used the full size image. So I left the choice to you :-)
The code:
<txp:smd_bio_info items="foto" class="author-photo" label="" wraptag="p" break="">
<txp:image id="{smd_bio_foto}" />
</txp:smd_bio_info>
will display nothing and produce no error if there is no image to display. If you wish to display a default ‘no avatar’ image you might do this first:
<txp:variable name="has_bio_image" value='<txp:smd_bio_info items="mug">{smd_bio_mug}</txp:smd_bio_info>' />
<txp:if_variable name="has_bio_image" value="">
<p><txp:image name="no-avatar" /></p>
<txp:else />
<txp:smd_bio_info items="mug" label="" wraptag="p" break="">
<txp:image id="{smd_bio_mug}" />
</txp:smd_bio_info>
</txp:if_variable>
I have already raised an enhancement about the break in the labels. Nobody has complained yet so it might make it to the core. If not I’ll have to fix it in the plugins and not use the core’s label functionality.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: smd_bio : store additional biographical info about your users
so it should work like Example 3 in the plugin help.
<txp:smd_bio_info items="photo" label="">
<txp:thumbnail id="{smd_bio_photo}" />
</txp:smd_bio_info>
That will display a small author’s photo on the page — assuming a thumbnail exists.
Sorry, all is fine only on the admin side, but on live articles — big versions instead of thumbnails. I have tested 52, 52t, and 52t.jpg — the same result.
Offline
Re: smd_bio : store additional biographical info about your users
will display nothing and produce no error if there is no image to display.
Thanks, that’s perfect for this my site.
If you wish to display a default ‘no avatar’ image you might do this first:
The great tip — I will save it for the future, thank you very much!
Offline
Re: smd_bio : store additional biographical info about your users
Hi Stef,
Great idea for a plug-in, just about to finalise a blog and this will be perfect. I’m running TXP 4.2.0 (and PHP 5.1.6) but when I click on the Bio Config
tab I get the following error:
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: php-fcgi-starter
Any idea what it all means?
Last edited by decoderltd (2009-11-10 15:24:59)
Offline