Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted May 21, 201410 yr We have #show_forums#, #show_applications#, and #show_groups#, what about having #show_download_cats# and #show_download_files# as an optional use when creating settings. I'm not going to do a custom file for it at this time but would love to see it in a future update. For now I'll use a manual setting.
May 21, 201410 yr This is no longer relevant in 4. You can't just insert a tag like this in a configuration panel in the ACP because settings do not work the same way. When adding a setting you have to build the form helper directly, during which time you have to specify any options available. Showing all files isn't realistic (we have thousands for instance...it could crash the browser trying to load all that data). Showing categories is possible in 4.0 through the node helper class. $form->add( new IPSHelpersFormNode( 'category', isset( $category ) ? $category : NULL, TRUE, array( 'url' => IPSHttpUrl::internal( 'app=downloads&module=downloads&controller=submit', 'front', 'downloads_submit' ), 'class' => 'IPSdownloadsCategory', 'permissionCheck' => 'add', ) ) );
May 27, 201410 yr Author The reason I need something like that is I'm building an app for someone that will list only 3 downloads they have available which they can access from any page on the site. If I can use that same code but grab downloads then great, if not, any suggestions? If I have to create a custom script to use in the setting to grab them no biggie, just trying to save some time.
May 27, 201410 yr Well you can certainly do this manually. As I said you don't just configure a few fields in the ACP to add a new setting in 4.0, you have to actually add the form helper code in a PHP file now. So when you do that, there's no reason you can't build the options for a select list from a database result set. foreach( IPSDb::i()->select( '*', 'downloads_files' ) as $file ) { $options[] = array( $file['file_id'] => $file['file_name'] ); } $form->add( new IPSHelpersFormSelect( 'files',NULL, TRUE, array( 'options' => $options ) ) ); (That code is just free-handed here as an example and may not be exact but you get the idea)
Archived
This topic is now archived and is closed to further replies.