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: 146
  • Total: 146

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.

Resident Geek

LOL. Thanx Ichbin, but I just realized that maybe you don't understand what I mean. It's the 'all_your_stuff_here' that I'm needing.
I don't want to lose my blocks that are preset. ie. user, article, news, search, recent topics, stats...
I want to edit the code for these individual blocks and make it so that they show up where I want it to.
Is the base code for these blocks in TPortal.php?

Also, would changing the above code from
if (isset($_GET['board']) && $_GET['board'] == 4){
echo 'all_your_stuff_here';
}


to if (isset($_GET['board']) && $_GET['board'] !== 4){
echo 'all_your_stuff_here';
}


work to tell it to display on every page BUT one?

Also, would I have to recreate this statement for every different page or is there a way to easily add a list of possibilites? Could I use an array to do this?

Thanx again for the help.

If I can figure this out, then I may try to create a mod for it.
Who knows?

Resident Geek

#11
OK. I found it.

I'm a retard. It's a function. That's all. If I create a phpbox and call the function from there, it runs. Now if I put the function into an if/then statement, I can control where and when it is called.

So all that is left unanswered at this point is whether or not I can add the '!' to tell a block where NOT to display.

Here it the code that I have inside of a block:

if (isset($_GET['board']) && $_GET['board'] !==  'http://www.mysite.com/forum/index.php'){
        global $context, $settings, $options, $scripturl, $txt, $modSettings;

        // Show a random news item? (or you could pick one from news_lines...)
        if (!empty($settings['enable_news']))
                echo ' <div style="padding: 5px;" >', $context['random_news_line'], '</div>';
}


It doesn't do what I want it to though.
It should display on every page EXCEPT the frontpage, but It's not showing up anywhere.
Just an empty block.

bloc

TP has a variable that show if the user is on the homepage..so your code could look like this:


if (!$context['TPortal']['is_front'])
{
        global $context, $settings, $options, $scripturl, $txt, $modSettings;

        // Show a random news item? (or you could pick one from news_lines...)
        if (!empty($settings['enable_news']))
                echo ' <div style="padding: 5px;" >', $context['random_news_line'], '</div>';
}

Resident Geek

Oh wow. That almost does it. Unfortunately it still shows up as an empty box. How would I get it to kill the whole box?
I could change the options to not show the frame, but I want the frame.
Hold on. I'll look and see if I can find the styling for the frame itself. If I can, then I can just hardcore the frame into the code and kill the frame options.
I'll try that.
If anyone sees a problem with this, then stop me now before I screw up my computer. ;D

Resident Geek

#14
OK. Here is what I've got in there, but It doesn't seem to work. I'd rather not have to put the CSS into a whole new file. I should be able to create the CSS directly inside of the phpbox right?
Here it is:

if (!$context['TPortal']['is_front'])
{
<<<EOD
.code
{
color: #000000;
background-color: #dddddd;
font-family: "courier new", "times new roman", monospace;
font-size: x-small;
line-height: 1.3em;
/* Put a nice border around it. */
border: 1px solid #000000;
margin: 1px auto 1px auto;
padding: 1px;
width: 99%;
/* Don't wrap its contents, and show scrollbars. */
white-space: nowrap;
overflow: auto;
/* Stop after about 24 lines, and just show a scrollbar. */
max-height: 24em;
}
EOD;

        global $context, $settings, $options, $scripturl, $txt, $modSettings;

        // Show a random news item? (or you could pick one from news_lines...)
        if (!empty($settings['enable_news']))
                echo ' <div class="code" style="padding: 5px;" >', $context['random_news_line'], '</div>';
}


EDIT: Ignore this post completely please. I was being a retard when I put it up.  :uglystupid2:

Resident Geek

OK. so I am really stupid and I don't know why I had that last code in there because that was the code for the code tag...
I'm really dumb.

Here is what I have.
I'd like to use this code but I'm getting a parse error.
Here is the code:

    if (!$context['TPortal']['is_front'])
    {
        global $context, $settings, $options, $scripturl, $txt, $modSettings;
       
        echo'
            <div class=\"tborder\" style=\"margin-bottom: 2px;\">
            <font size=\"1\"> </font><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;sesc=52e81c5eb9f3028ecd6fc13038f2f18a\"><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>
            <font size=\"1\"> </font><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>
        ';

    }


And here is the parse error:

Parse error: parse error, unexpected T_LNUMBER, expecting ',' or ';' in c:\websites\mysite304\mysite.com\forum\Sources\Errors.php(1733) : eval()'d code(35) : eval()'d code on line 7

I can't figure out why I'm getting this error.

G6Cad

At the end

<br></font></div></div></div>
        ';


Remove the

';

Resident Geek

Nope. That aint it.
That last part there is for the last echo.
Here. I cleaned it up so that it looks better.


    if (!$context['TPortal']['is_front'])
    {
        global $context, $settings, $options, $scripturl, $txt, $modSettings;
       
        echo'
            <div class=\"tborder\" style=\"margin-bottom: 2px;\">
            <font size=\"1\"> </font><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;sesc=52e81c5eb9f3028ecd6fc13038f2f18a\"><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>
            <font size=\"1\"> </font><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>
        ';
    }

G6Cad

Try this then.

<div style=\"padding: 5px;\" >',
        ';


Seems like doubble up to me there

remove

';

Resident Geek

I tried both of those, but it is still happening.
For some reason, all that I get is that parse error.

After cleaning it up some more,
it looks like this:

    if (!$context['TPortal']['is_front'])
    {
        global $context, $settings, $options, $scripturl, $txt, $modSettings;
       
        echo'
            <div class=\"tborder\" style=\"margin-bottom: 2px;\">
            <font size=\"1\"></font><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;sesc=52e81c5eb9f3028ecd6fc13038f2f18a\"><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>
            <font size=\"1\"></font><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>
                ';
    }


I still don't see what on line 7 is causing this.
I have properly escaped all of my quotation marks.

This website is proudly hosted on Crocweb Cloud Website Hosting.