Add data to custom panel

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
Registered User
Posts: 15
Joined: Sun Jan 28, 2018 5:11 pm

Add data to custom panel

Post by danitav93 » Sat Mar 03, 2018 5:43 pm

Hello everybody!
I have a custom panel built with posting_editor_add_panel_tab event. Inside the panel's body (posting_layout_include_panel_body) there is a simple table element:

Code: Select all

<table id="tableId"  name="table">		
When a user edits a post I want to populate the table with data from DB that depend on post_id. I tried to handle some events like core.topic_review_modify_row where I can retrieve the post_id but I cannot figure out how to pass data to the table.

Thanks for any help.

User avatar
Registered User
Posts: 22
Joined: Thu Jul 25, 2013 5:07 am
Name: Alexey Znaev

Re: Add data to custom panel

Post by znaeff » Wed Mar 28, 2018 7:17 pm

Hello danitav93,

I guess this is what you need:

1) In your html template:

Code: Select all

<table class="table1 zebra-table">
	<!-- BEGIN DB_DATA -->
		<td style="vertical-align: top;">{DB_DATA.ID}</td>
		<td style="vertical-align: top;">{DB_DATA.DATA}</td>
	<!-- END DB_DATA -->
2) In your module

Code: Select all

$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
	$template->assign_block_vars('DB_DATA', array(
	    'ID'			=> $row['ID'],
	    'DATA'		        => $row['DATA'],
Extensions to prevent spam registrations and comments

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests