Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2016-11-04 21:00:34

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

johnstephens wrote #302651:

If there’s a way to do that with the new txp:authors tag, cool! But that seems like too much work for the authors tag to do.

No, <txp:authors /> is not smart enough for this, but I’m sure CSS-minded people here can help you to do it with some combination of nth-child and before:|after: selectors.

Offline

#14 2016-11-04 23:26:43

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

etc wrote #302660:

No, <txp:authors /> is not smart enough for this, but I’m sure CSS-minded people here can help you to do it with some combination of nth-child and before:|after: selectors.

Sure, you can “hack” something together with CSS selectors, but that would be the wrong approach in that case. I mean, that would give some presentation-level , and and, that are absent in the source code. Some UA agents don’t read / use stylesheets, think googlebot.

I have, in some way, the same issue as John – that is how to combine the output the combination of two or more <txp:author /> in a way that makes some grammatical sense (in my case, just a comma separated list would do fine).

One way around is outputting that as an ordered list (<ol>), then play with some CSS to display things the way I want. That would satisfy one constrain: outputting the result of the query in a way that make sense to googlebot and other search tools. Screen readers that don’t use the CSS generated content will also see something sensical, VoiceOver and (recent) Jaws will see / hear the same as sighted users.

Like so:

<txp:if_custom_field name="authors"><txp:authors label="Authors: " labeltag="h5" wraptag="ul" break="li" name='<txp:custom_field name="authors" />'
    sort='<txp:etc_sort field="name" order=''<txp:custom_field name="authors" />'' />'
>
    <txp:author link="1" />
</txp:authors>
<txp:else />
<h5>Author: </h5>
<p><txp:author link="1" /></p>
</txp:if_custom_field>

Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#15 2016-11-05 10:34:21

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

Thanks, Philippe, but this sounds contradictory for me:

phiw13 wrote #302666:

Sure, you can “hack” something together with CSS selectors, but that would be the wrong approach in that case.

One way around is outputting that as an ordered list (<ol>), then play with some CSS to display things the way I want.

That’s exactly what I suggest. I consider the final and as purely presentational, it shouldn’t be in the code. What if we decide to output and last but not least instead, should Google reindex the page?

Offline

#16 2016-11-05 10:41:36

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

etc wrote #302673:

Thanks, Philippe, but this sounds contradictory for me:

That’s exactly what I suggest. I consider the final and as purely presentational, it shouldn’t be in the code. What if we decide to output and last but not least instead, should Google reindex the page?

good morning Oleg,

Ok, I’ve misunderstood you then, we are on the same wave I think.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#17 2016-11-05 13:56:12

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

etc wrote #302660:

[…] but I’m sure CSS-minded people here can help you to do it with some combination of nth-child and before:|after: selectors.

This (assuming an ol/@li@ combo) is all you need:

li { display: inline; }
li:not(:last-child)::after { content: ', '; }
li:nth-last-child(2)::after { content: ' and '; }

This works for a list of one or more authors.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#18 2016-11-05 16:50:58

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: mysql_fetch_array missing in Txp 4.6.x—How can I fix my template?

Nice! Another possibility

li { display: inline; }
li+li::before { content: ', '; }
li+li:last-child::before { content: ' and '; }

Offline

Board footer

Powered by FluxBB