TinyPortal

Development => Support => Topic started by: gfxindia on July 01, 2006, 07:06:41 AM

Title: Please help
Post by: gfxindia on July 01, 2006, 07:06:41 AM
          if($context['TPortal']['leftbar'])
          {
              echo '<td width="' ,$context['TPortal']['leftbar_width'], '" style="padding: ' , isset($context['TPortal']['padding']) ? $context['TPortal']['padding'] : '4' , 'px;  padding-top: 4px;" valign="top">
                 <div id="leftbarHeader"', empty($options['collapse_leftbar']) ? '' : ' style="display: none;"', ' style="padding-top: 5px; width: ' ,$context['TPortal']['leftbar_width'], 'px;">';
                 TPortal_sidebar('left');
              echo '</div></td>';

          }
When i place this in my custom page.
I don't see the Left Bar.
Instead i get an error saying TPortal_sidebar('left'); is an undefined function.
How to define it in my custom page. Or should i link to some other file.
Please Help.
Title: Re: Please help
Post by: agridoc on July 01, 2006, 08:11:37 AM
Hello Darkman

This code is used in theme's index.template.php.

function TPortal_sidebar($side) is defined in TPortalBlocks.template.php.

I didn't understand what you mean by "custom page".
Title: Re: Please help
Post by: gfxindia on July 01, 2006, 08:14:02 AM
I made a file called home.php
http://gfxindia.com/home.php
I used the code in that page.
Title: Re: Please help
Post by: Nokonium on July 01, 2006, 08:44:52 AM
Could I suggest a different approach. Put what you want on your 'Home' page into an article.

"Tiny Portal - Settings -  What to show on frontpage:  Single page"

My South Gwent site (see sig) is set up as a welcome page and is the same version as yours.
Title: Re: Please help
Post by: gfxindia on July 01, 2006, 08:48:47 AM
I could very well do that.
But what i said could also be possible. Just want to know what i am doing wrong.
Why does that code work in a theme's template, but not in a stand-alone file in the same directory ?
Title: Re: Please help
Post by: agridoc on July 01, 2006, 08:55:34 AM
I see now.

With TP 0.8.6 it will need quite some work and 0.8.6 is to be soon replaced. The best way is what nokonium suggested.

It will be quite easier with TP 0.9.x it is not far away and you have access in alpha version. So, I think it' s better to go this way. Bloc is aware of these needs and has included the necessary options.

By selecting a different theme and the new frontpage block and article options you can have what you want for home.

QuoteWhy does that code work in a theme's template, but not in a stand-alone file in the same directory ?

You are overriding index.php

Title: Re: Please help
Post by: G6Cad on July 01, 2006, 08:57:06 AM
Agridoc, Darkman have TP V95 on his forums i think ?
Title: Re: Please help
Post by: gfxindia on July 01, 2006, 09:00:04 AM
I am using 0.8.6 on my live site.
Quote from: agridoc on July 01, 2006, 08:55:34 AM
Bloc is aware of these needs and has included the necessary options.
I know that.
even i if i'll not be using this code now, i may use it in future.
So asking for Learning purpose and not else.
Please Teach me :D
Title: Re: Please help
Post by: IchBin on July 01, 2006, 04:21:38 PM
Darkman, I think it's because all the proper files/variables aren't loaded. You'll notice since 0.86 I think Bloc added the TP initialization to the Load.php file. He used to do it from index.template.php I think. In order for you to be able to call TinyPortal functions TP has to be loaded. So if you're just trying to call TPortal_sidebar('left'); it doesn't know where to find it because those settings haven't been put in the php's memory for you to use. I know that's how it works, I just don't know how to load everything or what needs to be loaded for it to work. :)
Title: Re: Please help
Post by: gfxindia on July 01, 2006, 04:23:17 PM
If i load the Load.php, will the Blocks show ?
Title: Re: Please help
Post by: IchBin on July 01, 2006, 04:24:13 PM
Thats a good question. The only way to know is if you try it.
Try something like require() or include() for load.php and see. I really don't know how it all works in detail.
Title: Re: Please help
Post by: gfxindia on July 01, 2006, 04:25:01 PM
OK
I'll try it ;)