Search the FirstSpirit Knowledge Base
For our customer we want to create a possibility where editors can upload/select photos via a component and where the information about these photos can be sent to a secondary system as a xml file.
So we have created a table in FirstSpirit and called it photo_serie. Within this table we have added a column named photos which could contain multiple photos per row.
This can be achieved because we have created a form upon this table with a CMS_INPUT_CONTENTAREALIST (named st_photo_serie) which we have mapped (in the mapping) to the specified column (photos). The CMS_INPUT_CONTENTAREALIST is based upon a template named pictures which again has several components (CMS_INPUT_PICTURE, CMS_INPUT_TEXT for additional info, width, height, acknowledgement info, etc.)
We have created a datasource with the same name (photo_serie).
After this we created a datasource in which we defined a CMS_HEADER in the jsp (HTML) tab with a contentSelect function (and a query referring to the given table):
<CMS_FUNCTION name="contentSelect" resultname="photo_serie_rs">
<CMS_PARAM name="schema" value="dbschema" />
<QUERY entityType="photo_serie"></QUERY>
</CMS_FUNCTION>
Below the CMS_HEADER we are now trying to define our XML. However when trying to loop through the items no result is being displayed:
<photo_list>
<photo_item>
$CMS_FOR(single_photo_serie, photo_serie_rs)$
$CMS_IF(!single_photo_serie.photos.isEmpty)$ //this still works
<photo_info>
//We have tried several options to get information out of this 'object', but up to now with no luck
//What should be set here to get the information of one specific photo in the set as defined in the pictures template
//together with the UID of the specific photo in the mediastore AND the URL of this media (in the same way the navigation fuction
//builds these URL's).
</photo_info>
$CMS_END_IF$
$COMS_END_FOR$
</photo_item>
</photo_list>
First of all I would like to know if the whole setup is the right way to go (if not, please advise how this should be set up) and second if it is the right way to go, then I would to see an example which runs through the items stored in each specific column with the CONTENTAREALIST and get information of the several items (photos) in the set.
Sorry community members for the late response. But I would like to share a possible answer which we implemented for our customer.
1.) First we created a template (section template) which can be used to upload a picture (lets call it photo_for_serie):
<CMS_MODULE>
<CMS_INPUT_TEXT name="st_title" allowEmpty="no" hFill="no" singleLine="no" useLanguages="yes">
<LANGINFOS>
<LANGINFO lang="*" label="Image title"/>
</LANGINFOS>
</CMS_INPUT_TEXT>
<CMS_INPUT_PICTURE name="st_image" allowEmpty="no" hFill="no" imagePreview="yes" lean="mandatory" upload="yes" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Image"/>
</LANGINFOS>
<PROJECTS>
<LOCAL name="."/>
</PROJECTS>
</CMS_INPUT_PICTURE>
</CMS_MODULE>
Then we have created a table (it has to be stored in the database) which has a column of the type xml. Based on this table
we have created a second template (Database schemes lets call it photo_series) in which we defined a content arealist which again is based on our previously created template:
<CMS_MODULE>
<CMS_INPUT_CONTENTAREALIST name="db_photo_images" allowEmpty="no" rows="5">
<LANGINFOS>
<LANGINFO lang="*" label="Photo Images"/>
</LANGINFOS>
<SOURCES>
<TEMPLATE name="photo_for_serie"/>
</SOURCES>
</CMS_INPUT_CONTENTAREALIST>
</CMS_MODULE>
In this same template we defined the jsp tab in which we loop over the photos:
<div id="fotoserie" >
<ul>
$CMS_FOR(foto,#row.foto)$
<li>
<div class="foto-container">
$CMS_VALUE(foto)$
</div>
</li>
$CMS_END_FOR$
</ul>
</div>
Eventually we didn't need the xml, but with this same example you can easily create an xml of the output.
I hope this is usefull for the community.
Best regards,
Nando
Hello,
could you solve your problem by your own? If not please post the GOM of the input components you described above. If yes it would be very kind of you to post the solution of your problem here, so that other community members can see the solution.
Best regards
Rene
Sorry community members for the late response. But I would like to share a possible answer which we implemented for our customer.
1.) First we created a template (section template) which can be used to upload a picture (lets call it photo_for_serie):
<CMS_MODULE>
<CMS_INPUT_TEXT name="st_title" allowEmpty="no" hFill="no" singleLine="no" useLanguages="yes">
<LANGINFOS>
<LANGINFO lang="*" label="Image title"/>
</LANGINFOS>
</CMS_INPUT_TEXT>
<CMS_INPUT_PICTURE name="st_image" allowEmpty="no" hFill="no" imagePreview="yes" lean="mandatory" upload="yes" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Image"/>
</LANGINFOS>
<PROJECTS>
<LOCAL name="."/>
</PROJECTS>
</CMS_INPUT_PICTURE>
</CMS_MODULE>
Then we have created a table (it has to be stored in the database) which has a column of the type xml. Based on this table
we have created a second template (Database schemes lets call it photo_series) in which we defined a content arealist which again is based on our previously created template:
<CMS_MODULE>
<CMS_INPUT_CONTENTAREALIST name="db_photo_images" allowEmpty="no" rows="5">
<LANGINFOS>
<LANGINFO lang="*" label="Photo Images"/>
</LANGINFOS>
<SOURCES>
<TEMPLATE name="photo_for_serie"/>
</SOURCES>
</CMS_INPUT_CONTENTAREALIST>
</CMS_MODULE>
In this same template we defined the jsp tab in which we loop over the photos:
<div id="fotoserie" >
<ul>
$CMS_FOR(foto,#row.foto)$
<li>
<div class="foto-container">
$CMS_VALUE(foto)$
</div>
</li>
$CMS_END_FOR$
</ul>
</div>
Eventually we didn't need the xml, but with this same example you can easily create an xml of the output.
I hope this is usefull for the community.
Best regards,
Nando