problem with the placeholder in the webservice list plugin?

samani

Member
hi
when i using webservice according this tutorial , in the section that Rob say how to use placeholder (he say use {foo } ) , it's not work . i must use simple KEY without {} and it's work without that correctly.
but my problem: i want do anything to create the title as a link. in the tutorial Rob use two KEY in " FROM " field in the "Data map" , the server get error 500 and i can only one KEY.
how i can use 2 KEY such as "title" and "url" together? in the tutorial he use this syntax but not work in now:
<a href="{url}">{title}</a>
 
Unfortunately, I don't have a test case set up for this, and don't really have an example service in mind to test it with. I've never actually used this plugin.

So I'd probably have to recreate your setup, and use whatever service it is you are using, and duplicate your settings.

I tried to login to the backend of your site, but there's an htaccess prompt I don't have the credentials for. Can you update My Sites, with whatever details I'll need.

-- hugh
 
OK, I think the problem is more fundamental.

The web service plugin is expecting the data to be structured in a strictly hierarchical fashion, for example ...

Code:
events:
     event:
        name:
        date:
    event:
        name:
        date:

... where the 'startpoint' would be "events", and your map would be for name and date.

But yours is more like this:

Code:
event:
    name:
    date:
    modules:
        module:
            id:
            name:
            url:
         module:
             id:
             name:
             url:
event:
    name:
    date:
    modules:
        module:
            id:
            name:
            url:
         module:
             id:
             name:
             url:

... and you are trying to get the data from those nested modules, which are inside multiple parents.

In order for this to work, you structure would have to be just ...

Code:
    modules:
        module:
            id:
            name:
            url:
         module:
             id:
             name:
             url:

... with a startpoint of 'modules'.

So ... either you have to change how your webservice returns the data, or I'll have to work out some syntax to allow you to specify that the data you want is repeated inside multiple startpoints.

-- hugh
 
at the first thank you for check this.
please forget url, nested moduls or multiple parent.i want use two key in one field from one parent.how to use that?
in the tutorial the teacher of that, uses two key in one field.
 
look at the picture attached
in this pic you can use two Key in the "From" column .
and he use url Key as a link.
but when i can't use any other character, even when i use simple html tag with my Key , it's not loaded anything.
 

Attachments

  • 2017-08-20_11-33-01.jpg
    2017-08-20_11-33-01.jpg
    217.9 KB · Views: 17
Last edited:
I can't work on that, because the example I copied from your site, with the service as-is, just isn't working, and won't work trying to get the data from the nested 'modules'.



Sent from my HTC6545LVW using Tapatalk
 
OK, I set up a test using the Scrobble web service that Rob used in the original tutorial. I've fixed some issues in these two commit:

https://github.com/Fabrik/fabrik/commit/c70bbdc3588aa22843df782a130b3af7aee44c23
https://github.com/Fabrik/fabrik/commit/32cc80d7b61da6ba66db70ae782ccf83e6590ac9

... so if you do a full github update, it should now work.

Note that the fixes mean that the plugin now works as per the original tutorial, so you use {foo} placeholders in the "From" map. And multiple ones now work, so the ...

<a href="{utl}">{name}</a>

... now works.

Also note, if the 'from' field you want is itself part of an object with multiple elements, like the artists's name in the Scrobble data that looks like this ...

Code:
{
   "tracks":{
      "track":[
         {
            "name":"The Less I Know the Better",
            "duration":"0",
            "listeners":"274963",
            "mbid":"",
            "url":"https://www.last.fm/music/Tame+Impala/_/The+Less+I+Know+the+Better",
            "streamable":{
               "#text":"0",
               "fulltrack":"0"
            },
            "artist":{
               "name":"Tame Impala",
               "mbid":"63aa26c3-d59b-4da4-84ac-716b54f1ef4d",
               "url":"https://www.last.fm/music/Tame+Impala"
            },
            "image":[
               {
                  "#text":"https://lastfm-img2.akamaized.net/i/u/34s/af87aba641a04fa9836fbf72f08b95cc.png",
                  "size":"small"
               },
               {
                  "#text":"https://lastfm-img2.akamaized.net/i/u/64s/af87aba641a04fa9836fbf72f08b95cc.png",
                  "size":"medium"
               },
               {
                  "#text":"https://lastfm-img2.akamaized.net/i/u/174s/af87aba641a04fa9836fbf72f08b95cc.png",
                  "size":"large"
               },
               {
                  "#text":"https://lastfm-img2.akamaized.net/i/u/300x300/af87aba641a04fa9836fbf72f08b95cc.png",
                  "size":"extralarge"
               }
            ],
            "@attr":{
               "rank":"0"
            }
         }
}

... to get the artist name, you would use a dotted path in the placeholder, like ...

{artist.name}

-- hugh
 
However, note that this still won't fix the issue with the structure of your service date. The structure needs to be of the form ...

Code:
<thing>
    <sub-thing>
        <sub-sub-thing>
        <sub-sub-thing>
        <sub-sub-thing>
        <sub-sub-thing>

... not ...

Code:
<thing>
    <sub-thing>
        <sub-sub-thing>
        <sub-sub-thing>
    <sub-thing>
        <sub-sub-thing>
        <sub-sub-thing>

So your data, with the 'modules' within multiple "sub-thing" won't work.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top