Jump to content

Add Page app Block to Page template through a plugin


shahed

Recommended Posts

Hello,

Recently I started to create new plugin for a IP.Page Template.

Plugin currently works just fine, except in one area. and I don't know if it's a bug. I use this method to insert IP.Page Blocks through a plugin:

$form->add( new \IPS\Helpers\Form\TextArea( 'setting_key', \IPS\Settings::i()->setting_key ) );

As a textarea field, like adding {block ="block_name"} in plugin line by line. while I can use HTML tags in textarea, but the {block ="block_name"} won't parser as a normal block. It's just adding a RAW {block ="block_name"} in IP.Pages template space.

Capture.thumb.JPG.32677eadfcd04f4632aca3a934c638f9.JPG

 

And this is for summon the setting contents in IP.Pages Template space.

{{if settings.setting_key}}{setting="setting_key"}{{endif}}
Link to comment
Share on other sites

Well, you are using a template tag (“setting”), which is then parsed and returns the result. But you expect the result to be parsed again as template tag (“block”). That doesn’t work. 

A simple solution would be to just collect the block identifier in the text field, not the entire template tag. 

{{if settings.setting_key}}{block="$block_name"}{{endif}}

 

Link to comment
Share on other sites

19 minutes ago, opentype said:

 


{{if settings.setting_key}}{block="$block_name"}{{endif}}

 

Thanks,

I think there is a miss describe, because it's not the entire template tag. It's just block identifier should be placed inside textarea. so this line are in template, in exact space as Just {block="block_name"} should be.

{{if settings.setting_key}}{setting="setting_key"}{{endif}}

I want add these blocks there line by line. and I don't want it for a single or two specific block.

Link to comment
Share on other sites

20 minutes ago, shahed said:

I think there is a miss describe, because it's not the entire template tag. It's just block identifier should be placed inside textarea. so this line are in template, in exact space as Just {block="block_name"} should be.

My answer is still valid. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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