TinyPortal

Development => Support => Topic started by: kmccann on October 11, 2008, 10:52:16 PM

Title: Are there TP functions available?
Post by: kmccann on October 11, 2008, 10:52:16 PM
I was wondering if there are TP functions available that would allow me to display chunks of content, similar to the way SSI.php and its functions operate.

I have a complex custom app that I want to embed within my SMF/TP site  (1.1.6 and 1.0.5 respectively) and I can do some things with SSI.php such as checking user info. But I'd love to be able to do something like:

myapp.php:

<?

include("SSI.php")
include("TP.php");

tp_header();
tp_leftblocks();

... do my stuff ...

tp_rightblocks();
tp_footer();

?>

Do such functions exist?

Thanks,
Kevin
Title: Re: Are there TP functions available?
Post by: G6Cad on October 11, 2008, 11:14:38 PM
You can make php pages with your own content with articles.
Title: Re: Are there TP functions available?
Post by: kmccann on October 11, 2008, 11:55:52 PM
Quote from: G6 on October 11, 2008, 11:14:38 PM
You can make php pages with your own content with articles.

I realize that, but that won't work because it is an existing, standalone  application. Many links within it essentially point to itself:

stats.php?op=showmatches&did=3&mid=67
stats.php?op=showteamstandings&did=3&sort=pf
stats.php?op=showmembers...
etc.

Way too big (over 100 scripts "included" by the main stats.php) to use php pages and recreate the links (besides, php pages get assigned id numbers ... no can do).

That's why I was hoping for functions to grab specific content. I actually hacked something together to get left and right script blocks and display them. Maybe I'll just follow down that path. But it sure would have been glorious had the examples I gave been available.  ;)

Unless I hear different from someone else I will assume the answer to the original question is no.

Thanks,
Kevin


Title: Re: Are there TP functions available?
Post by: IchBin on October 11, 2008, 11:58:56 PM
http://www.tinyportal.net/index.php?topic=20069.0
Title: Re: Are there TP functions available?
Post by: kmccann on October 12, 2008, 12:13:23 AM
Quote from: IchBinâ,,¢ on October 11, 2008, 11:58:56 PM
http://www.tinyportal.net/index.php?topic=20069.0

Wow. This looks *very* promising. I'll give it a whack and report back.
Title: Re: Are there TP functions available?
Post by: kmccann on October 12, 2008, 01:12:54 AM

Almost perfect. Just need to figure out why my left-hand blocks are not showing up. There should be the user block and two scriptbox blocks below. Any ideas?

The relevant code is pretty much what was given in the thread:

<?php

$ssi_theme = 1;
global $context;

include('SSI.php');
$userid = $context['user']['id'];
$username = $context['user']['username'];
$useremail = $context['user']['email'];

TPortal_init();
template_main_above();
tp_hidebars('right');   //    I do want to hide the right blocks

include("stats/index.php");   // my custom app, which works fine

ssi_shutdown();
?>


Thanks,
Kevin
Title: Re: Are there TP functions available?
Post by: G6Cad on October 12, 2008, 11:07:43 AM
Panels, how have you set the panels to show, witout panels, no block will show as they depend on the panel settings
Title: Re: Are there TP functions available?
Post by: kmccann on October 12, 2008, 03:20:05 PM
Quote from: G6 on October 12, 2008, 11:07:43 AM
Panels, how have you set the panels to show, witout panels, no block will show as they depend on the panel settings

Thanks for your reply.

If I go into configure Panels and Blocks, the only Panel options I see are to hide them in certain functions. I only have them hiding while in Admin (and tested without doing so, same result).

Everything looks normal in the Blocks (I have the left blocks set to "Display on all pages and sections"), and you can see that the left panel of blocks shows fine in the test site homepage:

(snip)

But they don't show up when pointing to a script with the code shown earlier in this thread:

(snip)

I just can't figure it out. I wonder if it's a bug introduced in TP 1.0.5? I wonder if anyone is doing this kind of thing with SMF 1.1.6 and TP 1.0.5. Or maybe there is something else I'm missing ... but I can't see what.

Thanks,
Kevin
Title: Re: Are there TP functions available?
Post by: G6Cad on October 12, 2008, 03:29:48 PM
I dont know coding that much to give you a straight answer, but the functions for the blocks and panels are something like

"check if panel is active and if so, where and if active the block show in the panel"

If you miss the panelcheck, the block will not show eather, so i guess you need to have some sort of check to where and if the panel are to show or not.
Title: Re: Are there TP functions available?
Post by: kmccann on October 12, 2008, 03:43:12 PM
Well, everything seems OK in the config options. And, as you can see, the left blocks show up when viewing the homepage. Or a specific page, for that matter:

(snip)

So it seems like there might be something going on with the "template_main_above();" function. Maybe I'll do some digging there, although I'm reluctant to make any changes to it.

Thanks,
Kevin