Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-02-27 20:54:15

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Networking and visualisation?

While i am working on a music networking site for myself and a few friends i ask myself:

How can be different articles get networked in the most simple way, so actually each of them is creating/having it’s own individual network of other articles around it?
Say i have 1 journalist J1, he works for three different newspapers N1-N3.
Then i have a video director VD1, who has produced videos for two of those 3 newspaper’s sites N1+N3,
and had J1 write a script for a video of VD1 before,
and a 2nd journalist J2,
who doesn’t know J1, but VD2
and worked with VD1 and N2+N3,
so it would be logical for J2 to get to know J1
as well as logical for N2 to get in touch with VD1
as well as N1 to be interested in J2
and VD2 to work with J1 etc.

Now J1, J2, VD1, VD2 and N1, N2 and N3 have articles inTXP.

To find out about all the possible benefits between them
it could be super to be able to throw one article on top of another, which would lead to both have each other’s article IDs inserted in a custom field called “related”, for instance.

If then there’d be a visualization, like the one in the Firefox extension Disconnect for example, which should be able to display 1st level (direct connected), 2nd level (connected via one article in between) and more levels of networking around one article.

You know what i mean?

Can i throw one article onto another, just drag and drop, and perform an entry of each other’s article IDs into the each others custom field “related” and save (maybe upon confirmation)?

Is there a visualisation plugin for TXP to visualize relations/connections between articles?

Dreaming, you know?

Last edited by jayrope (2018-02-27 21:01:21)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2018-02-27 22:36:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Networking and visualisation?

This is an interesting problem. I know in the dim and distant past, jakob and I fashioned a site that did something similar (jakob did most of the work, I was mainly there for moral support and the odd bit of code) where seminars had tutors and locations and people subscribed to the courses, and we did exactly what you suggested: use custom fields to tie them together in a field called related.

(believe it or not, the harder part was actually allowing people to filter the data in a meaningful way and to explore the connections on the public site without going in circles).

Back then the assignments were done mostly by hand. In times since, adi_matrix was born. I see you’ve found it, but for the benefit of anyone who’s not used it before, it lets you set up a pre-packaged “group” of articles, on their own tab, in a giant grid. You can pull out articles from a section, or those matching a category and a tonne more criteria, then choose which custom fields to expose, in any order.

The upshot is that you can see at a glance on a single page all custom field values for many articles. That makes it a cinch to whip up and down the list and assign values that relate articles.

It’s not quite drag n drop, but it’s the best thing we have and with some ingenuity you can craft all manner of dedicated “views” into your data, sorted, filtered and exposed by any article parameters you like.

btw, this is also brilliant for limiting users to certain fields when writing articles: expose only the fields you want them to edit, and if the built-in access controls of adi_matrix aren’t granular enough you can use smd_user_manager to only give certain people access to each tab.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2018-02-28 09:56:24

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Networking and visualisation?

Once the relations are assigned, the construction is not that difficult, especially in 4.7. Create a recursive article form called related:

<txp:article_id />
<txp:if_custom_field name="related">
    <txp:variable name="exclude" value='<txp:if_variable name="exclude"><txp:variable name="exclude" />,</txp:if_variable><txp:variable name="related" />' />
    <txp:variable name="related" value='<txp:custom_field name="related" />' />
    <txp:article_custom id='<txp:custom_field name="related" />' exclude='<txp:variable name="exclude" />' form="related" wraptag="ul" break="li" />
</txp:if_custom_field>

and use it in an article this way:

<txp:variable name="related" value='<txp:article_id />' />
<txp:article_custom id='<txp:variable name="related" />' form="related" wraptag="ul" break="li" />

This should output a hierarchical tree of all articles related to the current one.

Offline

#4 2018-02-28 13:17:25

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: Networking and visualisation?

etc, thanx for the example code. I’m yet on 4.6.2, though…
If it works it also takes away the need for something like rah_replace.

and + Stef: I actually found a visualization based on js – visjs looks good and even with my intermediate skill level i could probably implement sthg. like this.

Now if there was a (probably javascript created) window in our TXP backend alone, which could list article just by title, and i could drop one title onto another to relate them, that would be awesome. I’ll eventually work on that.

Stef, is the site you two worked on still existing?


A hole turned upside down is a dome, when there’s also gravity.

Offline

#5 2018-03-02 08:33:44

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,615
Website

Re: Networking and visualisation?

jayrope wrote #309520:

Stef, is the site you two worked on still existing?

I’m not sure if Stef was referring to this site but if so that is long gone (the organisation doesn’t exist anymore either).

But I used exactly the same principle as I showed you in the other thread to relate speakers to presentations and vice versa using a custom script custom_field (almost identical to the sample on the other thread) to produce a multi-select of articles from a specific section coupled with bsmSelect to turn it into a drop-down from which you can pick multiple articles. IMO, that could work just as well as a pop-up and drag to insert.

@etc: and another nugget of yours to remember ;-) Thanks for your tips, Oleg.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2018-03-02 09:13:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Networking and visualisation?

Yep, that was the site I meant. Learnt a lot from that one.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2018-03-02 14:15:42

etc
Developer
Registered: 2010-11-11
Posts: 5,080
Website GitHub

Re: Networking and visualisation?

jayrope wrote #309520:

I actually found a visualization based on js – visjs looks good and even with my intermediate skill level i could probably implement sthg. like this.

Amazing tool, pity it is too heavy (1.5Mb) to be included in txp. I have played with it, this will produce an articles (with comma-separated related IDs in custom1 field) network:

<txp:article_custom>
  <txp:variable name="nodes" escape="trim">
    <txp:if_variable name="nodes"><txp:variable name="nodes" />,</txp:if_variable>
    {id: <txp:article_id />, label: '<txp:article_id />'}
  </txp:variable>
  <txp:if_custom_field name="custom1">
    <txp:variable name="edges" escape="trim">
      <txp:if_variable name="edges"><txp:variable name="edges" />,</txp:if_variable>
      <txp:etc_query data='<txp:custom_field name="custom1" />' markup="list" break=",">
        {{from: <txp:article_id />, to: {?}, arrows:'to'}}
      </txp:etc_query>
    </txp:variable>
  </txp:if_custom_field>
</txp:article_custom>

<div id="mynetwork" style="height: 600px"></div>
 <script type="text/javascript" src="../files/vis.js"></script>
<script type="text/javascript">
  // create an array with nodes
  var nodes = new vis.DataSet([<txp:variable name="nodes" />]);

  // create an array with edges
  var edges = new vis.DataSet([<txp:variable name="edges" />]);

  // create a network
  var container = document.getElementById('mynetwork');
  var data = {
    nodes: nodes,
    edges: edges
  };
  var options = {};
  var network = new vis.Network(container, data, options);
</script>

Offline

Board footer

Powered by FluxBB