TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 10:05:53 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 101
  • Total: 101

Custom Actions and Tp Blocks

Started by 0uK^-, January 01, 2007, 11:01:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0uK^-

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
<?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

IchBin

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

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^-

#3
Quote from: IchBinâ„¢ on January 02, 2007, 03:14:20 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
<?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
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.

G6Cad

Quote from: brianjw on January 02, 2007, 03:24:33 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

Some instructions to doing your test action.-

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


Open the index.php

Search For

'sticky' => array('LockTopic.php', 'Sticky'),

Add after

'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.


$txt['test'] = 'Test';

Then create the test.php Page

<?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.

<?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 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^-

brianjw, thanks but its not my question.

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

IchBin

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.

bloc

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^-

Thanks  :)

I did it....

Tkz for the help.  :up:


Tommy

#11
Quote from: Bloc on January 02, 2007, 04:00:18 PM
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.

Well...is there no option to display the right panel on the custom action page even if it's deactivated in the forum? I only want to display the right panel on the forums index - and on my custom action (action=hpnews).

Yep, i could use the "extended visibility option" but for that I need two (but the same) blocks.
One for the index and one for my custom action page...

Thurnok

hehe... this is the first time I came across this topic, but I'm assuming that OuK^- fixed the error in the code that is in his first post since he later posts he got it... LOL

FYI, if you are wondering...

<?php
.
.

$context['page_title'] = 'Just Testing;

.
.
?>



should be:

<?php
.
.

$context['page_title'] = 'Just Testing';

.
.
?>



bloc

Quote from: Dubidu on March 22, 2007, 05:27:48 PM
Quote from: Bloc on January 02, 2007, 04:00:18 PM
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.

Well...is there no option to display the right panel on the custom action page even if it's deactivated in the forum? I only want to display the right panel on the forums index - and on my custom action (action=hpnews).

Yep, i could use the "extended visibility option" but for that I need two (but the same) blocks.
One for the index and one for my custom action page...
No, not currently..because the blocks are fetched quite early and aslo consider the "hide in forum" setting, its hard to do this.

In TP 0.9.5 and earlier it WAS possible - because the hide-in-forum setting was applied  after the blocks were loaded. But since the introduction of dynamic blocks, I had to add that setting into the fetching routine itself. Its more resource friendly this way, only loading what you need. 

sc2forums

Quote from: Bloc on January 02, 2007, 04:00:18 PM
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.

I've been trying to do the same thing, but I don't have the option "custom" in the dropdown menu... there is the field for entering the custom name next to it, but no 'custom"? Any help would be appreciated! Thanks!

IchBin

Thats all you need. You put the name of the custom action in the text box.

Tommy

Hi,

does anyone know a "theme code" for a custom action site, so I can choose a theme for it - like in smf boards "Board Theme
This allows you to change the look of your forum inside only this board." ?
Would be great - thanks!

/Edit: oops, you guys don't give support for smf questions, right? Then forget it...  :(