Search

Hi,

how do I retrieve the attributes of a linked section when viewing an item.

I have two sections, articles and images. There is a link in the articles section to the images section which allows me to see images linked to an article. However the XML only shows id, handle, section-handle, section-name for the images and I need all all the attributes relating to the images such as location etc to actually make any use of it.

Can you please advice as to how I can pull this information into the XML so I display the linked items.

Thanks in advance for you help

PK

Have a look at data source output parameters or have a search for Subsection Manager.

thanks for the quick response however this does not seem to be the answer I am looking for.

My problem is the link is done on the article side so I am unable to filter a result of images using the current article id, as there is not attribute in the images section which can be paired to the article id.

Hi, if I understood correctly what you are after can be achieved with datasource chaining: You can have your article datasource to output image Ids as ds-parameter, then set up another datasource that will grab from the images section filtering by that parameter

Hi let me please clarify what I have and what I want to achieve.

What I have: 1. An articles section which is linked to other sections (images & videos). 2. The linking of images/videos is done on the article, so on the article create page there are fields for linking images and videos. There are no fields on the images and video sections for linking articles as the symphony data model only works one way. 3. I have a datasource which returns an article by the entry id. 4. In the data source i get the basic information about any linked images/videos (i.e id, handle, section handle, section name) and nothing else.

What I want 1. I want the attributes i created for the images/videos section to be available in the xml returned when I open the article

At the moment if i try to use the article's ID as the data source output parameter, it will be of no effect as the images/videos stores will have nothing to match that value against.

I cannot set the parameter to a list of images either, as it will mean I will not be able to retrieve videos.

I hope I have been able to clarify what I am looking for a bit more. If not please let me know what you need explained.

Thanks

The linking of images/videos is done on the article, so on the article create page there are fields for linking images and videos

if i try to use the article's ID as the data source output parameter, it will be of no effect as the images/videos stores will have nothing to match that value against

I don't understand. What field is this? How are you actually linking these sections together?

The usual setup would be to have an Articles section, and then in your Images and Videos sections, add a Select Box Link so that you choose an article when adding an image and video (one to many: one article, many images/videos).

You'd then have three data sources: the Articles data source returns information about the article and sends its System ID as the output parameter. Data sources for Images and Videos filter their article Select Box Link field by this output parameter, so that they return just the image/video entries attached to the selected article. This is known as data source chaining.

The key to this lies in how you're linking your sections together in the first place.

I am using the select box link, however the select box links are on the article section for usability reason. This way you can see what items are linked to the article when editing the article.

Yes realize that in order to get the chaining working, I will have to reverse how I am linking the sections, which will mean going back to edit all the images and videos and linking the article to them [painful]

Is there a possibility to have more than one parameters? that way, I can have one that returns the list of image IDs and another that returns video IDs.

There are three possible solutions (probably more):

  • Don't change your model, but create a second datasource with only the videos as the output parameter. This is the only way at the moment to use more than one output parameter.
  • As Nick said, move the Select Box Link into your assets sections and use datasource chaining with the article id.
  • As Nils said, use the Subsection Manager. This way, you have everything in your articles section and you automatically get the related entries from your assets sections.

Edit I just saw your post after writing my post. So it's probably option 1 or 3 for you.

I am using the select box link, however the select box links are on the article section

Aha! That makes more sense, and I understand your problem now. Yes, the solution would be to have multiple output parameters from a data source, however Symphony 2 doesn't allow this. As klaftertief says, you could duplicate your articles data source again and have a different output parameter — this is what most of us do in this situation.

Ultimately, the Subsection Manager is the most elegant solution as it solves two problems in one: usability and the UI for creating the entries, and the nesting of the data in a single data source.

Thank you all for your inputs.

I think I am going to go with the option of duplicating the data source.

Thanks

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details