FANDOM


  • Hey there, not sure if this is a getting started (i feel like i still am) or a more technical request. I have searched, but possibly not with the right terms as i can't find anything relevent.

    I have a bunch of cards listed each on their own page with a unique number (i.e. dr001, dr002 etc).

    I'd love to have a next record and previous record link as part of my template, but i can't really see any way of achieving it.

    I have the card name available as a parameter (dr001) which i could change to 001 if there is any way of applying maths to a variable?

    All i can think of, is to add explicit next and previous fields to my templates. But then i have 600 records to update and it just seems like something i may be able to do more cleverly?!

    Thanks in advance, Matt

      Loading editor
    • Could you link to your pages? What are the actual page names?

        Loading editor
    • You're talking about this wiki, right? You can do navigation like that using Lua. JoTS wrote something similar for navigation between Undertale soundtracks on the Undertale Wiki.

        Loading editor
    • Andrewds1021 wrote:
      Could you link to your pages? What are the actual page names?


      of course, sorry! It's fairly simplistic, so you'll get an idea of the level i'm working at!!

      The default name is: http://devilsrun.wikia.com/wiki/DR001_Haul%27s_Angels_Bike but, i started adding http://devilsrun.wikia.com/wiki/DR001 as a redirect to the above.

      I'm not afraid of making sweeping changes to the naming if it lets me do something clever!

      Thanks

        Loading editor
    • KockaAdmiralac wrote:
      You're talking about this wiki, right? You can do navigation like that using Lua. JoTS wrote something similar for navigation between Undertale soundtracks on the Undertale Wiki.

      Thanks mate, that gives me a bunch of new stuff to read up on :)

        Loading editor
    • Or you could use DPL to search for the pages. Not sure which one is more server-friendly; the Lua perhaps?

        Loading editor
    • Lua is about as server-friendly as parser functions (or probably even better) and DPL is quite heavy on the server from what I know.

        Loading editor
    • Okay, that is what I suspected.

        Loading editor
    • You can do it with parser functions, though, if you make numbered redirects. Learning Lua is useful, if you plan to use it more, but it maybe overkill in this case.

        Loading editor
    • True, but then you need 2 pages for each.

        Loading editor
    • Parser functions are also treating wikitext as a programming language, which it isn't.

        Loading editor
    • I think I understand what you are getting at but I don't quite agree. The parser functions are more like function calls. In that sense, I don't see how it is much different than using Lua; which, by the way, still has to use a parser function to invoke the script.

        Loading editor
    • Lua requires quite a bit of extra infrastructure inside the script to do similar things. It's great for more complex things, but Prev/Next might be in the gray area of Lua being the better choice. Does anyone know if someone already wrote some Lua to do a similar thing? It's much easier to copy/modify than write it from scratch.

      Also, you have to make a template to invoke the Lua module, so it seems like more trouble than it's worth. However, if the OP decides to go the Lua route, it would be an excellent learning experience and something that could be repurposed and expanded more easily.

        Loading editor
    • Well, i was trying to avoid the more complex ways of doing it as im still somewhat of a noob.

      So, my solution was to add a "card_number" variable to the infobox.

      This has allowed me to use the "expr" parser function to generate the new links based upon current card number. The code below generates a link to a page using the current card_number + 1. This is put through the padleft command to ensure 3 digits are returned (otherwise, DR099 become DR99).

      [[DR{{padleft:{{#expr:{{{card_number}}}+1}}|3|0}}]]

      Thanks all for your help. Some of what you are saying makes more sense to me, though i'm some way off LUA at this stage! :)

      Cheers, Matt

        Loading editor
    • You did what I would have done.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message