Mediawiki cross-page data access - mediawiki

Perhaps I'm going a bit overboard here, but I'm looking for a way to access data on a page of my Mediawiki install (call it Page1) and use that data on a second page (call it Page2). I know I can simply transclude the data, but I'm looking (I think) for a little more than that.
Basically, I'd like to get the data from Page1 and parse it in such a way that I can make it display nicely on Page2.
For a more specific example: I use Lingo to process on my glossary page (called Glossary), but I don't like the way the glossary displays. Furthermore, I'd like to be able to add definitions willy nilly without having to worry about alphabetizing them.
My desire is to parse the data in Glossary, and then show it formatted and alphabetized (as desired) in a separate page.
I figure that I can always write an extension that does this for me, but does something like this already exist? Is this something that is included in Semantic Wiki?

Yes, you can do that in SemanticMediaWiki. For an example of an advanced terminology wiki based on SemanticMediaWiki, see http://tieteentermipankki.fi/
As for Lingo, its markup appears to be very simplistic: https://www.mediawiki.org/wiki/Extension:Lingo#Usage But it allows transclusion, so you can just define each term on its own page, then transclude all the pages in your Terminology page, then transclude them in a different way and wrapped in all the formatting you desire.
Or any variation of the concept, possibly using templates with Lua modules if you need advanced and/or repetitive formatting.

Related

Can I integrate grapejs website builder into my own website

Does anyone know if I can integrate GrapeJS into my own website so clients could build their own websites using it? IF anyone has done this, how easy is it and are there downsides?
This question is pretty open ended, but I'll take a shot at it.
The short answer is yes, you can use Grapesjs to allow clients to make their own sites; however, the details matter.
Grapesjs by default doesn't know anything about your stack, website structure, metadata, etc. You will need to either supply plugins or implement those features yourself. I've worked on a project for a company that used Grapesjs to implement single page apps and I'll include just some of the tweaks we had to manage.
Hiding certain layers that only confuse average users.
Hiding pretty much all of the styling, and using traits to allow people to pick from some predefined styles.
Take the html, css on store and generate the final html page, and store it in our static serving folder on the server.
Implement a wrapping "App" component that has traits for the different metadata we want users to control (open graph metadata, title, etc)
and those are just the big things, I'm sure I am forgetting several small ones.
For your application, you'll also need to implement a custom trait for links / buttons that allows you to link from one "page" to another. As well as, a way to allow a user to pick which page to work on.
The long answer is Yes, but Grapesjs is only the starting point.
Yes you can.
However it is not straightforward.
If you want to build a Drag Drop Editor like GrapeJS Demo, here is the Source Code - https://github.com/artf/grapesjs-preset-webpage
You can see an implementation at https://codegres.org/dragdrop

In HTML, is there a way to find out if a particular string is variable?

Let's say I'm looking at a webpage that has a title including the year, such as "StackOverflow 2016". Is there a way, by inspecting the page source, to find out is this string is variable (function automatically updates it every year), or if it is a hardcoded string?
HTML is for navigator and is the result of a php (or python, etc.) script, so no you can't. (But you can if it is powered by javascript)
There is no way, unless the web site has been specifically coded to make that possible.
I know of one website that does enable marking the variables in its output, but even then, this functionality is turned off for most page requests – it doesn't work unless you explicitly turn it on for that request.
Certainly, there is no standard way in html to notice this.
If it is a string variable it is inserted when the page gets created, so to tell if it's hard coded or not you would have to have access to the file which constructs the page - usually a template or a PHP file, etc.. So no, you can't tell if it was a variable or a plain text just from inspecting the source on the client's side.
With one word: No, you can't...
Different scenarios:
By looking at the HTML alone... no, there is no way. Unless, in your specific case, you refresh the page at NYE or something like that... which is silly.
In the HTML is processed on the server.. there is still no way you can know if it is a hardcoded string or a variable.
There might be a chance to see that by looking at front-end source code if the HTML is processed in the client-side of the app...
You have to undestand that the web page you see is often generated by code that resides on a server, potentially miles away from you. When you ask for a web page you get simply an HTML page, no more.
So, generally, all the methods that generates the data you see on the page cannot be seen client side. Try to imagine what could happen if, let's say, StackOverflow would give you the "power" to see the logic the exists behind web pages of the entire app. You could use these information to do a lot of damage or to steal informations or complex algoritms.
I've said generally because data on web page could be generated by javascript, a client side language that can be used to modify the DOM.
In this case you could see if your string is update by a function.
As far as I'm aware there would be no way to know this as the source you can see will be what is rendered. So there will be no way to know if this was added with php or js etc.

