Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 12, 2022, 02:36:42 PM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 50
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 45
Total: 45

Author Topic: Custom Actions and Tp Blocks  (Read 11455 times)

0 Members and 1 Guest are viewing this topic.

0uK^-

  • Guest
Custom Actions and Tp Blocks
« on: January 01, 2007, 04:01:47 PM »
Hi there.

I have one problem.  :-\

I create one new custom action but i need in that action show the blocks from tp.

I search and find this topic:
http://www.tinyportal.net/index.php?topic=5495.0

But don't show the blocks  :'(

I put for example in the Sources/Test.php
Code: [Select]
<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
Test()
{
global $context;

//Check if the current user can send a message
    
$context['page_title'] = 'Just Testing;
    $context['
linktree'][] = array(
'
url' => $scripturl . '?action=Test',
'
name' => 'Test'
);
    $context['
TPortal']['leftbar']=1;
loadTemplate('
Test');
}
?>

But don't show any blocks =(

Can someone help me?

Sorry for my English
« Last Edit: March 24, 2007, 04:46:33 PM by G6â„¢ »

Offline IchBin

  • Friends
  • *
  • Posts: 16231
Re: Custom Actions and Tp Blocks
« Reply #1 on: January 01, 2007, 08:14:20 PM »
Your custom actions need to be set to display in the index.template file. If not, you'll have to manually add the code for the sidepanels.

brianjw

  • Guest
Re: Custom Actions and Tp Blocks
« Reply #2 on: January 01, 2007, 08:24:33 PM »
Info
1. Display.test.php - needs to have what you want to appear
2. Test.php - I am not sure. But I could give you better instructions when I get time
--------There is a few more you must do but I will make better directions in a few days---------

0uK^-

  • Guest
Re: Custom Actions and Tp Blocks
« Reply #3 on: January 02, 2007, 03:25:06 AM »
Your custom actions need to be set to display in the index.template file. If not, you'll have to manually add the code for the sidepanels.
Sorry i didn't understand  :-\

I have in Test.php
Code: [Select]
<?php

if (!defined('SMF')) die('Hacking attempt...');

function 
Test()
{
global $context;

//Check if the current user can send a message
    
$context['page_title'] = 'Just Testing;
    $context['
linktree'][] = array(
'
url' => $scripturl . '?action=Test',
'
name' => 'Test'
);
    $context['
TPortal']['leftbar']=1;
loadTemplate('
Test');
}
?>
And in the Test.template.php
Code: [Select]
function template_main()
{
global $context, $settings, $options, $txt, $scripturl;

echo '


<table width="100%" border="0" cellspacing="0" cellpadding="3" >
<tr>
<td>', theme_linktree(), '</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td align="center" >Testing</td>
</tr><tr>
<td class="windowbg">';

echo '<table border="0" cellpadding="0" cellspacing="3" width="100%">
         <tr>
           <td width="100%" valign="top">
  Just Testing
</td></tr></table>';
echo '
</td>
</tr>
</table><br /><br />
';
}

And the result is this:


But when i unhide the blocks in the Forum the blocks appears.

I want the blocks hide in forum and in the action Test unhide.
« Last Edit: January 02, 2007, 03:49:32 AM by 0uK^- »

Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: Custom Actions and Tp Blocks
« Reply #4 on: January 02, 2007, 03:39:00 AM »
Info
1. Display.test.php - needs to have what you want to appear
2. Test.php - I am not sure. But I could give you better instructions when I get time
--------There is a few more you must do but I will make better directions in a few days---------

Brian, we appriciate you helping where you can, but please.
If you dont have the TIME to end the help or write it so they understand, keep from posting at all, the threads just get to long with out any good content and thats the same as having a usless topic about nothing in the end.
So when you help, take the time and go through with the help you want to give, or please dont post at all in it ;)

brianjw

  • Guest
Re: Custom Actions and Tp Blocks
« Reply #5 on: January 02, 2007, 06:26:04 AM »
Some instructions to doing your test action.-

Backup any files i tell you to edit before trying this.


Open the index.php

Search For

Code: [Select]
'sticky' => array('LockTopic.php', 'Sticky'),
Add after

Code: [Select]
'test' => array('test.php', 'test'),
Open up the Modifications.english.php file in your languages directory.

Add this after another text string on the page.


Code: [Select]
$txt['test'] = 'Test';
Then create the test.php Page

Code: [Select]
<?php


if (!defined('SMF'))
die('Hacking attempt...');

function 
test()
{
global $context$mbname$txt;


//Load the main test template
loadtemplate('test');

//Load the main test template
$context['sub_template']  = 'main';
//Set the page title
$context['page_title'] = $mbname ' - ' $txt['Test'];

}
?>


Next Create the test.template.php page.

Code: [Select]
<?php
/*
Test Page
*/
 
function template_main()
{
global $db_prefix$scripturl$txt$user_info,$settings$modSettings;

 echo
'
<b>Add the code of the object you want displayed in between the echo tag</b>
'
;
   
}
?>

Where you see
Code: [Select]
Add the code of the object you want displayed in between the echo tag you add the code of the object that will be displayed in that action.


test.php Goes in the sources directory , test.template.php goes in the default themes directory.


Caps or small letters does matter!! if i dont use a capital letter you shouldnt either!!

Hope this is useful to someone.

Those were the instructions and you must follow all those directions to add a action correctly. It looked to me like you only did test.php and test.template.php so you must follow the other files as well.

Thanks,
Brianjw

0uK^-

  • Guest
Re: Custom Actions and Tp Blocks
« Reply #6 on: January 02, 2007, 08:31:32 AM »
brianjw, thanks but its not my question.

My question is how can i add the TpBlocks in the custom action.  :-\

Offline IchBin

  • Friends
  • *
  • Posts: 16231
Re: Custom Actions and Tp Blocks
« Reply #7 on: January 02, 2007, 08:43:42 AM »
brianjw gave you the answer pretty much. If you add your custom action as he pointed out, your test.template.php will load inside the index.template.php file. By default the index.template.php file shows the sidebars.

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: Custom Actions and Tp Blocks
« Reply #8 on: January 02, 2007, 09:00:18 AM »
Since any custom action is assumed to be the "forum" part, the setting for hiding panels when in forum, will set in whenever your custom action is run.

I rather suggest you set them on in the forum to be able to see them. Or - use the extended visiblity options for each block and make that block show when in your custom action. Choose "custom" and type in the action name in the filed next to it. it should then display in your custom action even if blocks are set to be hidden in forum.

0uK^-

  • Guest
Re: Custom Actions and Tp Blocks
« Reply #9 on: January 02, 2007, 09:14:34 AM »
Thanks  :)

I did it....

Tkz for the help.  :up: