Subtitles (subheads) for long articles: splitting up into smaller chunks
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    How can I split a long article into smaller chunks? And then provide pagination of subheads at the bottom of the article?

    http://en.flossmanuals.net/newscoop-3-cookbook-3-5-2/subtitle/

    I only found this without any examples. I know that this has not been used much in the past, but it is a feature that more and more online magazines and newspapers use. Can anybody supply me with some code samples?
  • 3 Comments sorted by
  • Splitting is done inside editor using 'subhead' option, and in templates this might work

    {{ if $gimme->article->subtitles_count(full_text) gt 1 }}

                <ul class="pagination">
                {{ list_subtitles field_name="full_text" }}
    {{ if $gimme->current_list->at_beginning }}
    {{ if $gimme->article->full_text->has_previous_subtitles }}
        <li class="prev"><a href="{{ url options="previous_subtitle full_text" }}">Previous</a></li>
    {{ /if }}
    {{ /if }}

    <li{{ if ($gimme->article->current_subtitle_no(full_text)+1) == $gimme->current_list->index }} class="selected"{{ /if }}><a href="{{ url }}" title="{{ $gimme->subtitle->name }}">{{ $gimme->current_list->index }}</a></li>

    {{ if $gimme->current_list->at_end }}
    {{ if $gimme->article->full_text->has_next_subtitles }}
        <li class="next"><a href="{{ url options="next_subtitle full_text" }}">Next</a></li>
    {{ /if }}
    {{ /if }}

                {{ /list_subtitles }}
                </ul>

    {{ /if }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    Thanks Ljuba, you rock (as always).

    I remember there was something about "with articlefieldname" in the code so that Newscoop would know for which article field in the article type it is looking for the splitting with subheads.

    And then you could list all of the subheads and have links to them.

    Do you have code for that, too?

    (btw.: when did you take that profile picture of yourself?)
  • 'with' thing is changed now with

    {{ list_subtitles field_name="full_text" }}

    You can create bulleted list of subtitles with links like this

    <li><a
    href="{{ url }}">{{ $gimme->subtitle->name }}</a></li>


    (this should go inside list_subtitles from previous example)

    ps. pic.. is little bit older :) from the beardless times...
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric