Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 15, 20168 yr Hey all, I am building a main page that fetches data (news) from my forum, and I would like to be able to add a sort of 'forum image' database column, and a way to upload a file that I could fetch with my posts from the database. What I mean by this is if I have several forums, one called 'general discussion', one called 'suggestions', one called 'support' I would like to be able to upload an image for each type of forum, so that way on the main page, users will be able to easily distinguish between the content of each story/post. Also of course for a more aesthetic layout.
December 15, 20168 yr This is available: But it uses font-awesome instead of uploaded images. Alternatively you can hook into the forum ACP controller classes to add the form field to upload the image, and then adjust the front end templates to display it.
December 15, 20168 yr Author This is not what i am trying to do. I want to upload a full resolution image for a forum, not to display it on the forum page, but to display it on an external site with i fetch posts from that particular forum.. for example: https://gyazo.com/bcaef283e4ef9b55594977e55b1f819e
December 16, 20168 yr From what you tried to explain, the pages or blogs application could may fit a lot better your needs. The image you showed is a template of a blog... If I understood you correctly there 3 options: As @bfarber mentioned, you can write a hook, which is the most comfortable and "best practice" solution You can write raw html into the forum post, adding a hidden tag with an id and include the forum image can be queried from the fetch You use the api and determine on your external page the forum id and set based on that the image, if you always want to show the same image per forum. Greetings
December 16, 20168 yr Author On 12/15/2016 at 8:23 AM, bfarber said: This is available: But it uses font-awesome instead of uploaded images. Alternatively you can hook into the forum ACP controller classes to add the form field to upload the image, and then adjust the front end templates to display it. Is there a tutorial on how to add a file upload to when creating the forum? I think that would be somewhat complex to handle moving that file to a proper location / storing it, associating it to that forum, etc
December 19, 20168 yr Adding the file upload field will require writing a plugin. Actually moving the file won't be hard because the form helper will do it all for you. Most likely the plugin will need to add the form helper field, then assign the value to the forum active record object. // Adding the form field will look similar to the following // In an ideal world you would create a new file storage extension for this, but if you are just throwing together something for your own site you can probably get away with reusing one, such as core_Theme $form->add( new \IPS\Helpers\Form\Upload( 'forum_icon', NULL, TRUE, array( 'image' => TRUE, 'minimize' => FALSE, 'maxFileSize' => NULL, 'storageExtension' => 'core_Theme' ) ) ); // Then when processing the values you would do something like $forum->forum_icon = (string) $values['forum_icon'];
Archived
This topic is now archived and is closed to further replies.