Difference between revisions of "Issue:Category:New format symbols: %PREV% and %NEXT%"

From FollowTheScore
Jump to: navigation, search
Line 21: Line 21:
 
== Reply 2 ==
 
== Reply 2 ==
  
Try the following code:
+
You can find an example in [[DPL Example 013]]
  
<pre><nowiki>
+
[[User:Gero|Gero]] 15:27, 9 May 2009 (UTC)
{{#vardefine:count|10}}
 
{{#dpl:
 
|namespace=
 
|titlematch=C%
 
|count={{#var:count}}
 
|offset={{{offset|0}}}
 
|resultsfooter=
 
  ²{#ifexpr:%TOTALPAGES% > {{#var:count}}¦
 
\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
 
  {{#ifexpr:{{{offset|0}}} > 0|
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..{{{offset}}}]] &nbsp;
 
  }}
 
  '''{{#expr:{{{offset|0}}} + 1}}..{{#expr:{{{offset|0}}} + {{#var:count}}}}''' &nbsp;
 
  ²{#ifexpr:%TOTALPAGES% - {{#var:count}} > {{{offset|0}}}¦
 
    ²{#ifexpr:%TOTALPAGES% - 2 * {{#var:count}} <= {{{offset|0}}}¦
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..%TOTALPAGES%]]¦
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..{{#expr:{{{offset|0}}} + 2 * {{#var:count}}}}]]
 
    }²
 
  }²
 
  &nbsp; [[:Zzz2|reset]] &nbsp; &nbsp; (total %TOTALPAGES%)
 
  }²
 
|noresultsfooter=no more results<br/>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
 
  ²{#ifexpr:{{{offset|0}}} > 0¦
 
  [[Special:Call/:Zzz2,offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..%TOTALPAGES%]] &nbsp;}²
 
  &nbsp; [[:Zzz2|''reset'']]
 
}}
 
</nowiki></pre>
 
 
 
The code uses the variables extension and the Call extension and produces the following result:
 
 
 
{{#vardefine:count|10}}
 
{{#dpl:
 
|namespace=
 
|titlematch=C%
 
|count={{#var:count}}
 
|offset={{{offset|0}}}
 
|resultsfooter=
 
  ²{#ifexpr:%TOTALPAGES% > {{#var:count}}¦
 
\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
 
  {{#ifexpr:{{{offset|0}}} > 0|
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..{{{offset}}}]] &nbsp;
 
  }}
 
  '''{{#expr:{{{offset|0}}} + 1}}..{{#expr:{{{offset|0}}} + {{#var:count}}}}''' &nbsp;
 
  ²{#ifexpr:%TOTALPAGES% - {{#var:count}} > {{{offset|0}}}¦
 
    ²{#ifexpr:%TOTALPAGES% - 2 * {{#var:count}} <= {{{offset|0}}}¦
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..%TOTALPAGES%]]¦
 
    [[Special:Call/:Zzz2,offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..{{#expr:{{{offset|0}}} + 2 * {{#var:count}}}}]]
 
    }²
 
  }²
 
  &nbsp; [[:Zzz2|reset]] &nbsp; &nbsp; (total %TOTALPAGES%)
 
  }²
 
|noresultsfooter=no more results<br/>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
 
  ²{#ifexpr:{{{offset|0}}} > 0¦
 
  [[Special:Call/:Zzz2,offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..%TOTALPAGES%]] &nbsp;}²
 
  &nbsp; [[:Zzz2|''reset'']]
 
}}
 
 
 
[[User:Gero|Gero]] 15:19, 9 May 2009 (UTC)
 

Revision as of 17:27, 9 May 2009

Description: %PREV% returns "previous XX", %NEXT% returns "next XX"
Extension / Version: DPL   /   ?
Type / Status: Change Request   /   open

Problem

I absolutely fail setting up a template for navigating through a long result list. It would be very handy to just use %PREV% and %NEXT% in the resultsheader or resultsfooter. They sinply return "previous XX" and "next XX" and can be freely formatted by the user, e.g. to addapt the wiki style (previous 200) (next 200) or create an own style.
They are only linked if there is something to navigate to.

As long as you can't use %PAGES% or {{{%PAGES%}}} inside {{#ifexpr: or {{#expr: it's impossible to set up logical prev / next links, esp. since you may also want to use %PAGES% and %TOTALPAGES% together which is another bug.

Btw: Does a working template exists here as example? Didn't find any. Please let me now.


Reply

Ok I found out how to use %PAGES% or %TOTALPAGES% in parser functions, still an easy %PREV% and %NEXT% may be good. Feel free to close this issue. --Subfader 11:18, 9 May 2009 (UTC)

Reply 2

You can find an example in DPL Example 013

Gero 15:27, 9 May 2009 (UTC)