Forum
Possible bucket issue (not reverting to default)
I recently changed a template to add a 'file download' link, with the file going into a bucket at /resources/downloads. The code is around one-third into the template. It looks like, since then, all the other assets in the template (below that code) are being added to the same bucket instead of to /resources. Does adding a bucket to a perch:content statement switch what will then be used as the default? Or is this a bug? Here's the template ...
<perch:if id="visible" value="yes" match="eq"><div class="news">
<perch:if exists="image"><img class="newsimage" src="<perch:content type="image" id="image" label="Image" width="170" height="170" crop="true" required="false" help="News Image (will be cropped to 170x170 px)" />" alt="" /></perch:if>
<h2><perch:content id="title" type="text" label="News Title" required="true" title="true" /></h2>
<div class="newsitem"><perch:content id="newsitem" type="textarea" label="News Text" required="true" textile="true" editor="markitup" size="m" />
<p><a href="<perch:content id="file" type="file" label="File (for download)" required="false" bucket="downloads" divider-before="Optional Downloadable File" />"><perch:content type="text" id="desc" label="File Description/Title" required="false" title="true" divider-after="Optional Extra Images" /></a></p></div>
<div class="newsimages">
<perch:if exists="image2"><img class="newsimage2" src="<perch:content id="image2" type="image" width="200" label="Optional Image 2" help="Maximum width 200px for this image"/>" alt="" /></perch:if><perch:if exists="image3"><img class="newsimage3" src="<perch:content id="image3" type="image" width="200" label="Optional Image 3" help="Maximum width 200px for this image"/>" alt="" /></perch:if><perch:if exists="image4"><img class="newsimage4" src="<perch:content id="image4" type="image" width="200" label="Optional Image 4" help="Maximum width 200px for this image"/>" alt="" /></perch:if><perch:if exists="image5"><img class="newsimage5" src="<perch:content id="image5" type="image" width="200" label="Optional Image 5" help="Maximum width 200px for this image"/>" alt="" /></perch:if>
<perch:content id="visible" type="checkbox" label="Visible?" value="yes" suppress="true" title="true" divider-before="Make this News Item visible?" />
<br class="clear" /></div></div></perch:if>
Are you invoking the first instance first?
Not sure I understand, so ... The first image (the id of 'image') is optional. So, if its not used, the download file/link/bucket (id of 'file') might be the first one used. Then there are optional ids of image2/image3/image4/image5. The above template is a repeating region (if this matters).
Does the default bucket only change if the first time is clicked on, or is it always the case?
I've done a couple of tests and can't recreate what my customer seems to have done. I've tried loading 'image', then 'file', then 'image2'. Cleared up and deleted everything. Then tried ignoring 'image' and just loading 'file' and 'image2'. Everything went to the right buckets when I did it. I therefore think it may be a customer operating error of some sort as I can't actually see how they created the news item(s) and the process they went through. I did see a usability issue though, they 'may' contribute to what they've done ...
1) Click on the link to load the first image. The Assets panel shows the default bucket. I then upload and select the image.
2) Click on the link to load the file. The Assets panel shows the download bucket. I then upload the file and select it.
3) Click on the link to load image2. The Assets panel shows the download bucket again (and not the default bucket). I'm wondering if my customer is confused by this and then starts clicking filters in the Assets panel and somehow loads images to the wrong place.
Is there a parameter of bucket="default" (like bucket="downloads") that I can use to force use of the right bucket for the later images in the template, rather than not having a bucket= and relying on the default bucket being displayed by the Assets panel?
You can set the default bucket that way, yes.
We'll take a look at it and see if we can make any sense of it.