News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Site Navagation

Started by Acans, December 08, 2009, 08:32:09 AM

Previous topic - Next topic

Acans

Hey, I'm in the process of updating one of my forums to 2.0 RC2.

The forum updated without a hitch with all posts, members, ect saved.

Now because Dzinerstudios haven't updated their themes for 2.0 RC2 yet, I want to make some minor modifications to the curve.

I want to remove the SMF logo from the top right hand corner and replace it with link like here at SMF.

I understand that the file i need to edit is index.template.php but after i searched for the smflogo images and took a look at the code i got lost XD
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

In the Admin CP > Current Thene > Site Slogan. Add the link here and it will replace the logo. You can use html.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

Quote from: Kays on December 08, 2009, 10:57:24 AM
In the Admin CP > Current Thene > Site Slogan. Add the link here and it will replace the logo. You can use html.

Will that add all i want to add or just one link.

In the top navagation i want to have Home, Community, Staff, Rules, Download.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

I don't know the maximum size allowed. Try it and see what happens.

If that doesn't work you might have to edit index.template.php

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

Quote from: Kays on December 08, 2009, 11:11:12 AM
I don't know the maximum size allowed. Try it and see what happens.

If that doesn't work you might have to edit index.template.php

Tried, but i couldn't get it to work as well as it should have.

I know I have to edit index.template.php, however I'm not to well of a coder. I found where the code needs to go, but I just can't get it to work.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

What are you trying to add? Can you post the code?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

www.dream-portal.net

See how they have replaced the SMF logo with links to their downloads, ect.

Thats what I want to do.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

If that's what you want then it will be more difficult since you'll need to create an array similar to link_tree array and then to add the code to display it in Index.template.php.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

This is what i want to replace the smf logo with, but i just cant get it to work well

<ul class="dropmenu" id="site_nav">
<li id="button2_home">
<a class="active firstlevel" href=http://blazescape.net/index.php>
<span class="firstlevel">Home</span>
</a>
<li id="button2_forum">
<a class="firstlevel" href="http://blazescape.net/index.php?action=forum">
<span class="firstlevel">Community</span>
</a>
</li>
<li id="button2_download">
<a class="firstlevel" href="http://blazescape.net/index.php?page=download">
<span class="firstlevel">Download</span>
</a>
</li>
<li id="button2_rules">
<a class="firstlevel" href="http://blazescape.net/index.php?page=rules">
<span class="firstlevel">Rules</span>
</a>
</li>
<li id="button2_team">
<a class="firstlevel" href="http://blazescape.net/index.php?action=teampage">
<span class="firstlevel">Team</span>
</a>
</li>
</ul>
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

Ok, since you have that already. :)

In index.template.php find:


// the upshrink image, right-floated
echo '
<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';
echo '
', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="align_right">' . $settings['site_slogan'] . '</div>', '
</div>
<div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="user">';

// If the user is logged in, display stuff like their name, new messages, etc.


And replace it with:


// the upshrink image, right-floated
echo '
<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
<div class="align_right">
<ul class="dropmenu" id="site_nav">
            <li id="button2_home">
               <a class="active firstlevel" href=http://blazescape.net/index.php>
                  <span class="firstlevel">Home</span>
               </a>
            <li id="button2_forum">
               <a class="firstlevel" href="http://blazescape.net/index.php?action=forum">
                  <span class="firstlevel">Community</span>
               </a>
            </li>
            <li id="button2_download">
               <a class="firstlevel" href="http://blazescape.net/index.php?page=download">
                  <span class="firstlevel">Download</span>
               </a>
            </li>
            <li id="button2_rules">
               <a class="firstlevel" href="http://blazescape.net/index.php?page=rules">
                  <span class="firstlevel">Rules</span>
               </a>
            </li>
            <li id="button2_team">
               <a class="firstlevel" href="http://blazescape.net/index.php?action=teampage">
                  <span class="firstlevel">Team</span>
               </a>
            </li>
         </ul>
</div>
</div>

<div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="user">';

