Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: link_to_next not working
Wrapping your links inside txp:link_to_prev / txp:link_to_next would prevent them outputting anything if there is no link, avoiding the need for your variable test, but … unfortunately it won’t put your desired class name on the link, only a wrapping tag.
Two options spring to mind. Use the regular tags and change your css:
<nav class="portfolio__meta__nav">
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
<txp:link_to_next ><txp:next_title /></txp:link_to_next>
</nav>
and change in your css:
.portfolio__meta__prev { ---> .portfolio__meta__nav a[rel="prev"] {
.portfolio__meta__next { ---> .portfolio__meta__nav a[rel="next"] {
Or version 2, use txp:evaluate to test if a tag inside the container provides any output, e.g.
<nav class="portfolio__meta__nav">
<txp:evaluate test="link_to_prev">
<a href="<txp:link_to_prev />" title="<txp:prev_title />" class="portfolio__meta__prev"> <txp:prev_title /></a>
</txp:evaluate>
<txp:evaluate test="link_to_next">
<a href="<txp:link_to_next />" title="<txp:next_title />" class="portfolio__meta__next"><txp:next_title /> </a>
</txp:evaluate>
</nav>
Another tip – not relevant to the code snippets I posted here – but possibly a reason why you are getting gaps in your earlier code:
You can simplify your “if empty … else …”
<txp:if_variable name="myvar" value="">
<txp:else />
…
</txp:if_variable>
to this, so you have “if not empty …”:
<txp:if_variable name="myvar" value="" not>
…
</txp:if_variable>
PS: not means “the opposite of the if-expression you give it” (i.e. the else-case)
TXP Builders – finely-crafted code, design and txp
Offline
Re: link_to_next not working
jakob wrote #342106:
Or version 2, use txp:evaluate to test if a tag inside the container provides any output, e.g.
This is now working as desired!! So many thanks for all your insights.
Now on to the issue of outputting those 6 images along the bottom half!
PS I’ll try your other tips on my earlier code as well.
…. texted postive
Offline