Cross page

cross.tpl - display template by additional field.

Tag Description
[meta-title="News by {name}"]
Defines the title meta tag, in this case News by (name of additional field).
[meta-description="News by {name}"]
Defines the description meta tag, in this case News by (name of additional field).
{name}
Name of the additional field.
{abs}
Outputs the alphabet from the first letters of the additional field values.
[item]... one value ...[/item] A wrapper that outputs a single value from an additional field. See below what tags are included.
{item-letter}
Outputs the first letter of the value.
{item-name}
Outputs the value itself.
{item-link} Link to the news page for this value.
{count} Number of news with this value.

For example, there is an additional field Genre (field type: one line).
Select Create a page from an additional field in the settings additional field.

Here is a simple example file:

[meta-title="News on {name}"]
[meta-description="News on {name}"]
<h1>{name}</h1>
<ul class="abc">
     {abc}
</ul>
<ul class="cross-list">
     [item]<li data-l="{item-letter}"><a href="{item-link}">{item-name}</a><b>{count} </b></li>[/item]
</ul>
<script>
     $(document).on("click", ".abc a", function(){
         $(".active-letter").removeClass("active-letter");
         $(this).addClass("active-letter");
         let leter = $(this).text();
         $(".cross-list li").hide();
         $('[data-l="'+leter+'"]').show();
         return false;
     })
</script>
Loading...