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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 347
  • Total: 347

How to remove Search/News bar?

Started by bobbank, September 15, 2008, 03:10:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bobbank

It's me (again).. sorry for all these questions, but I promise that I always *try* to answer them on my own before asking!

So, if you visit my site at http://sohguild.org/ , you can see that things are coming along.  I would like to remove the search/news bar along the top.  I thought I had found the section of code that creates it, and I commented it out, but that caused a complete failure - no page would load!

Since I hadn't actually deleted anything, it was no trouble to repair.

But I was wondering if you could direct me as to what I need to do to delete it?  (I wasn't sure whether to post this here, under resources, or under themes, so please let me know your preference.)

Thanks!

bobbank

The following is the code I tried to comment out, from the template_main_above() function in the main index file (starts around line 220 or thereabouts.. sorry don't have code editor at work!)

     <div id="headerim">
   <div id="headim-l">
    <div id="headim-r">
                  <div id="search">';
      echo '
       <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
       <a href="', $scripturl, '?action=search;advanced" title="', $txt['smf298'], '"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="', $txt['smf298'], '" /></a>
       <input type="text" class="inputs" name="search" value="Search..." style="width: 120px;" />
       <input type="submit" name="submit" value="', $txt[182], '" class="submit" style="width: 10ex;" />
       <input type="hidden" name="advanced" value="0" />';

       // Search within current topic?
         if (!empty($context['current_topic']))
          echo '
         <input type="hidden" name="topic" value="', $context['current_topic'], '" />';

       // If we're on a certain board, limit it to this board ;).
          elseif (!empty($context['current_board']))
          echo '
         <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
   echo '
      </form>
   </div>';
   // Show a random news item? (or you could pick one from news_lines...)
   echo '
                       
                           <small><b>', $txt[102], ':</b>
                           ', $context['random_news_line'], '</small>
                       
          </div></div></div>

IchBin

Good job on finding the code! Just remember when commenting out lines of code you can't break an echo statement.  To learn more about echo I've done a little tutorial as well as the php site.
http://www.ichbin.us/index.php?topic=19.0
http://www.php.net/echo

If you can't figure that out, let me know and I'll show you how to do it.

bobbank

Hmm.. so I was probably just  //-ing indiscriminantly.

Although, I tried to just enclose the entire thing with a /* and */, and that didn't quite work either.  The bar was still there, but garbled, and it echo'd my little notes to myself  (ie  DELETED TO HERE */)

I will need to play with it more tonight then.  Just wanted to confirm I was taking the right approach before spending too much more time on it hehee.

Ianedres

Looks like this may be a fragment of an 'echo' statement, as Ich mentioned...
     <div id="headerim">
   <div id="headim-l">
    <div id="headim-r">
                  <div id="search">';


May want to the try removing the last 'div' portion for the 'search' ( from < to > ) while leaving the single closing quote and semicolon, as it looks to set up some CSS for the theme.

After that, commenting the 'form' section (from the opening echo '<form to the closing echo statement for the form and div tags) should remove the search box from the code you provided.

bobbank

I'm just getting ready to try this now.  But just to clarify, I don't just want to remove the search box.  I want that whole bar gone.  o,O

Thanks for all the guidance guys.. I'm going to read these posts a few times slowly and then give it a go. ;)

Ianedres

Try commenting the code where <div id="headerim"> starts, through each line of the code, including the three closing div tags </div></div></div> beneath the $context['random_news_line'], '</small>. See what that does for ya...

bobbank

I'm going to post some more code this time.  As you guys have helped me understand this echo and its very-easy-to-miss closing apostrophe, I think I did not give you the full context.  Here the code, as I tried to modify it:

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>
</head>
<body>
  <div id="boyutlar">';  // BOB ADDED '; HERE AND /* ON LINE BELOW !!!
/*   <div id="headerim">
<div id="headim-l">
<div id="headim-r">
<div id="search">';
echo '
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
<a href="', $scripturl, '?action=search;advanced" title="', $txt['smf298'], '"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="', $txt['smf298'], '" /></a>
<input type="text" class="inputs" name="search" value="Search..." style="width: 120px;" />
<input type="submit" name="submit" value="', $txt[182], '" class="submit" style="width: 10ex;" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
echo '
</form>
</div>';
// Show a random news item? (or you could pick one from news_lines...)
echo '

<small><b>', $txt[102], ':</b>
', $context['random_news_line'], '</small>

</div></div></div>   BOB ENDED HIS COMMENTING HERE !!! */
<div id="yankenar">
<div id="yankenar-l">
  <div id="header">
  <div id="userarea">';


This causes a critical error of some sort and the page cannot load.  I think it has to do with that final echo statement getting commented.  Also I think some of these classes are not in english hehee.  :laugh:

bobbank

I think I got it!  I inserted a echo '

right before that closing quartet of div's.

http://sohguild.org/

Does it look to be working?

Ianedres

It seems you were able to modify to what you wanted.

And, as you stated, you did break up an 'echo' statement with the comment field, but by putting the 'echo' where you did, it reads as valid php script that way.

Good work- and now you see the importance of making backups and using comments, rather than deleting things...


This website is proudly hosted on Crocweb Cloud Website Hosting.