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,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 391
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 399
  • Total: 399

Show on all except frontpage?

Started by Resident Geek, April 17, 2007, 04:50:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

#20
You don't need to escape double quotes when using single quotes for your echo statement. You also had the session id in your link which I removed. You should put that info in a link. Removed some extra font tags you didn't appear to need too. Seem to be many extra div tags, but I'll let you mess with that. :)

Ã,  Ã,  if (!$context['TPortal']['is_front'])
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  global $context, $settings, $options, $scripturl, $txt, $modSettings;
Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  echo'
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  <div class="tborder" style="margin-bottom: 2px;">
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  <div class="titlebg" style="padding: 4px; font-weight: bold;"><font size="1"><a href="javascript: void(0); return false" onclick="toggle('5'); return false"><img id="blockcollapse5" style="margin: 0pt;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/collapse.gif" alt="" align="right" border="0"></a><a href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl=5;"><img style="margin-right: 4px;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/tp-edit.gif" alt="" align="right" border="0"></a>Tests </font></div>
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  <div class="windowbg" style="padding: 4px;" id="block5"><div style="padding: 5px;" class="smalltext"><p style="margin: 0pt; padding: 0pt 0pt 0.5ex;"><font size="1"><img src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/tpoptions.gif" style="margin: 0pt;" alt="" align="absbottom">
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  <div style="padding: 5px;" >';
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  echo $context['random_news_line'];
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  echo'</div>
<br></font></div></div></div>
Ã,  Ã,  Ã,  Ã,  ';

Ã,  Ã,  }


If this code doesn't work then you may need to try this.
toggle('5');
Change to this:
toggle(\'5\');

Resident Geek

#21
Success!

You rock IchBin.
It was the toggle that was causing the trouble.
For those who want it,
This snippet of code will allow you to create a box that can hidden on only specific pages.


//Is the current page the frontpage?
if (!$context['TPortal']['is_front'])
    {
     //If so, then load the global variables
        global $context, $settings, $options, $scripturl, $txt, $modSettings;
       
     //and create the frame for the block.
        echo'
            <div class="tborder" style="margin-bottom: 2px;">
            <div class="titlebg" style="padding: 4px; font-weight: bold;"><font size="1"><a href="javascript: void(0); return false" onclick="toggle(\'5\'); return false"><img id="blockcollapse5" style="margin: 0pt;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/collapse.gif" alt="" align="right" border="0"></a><a href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl=5;"><img style="margin-right: 4px;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/tp-edit.gif" alt="" align="right" border="0"></a>Tests </font></div>
            <div class="windowbg" style="padding: 4px;" id="block5"><div style="padding: 5px;" class="smalltext"><p style="margin: 0pt; padding: 0pt 0pt 0.5ex;"><font size="1">
            <div style="padding: 5px;" >';

     //Put all of your code here!
           
            echo'</div><br></font></div></div></div>
        ';

    }


To make this work with any other page (doesn't have to be frontpage), replace:

if (!$context['TPortal']['is_front'])

With:


// find out the domain
$domain = $_SERVER['HTTP_HOST'];
// find out the path to the current file:
$path = $_SERVER['SCRIPT_NAME'];
// find out the QueryString:
$queryString = $_SERVER['QUERY_STRING'];
// put it all together:
$url = "http://" . $domain . $path . "?" . $queryString;

//Are we on the BLANK page now?
//if ($url != 'http://www.mysite.com')

You must replace the 'mysite.com' portion with the exact URL for the page you want to exclude the block from.


Thanx again for everyone that helped out here. This has been a question on my mind for a very long time, and I'm glad to have it out of the way.

Thanx again!

EDIT:
Note that in order for this to work properly, you MUST have the frame turned off for the block.
the code above will create the frame for you and not display it while on the specified page.

Resident Geek

Hum... It almost works...

Here is what you have to do to make it work properly.

You will have to open your database and browse smf_tp_articles.
Find what the id is for your specific block and change the following portions.


            <div class="titlebg" style="padding: 4px; font-weight: bold;"><font size="1"><a href="javascript: void(0); return false" onclick="toggle(\'5\'); return false"><img id="blockcollapse5" style="margin: 0pt;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/collapse.gif" alt="" align="right" border="0"></a><a href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl=5;"><img style="margin-right: 4px;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/tp-edit.gif" alt="" align="right" border="0"></a>Tests </font></div>


change it to:



            <div class="titlebg" style="padding: 4px; font-weight: bold;"><font size="1"><a href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl=5;"><img style="margin-right: 4px;" src="http://www.priacta.com/forum/Themes/TPstyle11_tp/images/tp-edit.gif" alt="" align="right" border="0"></a>Tests </font></div>


then exchange the part that says:

href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl=5;">


and exchange with:

href="http://www.priacta.com/forum/index.php?action=tpadmin;blockeditl={BLOCK'S ID};">

You must exchange the {BLOCK'S ID} with your block's id.

This should fix the code.

Sorry 'bout the bug in that.

This website is proudly hosted on Crocweb Cloud Website Hosting.