Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted June 1, 20231 yr So I see there is another editor so to say where Header / Footer HTML is and I also want to use it but I can't figure out how. Examples.Invisioncommunity:Mine: I want to make it show exactly like Header and Footer editor. help? I think I can access it and make it show through Custom PHP, but I don't know where to select it. There is no documentation for it. If i use it as shown in my example it will display like this and that's why I want it like in Header/Footer. Edited June 1, 20231 yr by drawncodes
June 2, 20231 yr Author Well, I guess there is no one here with a solution. I'll try to find something to work around it. @Jim M any thoughts?? Edited June 2, 20231 yr by drawncodes
June 20, 20231 yr If I read the above correctly, you will want to be using a Codemirror helper, and not a Text helper. A quick look at system\Theme\Theme.php for the theme_simple_header_settings and theme_simple_footer_settings fields gives the answer.
June 21, 20231 yr Management As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) );
June 21, 20231 yr Author 3 minutes ago, Matt said: As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) ); Uhhhh, thank you ❤️
June 21, 20231 yr Author 23 hours ago, Nathan Explosion said: If I read the above correctly, you will want to be using a Codemirror helper, and not a Text helper. A quick look at system\Theme\Theme.php for the theme_simple_header_settings and theme_simple_footer_settings fields gives the answer. 14 minutes ago, Matt said: As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) ); Thank you both, I did it:
June 22, 20231 yr You cannot save template logic in a theme setting and expect it to work when you include it. It has to be in a template and called properly as a template.
June 22, 20231 yr Author 4 hours ago, Stuart Silvester said: You cannot save template logic in a theme setting and expect it to work when you include it. It has to be in a template and called properly as a template. Ohh I see, but I already tried it, and still doesn't work.. am I doing smth wrong? Edited June 22, 20231 yr by drawncodes
July 5, 20231 yr Author <?php // Create a form using defaults $form = new \IPS\Helpers\Form; $form->add(new \IPS\Helpers\Form\Codemirror( "core_theme_setting_title_{$row['sc_id']}", $value, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ], NULL, NULL, NULL, 'theme_setting_' . $row['sc_key'] )); // Send the form for output \IPS\Output::i()->output = $form; So we did some testing with this code from above and also the code from Theme.php and we were trying to replicate it directly in the Designer Mode custom settings for the fields I've created. /** * Get theme header and footer * * @return array */ public function getHeaderAndFooter(): array { $return = [ 'header' => null, 'footer' => null ]; if ( $this->custom_header ) { $key = 'custom_header_' . $this->_id; if ( ! isset( \IPS\Data\Store::i()->$key ) ) { \IPS\Data\Store::i()->$key = static::compileTemplate( $this->custom_header, NULL ); } $return['header'] = \IPS\Data\Store::i()->$key; } if ( $this->custom_footer ) { $key = 'custom_footer_' . $this->_id; if ( ! isset( \IPS\Data\Store::i()->$key ) ) { \IPS\Data\Store::i()->$key = static::compileTemplate( $this->custom_footer, NULL ); } $return['footer'] = \IPS\Data\Store::i()->$key; } return $return; } We want to know what limits we have in designer mode at customizing tabs and adding form through custom/manual PHP.
April 28, 2024Apr 28 Author On 4/23/2024 at 2:37 PM, Lisa Lightner said: I'm having trouble doing this. Did you ever get a solution? @Alexandru Nope. I didn't try to get it working anymore.