Re-assign the Home button

Started by F250SUPERDUTY, April 20, 2011, 10:00:29 PM

Previous topic - Next topic

F250SUPERDUTY

How do I make the HOME button in the header open a new page created in SP. SP added a FORUM button in the header so I would like to re-assign the HOME  button.

ascaland

If you would like to change where the home tab will link users to, in Subs.php look for,
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),

The href element is what you want to change. For example, if the URL was http://mysite.com/index.php?page=mypage, you would change the href to,
'href' => $scripturl . '?page=mypage',

F250SUPERDUTY

getting closer, so thanks so far. I have problems with how to view the script/code??? so changing it is still a puzzle

In SP I set page name asHome, SP set the page ID as 2264. using this info can you give an exact example of what it should look like?

Maybe give me some instructions on how to pull up the code i need to modify?

I know I am asking for a lot but once I get this once, I will not forget how to do it again  :)

ACAMS

The best way is to use your FTP client and navigate to your forum folder/Sources/Subs.php
Download and edit your Subs.php and edit as mentioned above.


Be sure to make a back-up before reuploading and overwriting.

F250SUPERDUTY

#4
Again thanks, I am closer but still not sure

Using this info,
In SP I set page name asHome, SP set the page ID as 2264. using this info can you give an exact example of what it should look like?

that is what I know about the page I created but I don't know what the script shouls look likw when finished. The first reply showed what script/code to modify but I still need to see an example of exactly what it should look like.

Please?

BTT

F250SUPERDUTY

Question: How do I make the HOME button in the header open a new page created in SP. SP added a FORUM button in the header so I would like to re-assign the HOME button.

Response: If you would like to change where the home tab will link users to, in Subs.php look for,
Code: [Select]
         'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
         ),The href element is what you want to change. For example, if the URL was hxxp:mysite.com/index.php?page=mypage [nonactive], you would change the href to,
Code: [Select]
'href' => $scripturl . '?page=mypage',

This did nothing to solve my problem I suspect they thought I knew what to do.
In SP I set page name asHome, SP set the page ID as 2264. using this info can you give an exact example of what it should look like?
Maybe, just a thought    '?page=mypage', should have changed to '?page=2256',

I am really stuck and can't afford another day

Illori

2 topics merged, please only create one topic on each issue.

ACAMS

#7
Here is what my Subs.php looks like.......The top is far left tab, the next is second tab from left, and you may want to copy and edit my 5th one to make your page link.

REMEMBER, I have SimplePortal, so the code may be a little different.





// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
   if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
   {
      $buttons = array(
         'home' => array(
            'title' => $txt['home'],
            'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
            // 'target' => '_blank',
         ),
         'forum' => array(
            'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
            'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
            'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
            'sub_buttons' => array(
            ),
         ),
         'search' => array(
            'title' => $txt['search'],
            'href' => $scripturl . '?action=search',
            'show' => $context['allow_search'],
            'sub_buttons' => array(
            ),
         ),
         'RA2WIKI' => array(
            'title' => 'RA2WIKI',
            'href' => 'http://gametechmods.com/RA2wiki/index.php?title=Main_Page',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),
         'Botexchange' => array(
            'title' => 'BotExchange',
            'href' => 'http://gametechmods.com/forums/index.php/page,page1887.html',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),

F250SUPERDUTY

you continue to confuse me.. I have Simple Portal too thus the SP i used in my explanation. I have no idea what all of the code you provided is about. Please i only need the code to make my simple portal pagenamed home and ID 2264 work when i hit the Home button.

the reason I started a new topic was because I was not geting any response to my latest reply.

Illori

just because you are not getting a reply does not mean you will get any more or better replies with a new thread, it is considered spamming to make more then one thread on the same issue.

Bigguy

Do you have SP in stand alone mod. If so you can use this piece of code. Replace your home button in Subs.php with this:

        $buttons = array(
            'home' => array(
                'title' => $txt['home'],
                'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
                'show' => true,
                'sub_buttons' => array(
                ),
                'is_last' => $context['right_to_left'],
            ),


If that's not it then replacing the 'href' with something like this:

'href' => 'http://www.yoursite.com',

Should work. Take a back up of the file first BEFORE playing with it please. :)

ACAMS

I think he does not understand that he needs to download Sources/Subs.php, edit it and upload it to his server.
There is a way to edit it in SMF, but I forgot what to do and downloading the file is WAY easier and safer.

Bigguy

Yes I think you are right, so:

If you have cpanel then login to it. On the first page you will see a link to a "File Manager" (Not legacy), click on it. This will take you to the Root of your hosting account. Double click on "public_html". After that it would depend on where you installed SMF but if it is in the public_html folder, meaning you should be able to see a file called Settings.php, then navigate to a folder called "Sources" and double click on it. If it is not in the "public_html" folder then navigate to the folder you installed SMF to....maybe a folder called "forum".

Once you are in the Sources folder you want to scroll down and find and single click on the Subs.php file. Once it is highlighted then look to the top of the page you are on and you should see a "download" button, click on that. Save it to your desktop. Now open that folder in a editor like Php Designer or Notepad ++ or something similar. It's a bad idea to use the native notepad editor in Windows as it leaves extra white spaces before the code sometimes.

After it is open use the search feature in the program to search for the code I posted and change it, and save the file. BEFORE uploading it rename the Subs.php file that is still on the server to something unique, then upload the Subs.php file from your desktop to your host. Go to your forum and refresh the page. All should be done after that.

If I have left anything out, someone please correct me but I think that should do it.

Bigguy

#13
To upload the edited file through cpanel, do this:

After the file is edited and saved, you want to navigate back to the Sources folder in the "File Manager" through cpanel. At the top of that page you will see a button called "Upload" click that and a new window (tab) will open. In that new window, click on the "browse" button and navigate to your saved Subs.php file, click on it and it will upload.....NOT overwriting the original because by this time you have already renamed it. :)

Hope this was complete enough and helps out a bit.

F250SUPERDUTY

I don't think you have read my posts very well. I followed the first set of instructions to the T. It didn't change anything. SP is not in standalone it is in front page. I just want the HOME BUTTON to open the page I added in SP. the page name is "HOME" and the ID 2264.
How does  '?page=mypage', equal "HOME" and the ID 2264. as suggested below. All I am asking for is for someone to give me the specific code to make this happen.

The href element is what you want to change. For example, if the URL was hxxp:mysite.com/index.php?page=mypage [nonactive], you would change the href to,

Code: [Select]
'href' => $scripturl . '?page=mypage',


the above did not change anything.

If anyone has a PayPal account, call me at 360-451-7784 and I will pay you to logon my site as admin so you can see what is happening. this method is not getting the message across.

Bigguy

What is the url you are trying to add...get the full url and add it here:

'href' => 'YOUR LINK.com',

http://www.simplemachines.org/community/index.php?topic=430629.msg3023957#msg3023957

busterone

'href' => $scripturl . '?page=2264',

What the previous poster meant by "mypage" was for you to substitute your page url (in this instance id) for "mypage"

T

ACAMS

You should always go to the admin panel and clear the cache every time you make changes to the code.


Try making the edits, then clear the cache and refresh your page .

Advertisement: