Jump to content

create a plugin


Recommended Posts

hi

I am developing a plugin but I have a small problem.

I want to insert below code snippet in the following tag!

my code:

data-adress="{{if member.language()->isrtl}}test1{{else}}test2{{endif}}"

my following tag:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow'>

result:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow' data-adress="{{if member.language()->isrtl}}test1{{else}}test2{{endif}}">

 

Which one should I choose?

Firefox_Screenshot_2022-09-22T13-05-13_864Z.png.70087049c75df7d580dfc306876db2ff.png

I try "Modify the chosen element(s) to add attribute(s)" but got an error!

When Love is real

it finds away

Link to comment
Share on other sites

  • Manager

Last one - Replace and replace whole li code, not only one line:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow'>

 

  • Thanks 1

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Link to comment
Share on other sites

  • Manager

You may also try it. One thing - please try different ways before ask. That how it work - you ARE the developer, has dev board for that, don't be affraid to test various things! :)

  • Like 1

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Link to comment
Share on other sites

I finally do it. Thanks

Now I want to add a settings in the plugin, so when I want the first option to be enabled, the following Variable will start working inside the tag and it will stop working when I disable it.

<li data-address="location">

For this I tried below methods:

<!--mothod 1-->
<li {{if settings.datalocation_settings}}data-address="location"{{endif}}>
<!--method 2-->
<li {{if \IPS\Settings::i()->datalocation_settings == '1'}}data-address="location"{{endif}}>

With these methods, the plugin works, but the settings do not.

what's the problem?

When Love is real

it finds away

Link to comment
Share on other sites

1 hour ago, DawPi said:

Did you added that setting key in the plugin dev settings tab?

yes

setting key:

 

Spoiler

Firefox_Screenshot_2022-09-23T16-22-40_174Z.thumb.png.4044e765b024066f23adcfd84b010882.png

 

setting.php:

//<?php

    $form->addTab( 'dataaos_setting' );
	$form->add( new \IPS\Helpers\Form\YesNo( 'dataaosforums_setting_ed', \IPS\Settings::i()->dataaosforums_setting_ed, FALSE, array(), NULL, NULL, NULL, 'dataaosforums_setting_ed' ) );
	$form->add( new \IPS\Helpers\Form\YesNo( 'dataaostopics_setting_ed', \IPS\Settings::i()->dataaostopics_setting_ed, FALSE, array(), NULL, NULL, NULL, 'dataaostopics_setting_ed' ) );

    $form->addTab( 'dataaos_about_plugin' );
    $form->addHeader( 'dataaos_about_text' );
    $form->addHeader( 'dataaos_support_links' );
	
if ( $values = $form->values() )
{
	$form->saveAsSettings();
	return TRUE;
}

return $form;

 

When Love is real

it finds away

Link to comment
Share on other sites

4 minutes ago, DawPi said:

Where is that setting key here?

Sorry, there was a typo

<!--mothod 1-->
<li {{if settings.dataaosforums_setting_ed}}data-address="location"{{endif}}>
<!--method 2-->
<li {{if \IPS\Settings::i()->dataaosforums_setting_ed == '1'}}data-address="location"{{endif}}>

 

When Love is real

it finds away

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.