Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Wonko12 Posted March 18, 2018 Posted March 18, 2018 I need some help to make the look of my downloads better, currently because of the extra fields we need the sidebar looks terrible and is difficult to read, is there a way I can place the extra fields into the main body rather than the side bar? or alternatively could somebody make a plugin that would do this?
Adriano Faria Posted March 18, 2018 Posted March 18, 2018 I've made this as a setting on Links Directory, where you choose which type of fields you want to show below content: I had to change the Extra Fields call in file view and make some changes in the template too. You can't do that by only changing template.
Wonko12 Posted March 18, 2018 Author Posted March 18, 2018 @Adriano Faria Would this be do-able on downloads?
Adriano Faria Posted March 18, 2018 Posted March 18, 2018 Sure, to any app. I'm not sure this is easily made by hook but I can post here what I did there so you can edit your file and template, just in case you don't find someone to try a plugin. I can't now, unfortunately.
Wonko12 Posted March 18, 2018 Author Posted March 18, 2018 Ok thanks, I will give it a go not a coder by any means?
Adriano Faria Posted March 18, 2018 Posted March 18, 2018 Give a few minutes and I'll test it and Downloads and will post here.
Adriano Faria Posted March 18, 2018 Posted March 18, 2018 Open applications\downloads\modules\front\downloads\view.php and find: /* Custom Field Formatting */ $cfields = array(); $fields = $this->file->customFields(); foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'pfd.*', array( 'downloads_cfields', 'pfd' ), NULL, 'pfd.cf_position' ), 'IPS\downloads\Field' ) as $field ) { if( array_key_exists( 'field_' . $field->id, $this->file->customFields() ) ) { if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' ) { $cfields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] ); } } } Change to: /* Custom Field Formatting */ $cfields = array(); $longCFields= array(); $fields = $this->file->customFields(); foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'pfd.*', array( 'downloads_cfields', 'pfd' ), NULL, 'pfd.cf_position' ), 'IPS\downloads\Field' ) as $field ) { if( array_key_exists( 'field_' . $field->id, $this->file->customFields() ) ) { if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' AND $field->type != 'Editor' ) { $cfields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] ); } if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' AND $field->type == 'Editor' ) { $longCFields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] ); } } } A few lines below, find: \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->file, $commentsAndReviews, $versionData, $previousVersions, $this->file->nextItem(), $this->file->prevItem(), $cfields ); Change to: \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->file, $commentsAndReviews, $versionData, $previousVersions, $this->file->nextItem(), $this->file->prevItem(), $cfields, $longCFields ); Then on ACP, edit the file view (Downloads -> front -> view -> view) template. Click in the VARIABLES... button and change from: $file, $commentsAndReviews, $versionData, $previousVersions, $next=NULL, $prev=NULL, $cfields=array() to: $file, $commentsAndReviews, $versionData, $previousVersions, $next=NULL, $prev=NULL, $cfields=array(), $longCFields=array() Then find: <div class='ipsType_richText ipsContained ipsType_break' itemprop='text' data-controller='core.front.core.lightboxedImages'> {$file->content()|raw} </div> Add below: <div class="ipsClearfix"> <div class='ipsType_richText ipsType_break' itemprop='text' data-controller='core.front.core.lightboxedImages'> {{foreach $longCFields as $k => $v}} <hr class='ipsHr ipsSpacer_top'> <strong>{lang="downloads_{$k}"}</strong><br> {$v|raw} {{endforeach}} </div> </div> So you go from: to: But FILE and TEMPLATE edits are NOT recommended. You better find someone to make it as a plugin to you. ? Btw, it will happen only if the EXTRA FIELD is from EDITOR type.
Wonko12 Posted March 18, 2018 Author Posted March 18, 2018 Thank you ?, this should diffently be a plugin, I am sure there are plenty of others with the same sort of problem.
Wonko12 Posted March 18, 2018 Author Posted March 18, 2018 @Adriano Faria I have tried a couple of times but I get this error message Error: Class 'IPS\downloads\modules\front\downloads\\IPS\Output' not found (0) #0 /home/pcsg/public_html/system/Dispatcher/Controller.php(96): IPS\downloads\modules\front\downloads\_view->manage() #1 /home/pcsg/public_html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #2 /home/pcsg/public_html/applications/downloads/modules/front/downloads/view.php(60): IPS\Content\_Controller->execute() #3 /home/pcsg/public_html/system/Dispatcher/Dispatcher.php(146): IPS\downloads\modules\front\downloads\_view->execute() #4 /home/pcsg/public_html/index.php(12): IPS\_Dispatcher->run() #5 {main} also when I put in the last piece of code there appears to be a </span> tag extra probably a error on my part
Adriano Faria Posted March 18, 2018 Posted March 18, 2018 Make sure you made everything right in the PHP file. Regarding the SPAN, remove it.
Wonko12 Posted March 18, 2018 Author Posted March 18, 2018 Thanks for your help @Adriano Faria I sorted the php, I had a format error after copy pasting but all working now thanks again.
newbie LAC Posted March 19, 2018 Posted March 19, 2018 Per category setting File view page P.S. It's a plugin
Wonko12 Posted March 19, 2018 Author Posted March 19, 2018 @newbie LAC do you have a link for the plugin?
newbie LAC Posted March 20, 2018 Posted March 20, 2018 11 hours ago, Wonko12 said: @newbie LAC do you have a link for the plugin?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.