Jump to content

Recommended Posts

Posted (edited)

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:
Could contain: Page, Text, File, Webpage, White Board

Mine:
Could contain: Page, Text, File, Webpage

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.
Could contain: Page, Text, File, White Board

 

If i use it as shown in my example it will display like this
Could contain: Chart, Plot, Text

and that's why I want it like in Header/Footer.

Edited by drawncodes
  • 3 weeks later...
  • Management
Posted

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 ] ) );

 

Posted
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 ❤️ 

Posted
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:
Could contain: Page, Text, File, Webpage, White Board

Posted (edited)
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 by drawncodes
  • 2 weeks later...
Posted
<?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.

 

  • 2 weeks later...
  • 9 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...