// If the user is logged in, display stuff like their name, new messages, etc.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

Thanks, However do you know a way to drop it down a tad to the middle more?

"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

Add some padding to that division tag on the fourth line;


<div class="align_right" style="padding-top: 10px;">

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

The padding worked, Thanks so much.

Topic Marked as Solved
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Costa

Kays, can you rewrite this topic and post like a tut at Tips and Tricks?? :)

btw, it's better you don't use the entire link, like the Team Page, you can use this:
<li id="button2_teampage">
<a class="active firstlevel" href="index.php?action=teampage">
<span class="firstlevel"> ' . $txt['team'] . '</span>
</a>
</li>
Like this, you can use this on different domains without need to update the links, plus, your navigation bar support other languages :)
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Acans

I might take both of your tips and make it into a mod.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Costa

Good to know
Good luck with packaging :)
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Kays

#17
Quote from: α¢αηѕ on December 09, 2009, 05:36:16 AM
I might take both of your tips and make it into a mod.

What you have is pretty well site specific. If I was to do it I'd look at a way to do it via Admin CP input. This way people can add links specific to their sites.

@Costa, that's a good idea. I'm just looking into a way to make it a bit easier to do. And explain.

@ α¢αηѕ, In looking into Costa's request I've made a few changes. I can get it now to show as being active if on any of those pages. The only problem is trying to identify when "Community" is active since I don't have a portal installed.

Which portal are you using or could you give me a link to your site and a regular member account so I can poke around.

Undo the changes I first suggested and then add this just after the globals are defined. Before the first "echo" It's more portable this way.


$current_location = 'home';
if (isset($_REQUEST['action']) || isset($_REQUEST['topic']) || isset($_REQUEST['board']))
$current_location = 'forum';
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'download')
$current_location = 'download';
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'rules')
$current_location = 'rules';
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'teampage')
$current_location = 'teampage';

$settings['site_slogan'] =
'<div style="padding-top: 12px;">
<ul class="dropmenu" id="site_nav">
<li>
<a class="' . ($current_location == 'home' ? 'active ' : '') . 'firstlevel" href="index.php">
<span class="firstlevel">Home</span>
</a>
<li>
<a class="' . ($current_location == 'forum' ? 'active ' : '') . 'firstlevel" href="index.php?action=forum">
<span class="firstlevel">Community</span>
</a>
</li>
<li>
<a class="' . ($current_location == 'download' ? 'active ' : '') . 'firstlevel" href="index.php?page=download">
<span class="firstlevel">Download</span>
</a>
</li>
<li>
<a class="' . ($current_location == 'rules' ? 'active ' : '') . 'firstlevel" href="index.php?page=rules">
<span class="firstlevel">Rules</span>
</a>
</li>
<li>
<a class="' . ($current_location == 'teampage' ? 'active ' : '') . 'firstlevel" href="index.php?action=teampage">
<span class="firstlevel">Team</span>
</a>
</li>
</ul>
</div>';

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

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

   echo !empty($settings['forum_width']) ? '

Inbetween these 2 right, I did that, didn't work.

www.dev.acans.org/2.0

I'll pm you arantors account info.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays

Thanks for the link I think I've got it it figured out and showing the location properly now. I've edited my previous post with the changes.

Yes, that is the proper spot to place it. I think that you might not have replaced the original code properly.


// the upshrink image, right-floated
echo '
<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';
echo '
', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="align_right">' . $settings['site_slogan'] . '</div>', '
</div>
<div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="user">';

// If the user is logged in, display stuff like their name, new messages, etc.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

mmmmm, still not working.

Take a look at my index.template.php and tell me if its right.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Acans

Works perfectly Kays. See for yourself

www.dev.acans.org/2.0
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

had3s

Is there anyway to make this with drop down menus like on this site?

Kays

HI, that's what this is. You'll just need to change the sections to be what you want them to display.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

had3s

Sry but can u explain a lil more, im new to this stuff. I have the links on there were the site slogan was before but cant figure out how to make them drowdown menus.

Advertisement: