Hi Everyone,
I need to set up an asset builder/s so that user can create a news item then create an image, as a child of that news item and set the child image as thumbnail on the parent news item (with out going to backend).
Thanks for any suggestions!
Karthik Poobalu
News asset, thumbnail created with asset builder
When you say without going into the backend do you mean the admin view? If that is the only view you don't want to show then Easy Edit would suit your needs although it is simple enough to make what you are after with Asset Builders.
How I would do it:
- Create an Asset Builder to create News Items and set the Create Locations as needed (i.e. fixed, dynamic etc)
- Create an Asset Builder to create Images and:
- on the Details screen ensure Form Submission URL is set to "This page's own URL"
- on the Details screen make Set Link Value equal to something like 'thumbnail'
- set its Create Location under Additional Create Locations to use a GET variable (for example 'newsid')
- choose the Default Link Type (probably TYPE_2 in this case)
- select the Permitted Tree Locations
- select the Permitted Asset Types which would be the News Item asset in this scenario
- On the Created Bodycopy for the News Item Asset Builder create a Nested DIV and nest the Image Asset Builder
- Add a new variable to the nested DIV with the Variable Name as 'newsid' (or whatever you called it) and the Variable Value as %created_assetid%
Then you can create an Asset Listing to display the New Item assets and on the format bodycopy nest another Asset Listing which takes the current asset as a root node replacement and only displays Image asset that are Direct Links and have the Link Value of 'thumbnail'.
If you want the News Item asset to have the Thumbnail field set on the Details screen then that would be a bit tricky - see the discussion of that at http://forums.squizsuite.net/index.php?showtopic=11320
Thanks for that, I followed each steps but i got the following error (News item created fine, the error is for the image...)
The new asset was not created. Ensure you have entered all required information and try again.
- Undefined index: AB_112405_ASSET_BUILDER_CREATE_TYPE
- Create type is not allowed
I added the image asset type on " Additional Create Locations "-> "Permitted Asset Types" on both News asset builder and image news builder - but no luck !!
any suggestions!
- On the Created Bodycopy for the News Item Asset Builder create a Nested DIV and nest the Image Asset Builder
I would be careful with this because at least in older versions of Matrix this would put an HTML form inside of another form which would screw things up.
What I have always done is either used an iFrame for the image asset builder so that the user didn't have to go to another screen when they upload the image, or just create a link like %globals_asset_url:1234?newsid=%created_asset% to take me to the image builder with the newly created news ID.
poobalu - the Permitted Asset Types on the Image Asset Builder should be the asset type that you want to create the image under, so in your case it would be News Item.
We are on 4.10.2 currently so nesting on the Created Bodycopy doesn't put a form within a form but good point to keep in mind from Nic. Using the globals keyword like Nic showed was another solution that has worked too so maybe give that a try so you can see if the issue is with the nested content or the image Asset Builder.
Nic - you mention using an iFrame. Did you just load this with JS after the form submission? I like the idea of everything being on a single page to reduce clicking, page loads etc. Was an iFrame used to avoid the form within form issue - couldn't it be loaded and inserted after the existing <form> element?
Nic - Where do i creat this link? %globals_asset_url:1234?newsid=%created_asset% in news item builder or the image builder (and exactly where), Thanks Guys for helping me on this.
Nic - you mention using an iFrame. Did you just load this with JS after the form submission? I like the idea of everything being on a single page to reduce clicking, page loads etc. Was an iFrame used to avoid the form within form issue - couldn't it be loaded and inserted after the existing <form> element?
An iFrame was used to complete the image upload without having to leave the parent asset builders created screen. It is actually from a really old demo I built, but I still like the concept: http://forums.squizsuite.net/index.php?showtopic=6645
It isn't added using JS, it is just on the Created bodycopy and the extra GET string is added to the src of the iFrame.
Nic - Where do i creat this link? %globals_asset_url:1234?newsid=%created_asset% in news item builder or the image builder (and exactly where), Thanks Guys for helping me on this.
So, on your first Asset Builder that creates News Items, within the Created bodycopy, you will create a link to the second Asset Builder and pass along the newly created Asset ID.
So, put this in your Created bodycopy:
<a href="%globals_asset_url:1234%?newsid=%created_assetid%">Add an image</a>
Change 1234 to the asset ID of your Asset builder that creates the image. newsid is the GET var that you configured on the Create Locations screen.
So, when you click the link, you will be passing the ID of the newly created News Item, and it will be used as the create location for the image.
Let me know if you have additional questions.