TinyPortal

Development => Support => Topic started by: Ruscon on October 02, 2008, 01:46:39 AM

Title: Dynamic Block Title
Post by: Ruscon on October 02, 2008, 01:46:39 AM
So I tried to search but couldn't find anything. Basically I have this userbox aka loginbox. The title is set to "User" in TP panel and I'd like to know if it's possible to somehow make it dynamic? So that if someone is logged out it says "Login" and if someone logs thier account it should change to "User". That'd be really cool  :buck2:
Title: Re: Dynamic Block Title
Post by: IchBin on October 02, 2008, 04:24:52 AM
Not possible with the way TP is built, unless you want to go on a major code vacation.
Title: Re: Dynamic Block Title
Post by: Ruscon on October 02, 2008, 08:38:52 PM
Quote from: IchBinâ,,¢ on October 02, 2008, 04:24:52 AM
Not possible with the way TP is built, unless you want to go on a major code vacation.

Well is it really major code vacation? After 1 day of looking at the SMF code I figured out how to make the title dynamic for that, is it really that hard to do it for TP?

<div>';
if ($context['user']['is_logged'])
{
echo '', $txt['hello_member'], ' ', $context['user']['name'],'!';
}

// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo 'Login';
}
echo '
</div>
Title: Re: Dynamic Block Title
Post by: IchBin on October 03, 2008, 12:29:11 AM
The blocks are output dynamically. How would you check to see that its the user block so you could change the title?


Title: Re: Dynamic Block Title
Post by: Ianedres on October 03, 2008, 02:26:59 AM
It isn't that is impossible, but it is a rather formidable task that involves altering several locations of the portal source code.

Thinking outside of the box, you may could turn off the use of the frame, then make your own title bar with div statements with the class specified based on a guest or member.

It all seems simple, until you start coding it, as it is not just a simple <title> tag modification.

I'm sure you can attempt something like that, in a day or two, after you keep getting better with the code.

I would like to see what you come up with, if you use the above suggestion.
Title: Re: Dynamic Block Title
Post by: ed_m2 on October 03, 2008, 08:58:01 AM
can you have two blocks in the same location..... one set to viewable by loged in users only.. and the other guests only ?
Title: Re: Dynamic Block Title
Post by: clint on October 03, 2008, 09:43:07 AM
I know that you can with v1.0.5. It would save a lot of time lol.
Title: Re: Dynamic Block Title
Post by: IchBin on October 03, 2008, 02:37:39 PM
Of course you can. You just create both blocks in your panel. Select the permissions for each as you have suggested, and then it will only show for those member groups.
Title: Re: Dynamic Block Title
Post by: ed_m2 on October 03, 2008, 08:40:21 PM
ah permissions.. thats what i meant :-)