Get options from database
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 22, 2011 (RSS)
By mediaco - November 22, 2011
I have a University site using CMSB.
In the CMS there are a list of courses, table named COURSES.
There is a separate table named VIDEOS that contains a name and an uploaded FLV "video_file".
In COURSES, I want to allow the CMS user to select an item from VIDEOS via a pull down list.
I can do this by selecting 'Get options from database (advanced)'. But i am only then given the name.
Ideally I would like to output the name, urlPath and thumbNail details of the relevant upload.
Can this be done?
In the CMS there are a list of courses, table named COURSES.
There is a separate table named VIDEOS that contains a name and an uploaded FLV "video_file".
In COURSES, I want to allow the CMS user to select an item from VIDEOS via a pull down list.
I can do this by selecting 'Get options from database (advanced)'. But i am only then given the name.
Ideally I would like to output the name, urlPath and thumbNail details of the relevant upload.
Can this be done?
Re: [mediaco] Get options from database
By Jason - November 22, 2011
Hi,
The reason you're only getting the name as an option is that all upload information is actually stored in a separate uploads table. Also, when choosing options, only the value you select for "option value" will be stored in the database.
Probably the best approach would be to use the "num" field from videos as your option value for your drop down in courses. Then, when you are outputting your courses, you can do a second query to the videos table to get the related video record. If you use getRecords() to do this, CMS Builder will automatically append the upload information to the video record.
Hope this helps get you started.
The reason you're only getting the name as an option is that all upload information is actually stored in a separate uploads table. Also, when choosing options, only the value you select for "option value" will be stored in the database.
Probably the best approach would be to use the "num" field from videos as your option value for your drop down in courses. Then, when you are outputting your courses, you can do a second query to the videos table to get the related video record. If you use getRecords() to do this, CMS Builder will automatically append the upload information to the video record.
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/