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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,993
  • Total Topics: 21,324
  • Online today: 301
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 185
  • Total: 185

I need to have a custom action that automatically disables blocks.

Started by nite0859, June 04, 2006, 04:13:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nite0859

Hello.

I have an interesting shop mod set up on my forum, and I feel everything would look better if I could disable the left-hand side blocks just for when this one action is executed.

For example.

If one were to go to : http://www.pennyquick.com/forum/index.php?action=shop , you'd see that the shop does in fact load correctly inside an iframe, however I do not want users to scroll (left-right) to see the entire body. If the left sided blocks were to temporarily disappear, then the iframe could take up the entire page below the forum action button, which would look excellent.

Please tell me that is is possible to disable the left sided blocks only for when people vist the shop ..

The code that I am using to call the iframe is as follows:
echo '<iframe src ="http://www.pennyquick.com/shop.php" scrolling="yes" frameborder="0" height="1500" width="98%"  >';
echo '</iframe>';

G6Cad

Dissable the TPBlocks when in forum will give you the full page shop you want.
Or set the shop to show on 100% width will do the same with the blocks turned on.
You can have the blocks on left/right to show on the frontpage only, and then use the full width on the other pages of your site.

nite0859

Quote from: G6 on June 04, 2006, 05:55:06 PM
Dissable the TPBlocks when in forum will give you the full page shop you want.
Or set the shop to show on 100% width will do the same with the blocks turned on.
You can have the blocks on left/right to show on the frontpage only, and then use the full width on the other pages of your site.

How would I call the function to disable the TPBlocks ? That's what I want it to do. If you go to the shop, then the TPBlocks (along the left hand side for my case) turn off. If you click on any other button while inside the shop (in order to leave the shop to go to some other section of the forum), then the TPBlocks come back on.

G6Cad

I guess the only one that can give you an answer to that question is eather Bloc, or Feline, Perhaps IchBin to.
Wait and see if any of them can give you a reply here.


eldacar

Find in Sources/TPortal.php
if(($context['user']['is_admin'] && $noblocks) || ($context['TPortal']['hidebars_admin_only']=='1' && isset($in_admin))){
$context['TPortal']['leftbar']=0;
$context['TPortal']['rightbar']=0;
$context['TPortal']['centerbar']=0;
$context['TPortal']['frontbar']=0;
}


Add after:
if ($context['current_action'] == 'shop')
$context['TPortal']['leftbar']=0;

nite0859

Cool. I actually modified the store's configuration file to where it will only display 2 columns at the frontpage with small icons, and a single column on child pages with larger icons. That, and I had to specify that TP use 135 pixels on the left sided column. Now, the store doesn't break out of the iframe (left-right).

When fooling around with the TPortal.php file, I actually got it to work like this :


// check if the blocks are hidden in  forum. Setting of hide whole bar overrides.
if(!in_array($context['TPortal']['action'], array('tportal','tpadmin','tpmod',''))){
if($context['TPortal']['hide_leftbar_forum']==1)
   $context['TPortal']['leftbar']=0;
if($context['TPortal']['hide_rightbar_forum']==1)
   $context['TPortal']['rightbar']=0;
if($context['TPortal']['hide_centerbar_forum']==1)
   $context['TPortal']['centerbar']=0;
      /*if ($context['current_action'] == 'shop')
   $context['TPortal']['leftbar']=0;
*/
}

// if admin specifies no blocks, no blocks are shown! likewise, if in admin or tpadmin screen, turn off blocks
if (in_array($context['TPortal']['action'], array('theme','tpadmin','admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$in_admin=true;
if($context['TPortal']['action']=='tpmod' && isset($_GET['dl']) && substr($_GET['dl'],0,5)=='admin')
$in_admin=true;

if(($context['user']['is_admin'] && $noblocks) || ($context['TPortal']['hidebars_admin_only']=='1' && isset($in_admin))){
$context['TPortal']['leftbar']=0;
$context['TPortal']['rightbar']=0;
$context['TPortal']['centerbar']=0;
$context['TPortal']['frontbar']=0;
/*if ($context['current_action'] == 'shop')
$context['TPortal']['leftbar']=0;
*/
}


I pointed the store's configuration file to a modified version of TP_Nexus's style.css. Looks nice IMHO.

bloc

You could also, which is better imho, set the off statement inside the actual shop source file. That way the settings stays when you update TP, otherwise it will be erased in the update.

In fact, all custom "actions" of SMF can set TP on/off when executed by simply add a line to set it to 0. Also "show top" setting can be done this way:

$context['TPortal']['leftbar']=0;
$context['TPortal']['rightbar']=0;
$context['TPortal']['centerbar']=0;
$context['TPortal']['showtop']=0;

nite0859

I'll never get to experiment with the shop's source code, as it is a protected php ... everything inside 'shop.php' looks garbled. I had to pay like $99 for the code, and I don't think the authors want it to be passed around. :)

THanks for acknowledge my existence, tho, Bloc. :)


This website is proudly hosted on Crocweb Cloud Website Hosting.