Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
img alt text using txp tags?
I’m getting old, admittedly. And it’s been almost 14 years since I first poked my head in here. (Jeezus.) You’d think I’d be some brilliant Txp user by now, like Maniqui, Jakob, and all you others, but I seem to have a bigger outtake valve than intake. So consider this a senile old man test of the docs…
How do I use Txp tag(s) (not HTML or Textile) to output an image with alt text? Just one stupid image with no bells and whistles. I seriously can’t figure that out, and the image tag docs are not making it clear.
I would like to be able to pull the “alt” text from the image details, but the tag logic is apparently over my head. I’m certain it has something to do with images
and image_info
tags, but the combination lock isn’t unlocking for me.
Please talk to me like I’m 5… or 105.
Offline
#2 2017-10-27 22:08:36
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: img alt text using txp tags?
There is the old and simple <txp:image />. It outputs by default width
, height
and alt
. If you don’t need width
and height
, so you turn off this attributes with width="0"
and height="0"
.
Offline
Re: img alt text using txp tags?
Hi Destry I gess that you need the alt for some other reason so this is the other way:
<txp:images id="##">
<img src="/images/<txp:image_info type="id"><txp:image_info type="ext">" alt="<txp:image_info type="alt">" />
</txp:images>
Last edited by colak (2017-10-28 18:15:12)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: img alt text using txp tags?
Thank you, gentlemen. Like I said, I have a bigger outtake valve than intake. Or maybe my retaining tank doesn’t hold enough. (My wife accuses me of Alzheimers, bless her heart.)
My confusion seems to be stemming a little from a combined use of alt and caption, which of course is not needed in retrospect.
Anyway, looking at the image doc again, I don’t see it explained anywhere there, in clear terms like you put it, GugUser, which might have spared me from being the fool here.
I’ll guess I’ll take a moment to add to the doc…
The
image
tag outputs thealt
,width
, andheight
attributes by default. If you don’t need to set image dimensions (e.g. if you usewidth: 100%
in your CSS), you can ‘turn off’ the effect of thewidth
andheight
attributes by usingwidth="0" height="0"
.
It’s the little things representing common, real-world scenarios that make surgically complete documentation great documentation.
Perhaps if we followed up with tweaking docs as much as we say the same things learned over and over again in the forum, the docs would be 100x better than they are.
I think the examples on tag docs are the weakest parts, in most cases; probably pulled out of the air years ago in the wiki and nobody has bothered to improve them since. I can’t remember in all my years of using Textpattern of actually using any of the examples as written; not without interpretation in some way. Little is useful as is. I realize you can’t anticipate every real scenario, but at least we can make the ones we provide a bit more actual.
Examples are best when they are not hypothetical, but reflect real situations — commonly repeated situations. The more reflective of common needs they are, the better they are as documentation. Hypothetical leaves a lot to be misconstrued. Maybe the problem, on reflection, is that the examples in docs provide no context, or not very good context, anyway.
So, all you new arrivals to the community, and I’ve noticed a lot lately since passing through a few months ago, please don’t do what we old-timers have settled into (forum sloths). Now we have these nice new docs on GitHub, improve them anywhere you find a need or opportunity to do so. In my experience and observation, the best way is to recognize a factoid that comes up repeatedly in the forum but is never transferred to the docs… Transfer it, by whatever means!
<txp:loving_rant status="over" />
Humble bows to you patient accommodaters.
Old man out!
Offline
Re: img alt text using txp tags?
Hey old man,
Destry wrote #307557:
Now we have these nice new docs on GitHub..
you are not the only one whose marbles are failing him… Where in github?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: img alt text using txp tags?
Docs updated, thanks man.
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
Offline
Re: img alt text using txp tags?
sacrosanct:
I think the examples on tag docs are the weakest parts, in most cases; probably pulled out of the air years ago in the wiki and nobody has bothered to improve them since. I can’t remember in all my years of using Textpattern of actually using any of the examples as written; not without interpretation in some way. Little is useful as is. I realize you can’t anticipate every real scenario, but at least we can make the ones we provide a bit more actual.
…. texted postive
Offline
Re: img alt text using txp tags?
colak wrote #307560:
Where in github?
Bloke gave a local link. But it’s also that link in the global nav of Txp real estate — “Documentation”. Phil has it all Dr. Jekyll-ed up, and using a custom domain name, so the combined effect does kind of hide the GitHub feel.
The key thing for everybody to notice is that on every docs page there is a link at the very bottom that provides a means for reporting or contributing their 2 cents worth of love in context of the page.
Offline
Re: img alt text using txp tags?
I’ve improved a few examples in various tag docs as I rewrote the pages for Jekyll. I can only do so much though, so if people want to add new examples then feel free. Either post them in the forum or (better) add them on GitHub as a pull request.
All you need to do for the latter is:
- Log into GitHub in your browser.
- Go to the docs repo.
- Find the tag page you want to add an example too, tag docs are within the tags directory and all labelled logically.
- Click the ‘Edit this file’ button (it’s a little pen symbol)
- Write new stuff in Markdown syntax.
- Press the ‘commit changes’ button when finished – that’ll create a pull request that I can then review and if OK add to the doc page.
- Jekyll rebuilds automatically and the page is then live for everyone to see.
Offline
Re: img alt text using txp tags?
Do you think that it would be a good idea to have some example on how the tags are parsed? The <txp:image_info type="ext" />
tag for example, is parsed with the dot. (ie .jpg
) If you think that it is a good idea I could slowly start adding those wherever relevant.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: img alt text using txp tags?
colak wrote #307566:
Do you think that it would be a good idea to have some example on how the tags are parsed? The
<txp:image_info type="ext" />
tag for example, is parsed with the dot. If you think that it is a good idea I could slowly start adding those.
Sure – the more examples the better IMHO.
Offline
Re: img alt text using txp tags?
philwareham wrote #307565:
I’ve improved a few examples in various tag docs as I rewrote the pages for Jekyll. I can only do so much though, so if people want to add new examples then feel free. Either post them in the forum or (better) add them on GitHub as a pull request.
All you need to do for the latter is:
- Log into GitHub in your browser.
- Go to the docs repo.
- Find the tag page you want to add an example too, tag docs are within the tags directory and all labelled logically.
- Click the ‘Edit this file’ button (it’s a little pen symbol)
- Write new stuff in Markdown syntax.
- Press the ‘commit changes’ button when finished – that’ll create a pull request that I can then review and if OK add to the doc page.
- Jekyll rebuilds automatically and the page is then live for everyone to see.
Thanks Phil, is that sticked somewhere? It sounds pretty useful.
Offline