How to create light weight, fast and a clean web page

I frequently need to pop up the form html tags in lightbox so where should i store these form tags?
1. should i store tags in server and get via ajax fn() : web page looks very clean
2. or should i just write somewhere in webpage and get innerHTML tags by js fn() : web page looks lengthy.
Whether i am not very clear about the light weight & fast loading. Does it really matter if i choose to write the tags in webpage, what do you say ??
If I understood well, you have several forms which you want to display in a lightbox (jQuery?). If that's correct, I think it will be lighter to add a few lines to your code than making a query for retrieve them.
Think about having your forms at the end of your file (or in a separate file containing all the forms you want to display that you include in the main page). You could select them by using css selectors like
$('.form1').lightbox()
Sorry if this is not the answer you look for but I can't comment on the post.
Rules of optimization:
don't optimize
don't optimize (yet)
More specifically, I would say to go with the simplest method (inner html) then change it later if you identify a performance problem. HTML pages can be quite lengthy these days, check a twitter page for example, you'd be surprised...

Is there a simpler option to "nest" or embed content without using iFrames or JavaScript to generate content?

I've read some related articles (like making JavaScript generated content possible for search engines to index), but what I'd like to know, is there a simpler option to embed content from another site? Without the use of iFrames.
What I'd like to achieve in the end is to create some sort of repository for content and serve that to different sites/clients.
For instance (and this is pseudo-coded):
<dl><dt>Date of birth</dt><dd><span src="http://myserver.com/get.aspx?value=dob&userid=102" /></dd></dl>
where the span src is ofcourse not valid or working, but I'd like something similar. First, and foremost, it should be "codable" for non-technical users and second it should be indexable by search spiders.
Now the question: is there something for this?
EDIT:
The sites who need to "recieve" this data I keep aren't mine. Like I've said in a comment Facebook being the worst example I can choose but the principle remains: I'd like to create 1 source of information which you keep at my server and let other party's feed from this content so you'll only need to update some generic information only once.
Now the question: is there something for this?
Only using a server-side language like PHP, or using Server Side Includes.
The downside to these methods is that the rendering of your page becomes dependent on the remote page's availability and rendering speed. If the remote page goes down, so does yours.
Therefore, some kind of caching should be used when including 3rd party content from server side... And it gets complicated then, as well, so it doesn't match the simpler solution you are looking for.
I know iframes have their disadvantages, but if you can live with them, they are still the simplest way of doing this.
um... How simple are you looking for? I mean... In your example, if you change "SPAN" to "IFRAME" you'll have working code.
I think the real problem is how get it indexable by seach spiders, but that request basically translates to "How can my site get credit for other people's work --- with absolutely no effort on my part...."

In MediaWiki is there a way to force a group of pages to have a particular skin?

The reason I am keen to do this is that we have a wiki which works great, but I would like to store help pages for an internal application in the wiki and link to those pages direct from the app. Although we wouldn't have concerns with people seeing the non-article stuff (i.e. the help pages) when viewing the pages from the rest of the wiki, for it to be streamlined when viewed from the application I thought it would be ideal if I gave it a simplified skin which I would design.
I have already found out that URLs can have the useskin= added (e.g. as is done in the Preview Skin page within the User Preferences pages), but following the links will revert you to your normal chosen skin.
Is there perhaps some way to adjust the skin, so that all the links contain useskin=? (I think this might have issues, since you appear to need the full pagename for useskin to work (e.g. ..../w/index.php?title=blah....&useskin=cologneblue as opposed to the short URLs).
If this isn't a smart way to go, I could consider different approaches (I run the box the wiki is on and could create a distinct wiki perhaps, although there might be disadvantages to this, such as needing to combine the user tables and maybe this would still pick up the user's preferred skin unless I re-coded things).
Any sensible suggestions gratefully received! Let me know if there's any more info you might need or if I need to clarify any points about my objective.
[I did submit this on the MediaWiki.org Support Desk page, but it got no response... I hope my question isn't that bad!!]
You could put all your content in its own namespace, then set the skin for that namespace using this extension (I've used it, it works well enough):
http://www.mediawiki.org/wiki/Extension:SkinPerNamespace
If you don't want to lock them all into a single namespace, you can also use the SkinPerPage extension to mark the pages individually.
Why not change the default skin to the skin you want?