TinyPortal

Development => Support => Topic started by: raenk on October 04, 2006, 01:26:20 AM

Title: Adding custom code inside the centerbar at the bottom [SOLVED]
Post by: raenk on October 04, 2006, 01:26:20 AM
Hi,

Now im working on this idea.

Im trying to add a javascript that displays news, I want it inside centerblock (centerbar) but at the bottom.

I can get it to display right when I want it, but it's not really inside the block, since it will display in everyother section (admin, forums, profile, everywhere).

So I know that i need to catch the "if" function so it displays when its called. But since I don't know much about php I couldnt figure it out for myself. This is as far as i get:

        echo '<td width="100%" align="left" valign="top" style="padding-top: 10px; padding-bottom: 10px;">';
        if($context['TPortal']['centerbar'])
                     echo '<div>' , TPortal_sidebar('center') , '</div>';

}

function template_main_below()
{
global $context, $settings, $options, $scripturl, $txt;

        echo '<here i would add the javascript code inside a div>';
echo '</td>';



If i do that i get the results I just discribed.

I tried moving the javascript part around inside that piece of code to see if it catches the 'if' function, but I got worse results or none at all.

Any ideas ?

Thanks
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: G6Cad on October 04, 2006, 09:37:38 AM
If you want to show some thing INSIDE a block, you need to have the actuall code INSIDE the block.
So if you create a center block, you have to add the adcode in that block
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 04:32:02 PM
I tried with many kind of blocks and they wont pick a javascript.

Looks like I need to add it manually. Or wich type of block will work with a javascript ?

Thanks
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: IchBin on October 04, 2006, 04:38:31 PM

You need to add your code into a scriptbox if it's javascript. If its PHP then you need to add it in a phpbox.
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 05:27:16 PM
If I add it inside a block, the block is shown at the very top and i need it at the bottom, how can i change this then ?

Thanks
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: akulion on October 04, 2006, 05:29:24 PM
there are numbers on the side of each block in the block manager

change those to set their orders
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 05:41:53 PM
I tried that already

I dont have any center nor index blocks, so the value fallsback to zero all the time

Thanks
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 07:54:46 PM
Please, I really need to do this, so if blocks are not the solution, I want to added directly into the index.template.php code (if its possible).

Any ideas ?
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: IchBin on October 04, 2006, 08:04:17 PM
In order to get it to show on the bottom you'll have to edit it in the index.template.php file right around the theme_copyright()
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 08:25:29 PM
I forgot to say that I want it to be displayed only when the centerbar displays and with the same width as the centerbar (although this can be done manually also).

In conclusion, I want it to be seen as part of the content of the centerbar.

Thanks
Title: Re: Adding custom code at bottom inside centerblock (centerbar)
Post by: raenk on October 04, 2006, 08:46:29 PM
Nevermind, I got it.

I worked with the body table spliting the cell containing the centerbar in two

Thanks anyway