OblivionNW Posted December 15, 2016 Posted December 15, 2016 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.
bfarber Posted December 15, 2016 Posted December 15, 2016 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.
OblivionNW Posted December 15, 2016 Author Posted December 15, 2016 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
GriefCode Posted December 16, 2016 Posted December 16, 2016 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
OblivionNW Posted December 16, 2016 Author Posted December 16, 2016 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
bfarber Posted December 19, 2016 Posted December 19, 2016 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'];
Recommended Posts
Archived
This topic is now archived and is closed to further replies.