Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Building a website with an academic bibliography, I'm using related pages to show if an article is reprinted in one of the author's full-length books or collections.

While k_total_records does give the right number, I can't seem to find a variable that (used inside the related pages loop) indicates the current count #. The cms:pages pagination variable k_current_page seems to output the same number for each of the records.

The point is checking where some bits of text are to be outputted in between the titles of each of the related pages, and a full stop at the end (not yet in the below code).
This article is reprinted in *book title* and in *book title*.

Code: Select all
<!-- this article is included in one or more books -->
<span>Reprinted in</span>
<cms:related_pages 'contained_in_book' >
      <a href="<cms:show k_page_link/>"> <em><cms:show k_page_title /></em></a>
      <cms:if k_total_records gt k_current_page > and in</cms:if>
</cms:related_pages>


If there's an easier way to do this, please point me in that direction instead!


Edit:
On a related note, I was wondering if anyone knows about the existence of code or plugins designed specifically for outputting literature citations in different prescribed forms (Chicago style, etc.) from separate fields of database content. I imagine there must be more uses for that.
Thijs wrote: Edit:
On a related note, I was wondering if anyone knows about the existence of code or plugins designed specifically for outputting literature citations in different prescribed forms (Chicago style, etc.) from separate fields of database content. I imagine there must be more uses for that.


Using a Citation Style Language (CSL) configuration file? Never knew that there are over 2k styles in here https://github.com/citation-style-language/styles
@Thijs, please put a <cms:dump /> tag within the <cms:related_pages> block - it will show you all the variables that are available. I think you should find one that would help in your use-case.

Hope this helps.
KK wrote: @Thijs, please put a <cms:dump /> tag within the <cms:related_pages> block - it will show you all the variables that are available. I think you should find one that would help in your use-case.

Hope this helps.


Yes, that helps. I keep forgetting these debugging tags exist. Is there any place where they are collected in the documentation?

Many thanks for the other link to citationstyles.org, that's what I was looking for. Will have to devote some study to it.


FYI (or for others who find this thread at some point), the variable I needed was k_current_record.

Thijs wrote: While k_total_records does give the right number, I can't seem to find a variable that (used inside the related pages loop) indicates the current count #. The cms:pages pagination variable k_current_page seems to output the same number for each of the records.


I suppose that k_current_page is related to the currently displayed page, and is unaffected by the related_pages loop.
Thijs wrote: Many thanks for the other link to citationstyles.org, that's what I was looking for. Will have to devote some study to it.


That website does provide interesting links to software, plugins etc. After briefly inspecting one php-based plugin I found it quite extensive. It's a large field to research :) It will not be available for Couch any time soon, but you can find the pieces of markup that you need and wrap them in a <cms:func> (or even a new tag). Look at Reusable Functions in CouchCMS (tutorial) Can save you quite some time ultimately.
5 posts Page 1 of 1