Jump to content
  • 0

SMW questions and help


hishutup

Question

I created this template which is very much unfinished because I always wanted to give it a shot and I figured this may be a good time.

I don't know about you but this is very complex and my poor variable naming skills are really shining.

 

I want what you think. Is there a way to optimize some of the code. There are parts that can be broken off into other templates like the list thing. Now come to think of it, I think it should.

 

This should for any of the guides that are out there. If there is something specific that you want then I'll add it but right now my brain hurts because of this mess.

 

I'm not going to rip out code so that the template become more generic because I developed it for myself, I will add though. I can make another one if it desired

 

Soon to come:

My mod install procedure.

variable header tags.

Link to comment
Share on other sites

  • Answers 175
  • Created
  • Last Reply

Top Posters For This Question

Recommended Posts

  • 0

I'd respond but I have no idea what is happening.  ::):

Everytime I looked at those links they were different, sometimes I see a list of mods other times I see templates that I don't know what to make of.

 

This link looks promising. If that PriorityID is added to ONLY the mods that need to be sorted, then that would do what I was thinking. I really hope I didn't send you all on a wild goose chase, it was only a curiosity I was wondering about.

Link to comment
Share on other sites

  • 0

Yep, I understand that, but am curious as to how to incorporate a subproperty property within a query along with properties from another template. The links in my post above are to what I have so far (with scant assistance from this page)

 

Actually, querying properties among disparate templates is also something of interest, but that should be simpler I would guess.

Link to comment
Share on other sites

  • 0

You don't query templates, you query pages. I updated your query to remove the template call as it's not needed for the example. The OrderID is added to the display, the list is sorted on the OrderID, and order is set to descending so last installed mod is now shown first. Primary exercise is to show how it can be used to sort, though the OrderID is useless for us as a sorting key.

 

Your template was attempting to query for OrderID which is incorrect. That data is available from the primary query, just had to add it to list of properties you wanted. It's use after the first query is only visual if you choose to display it.

Link to comment
Share on other sites

  • 0

I take that back, OrderID is required to sort the install order.

 

I have also updated Template:CoreModOrderedList to use named args, and display OrderID if it is provided.

 

This page does not display the OrderID:

https://wiki.step-project.com/User:Stoppingby4now/OrderTest1

 

This page displays the OrderID:

https://wiki.step-project.com/User:Stoppingby4now/OrderTest2

Link to comment
Share on other sites

  • 0

OK so it was much simpler than I was making it out to be ...

 

... is this because I was basing my query off of the query using the template call, which in turn was only required because we were bringing in SourceURL from the multiple-instance template?

 

In other words, the distinction between subobject property and normal property does not require anything special as does using a property that is part of a multiple-instance template ... the latter requires a template call within the query, because the query must iterate through the MI-template to fetch that property value for each ModName instance ... ?

Link to comment
Share on other sites

  • 0

That just totally confused me.

 

First off, there are no multiple instance templates. This isn't a form.

 

You were attempting to query in the secondary template for OrderID which you will never get because it isn't associated with a Mod page. It is associated with all of the subobjects on the ModList page for the version of STEP you are querying, but the query doesn't pass that in (mainlabel=-). It is available to you in the primary query of the subojects by requesting it:

|?OrderId

A template format for a query is only necessary for one of two things (or both):

  1. Formatting results in a custom manner that isn't provided by SMW
  2. Chaining queries for additional information on related pages, as you can't place a query inside a query

As for querying of subobjects versus properties, they are mostly the same. All properties are tied to a Wiki page (not templates), so you are requesting pages that match the query conditions, and then proceed to ask for Properties that exist on those resultant pages. Subobjects are slightly different as they reference the page in which they are used, so it's a reverse mapping. When asking for mods in a STEP version, the query condition is the subobject-property "Version", which returns the sub-object, which is mapped to the ModList page, and since each suboject has a unique ID (random ID which we care nothing about), you get all subobjects back instead of the actual page. No template is required for either scenario to get at the data. The only time you need a template is for the 2 reasons above.


Instead of having the if parser function couldn't you do this or no...
{{#ask:[[Concept:ModsInSTEP]] [[Property:IsCore]]

No, that won't work because the data isn't in the suboject which is what is being queried. The purpose of the subobjects for the STEP installation order is to record the Mod and it's order. Any additional information can then be queried from the Mod page itself using a template format. It is also always better to use {{#show}} when needing access to a single property in downstream queries.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.