adding and changing nav buttons

Started by SNAFU0185, September 20, 2011, 07:26:36 AM

Previous topic - Next topic

SNAFU0185

Hey i followed the instructions from another post on how to add to  and change the existing menu so that the right item is highlighted when selected
Quote from: Krash. on August 06, 2011, 03:51:32 PM

In Subs.php find this:



// 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' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),




Change to this:



/// 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' => 'Home',
'href' => 'http://www.yourdomain.com',
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),


'forum' => array(
'title' => 'Forum',
'href' => $scripturl . '?action=forum',
'show' => true,
'sub_buttons' => array(
),
),




Find this:



// Figure out which action we are doing so we can set the active tab.
// Default to home.
$current_action = 'home';




Change to this:



// Figure out which action we are doing so we can set the active tab.
/// Default to home.
$current_action = 'forum';




obviously i made changes to suit my site but its broken my theme
this is b4 the added button and its working home is selected

this is after the alterations and altough both buttons are there and work the white arrow that points to the page you are on has been broken

any ideas how i fix this please :)

Angelina Belle

Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

No I've been teaching myself to use the hooks in smf and ive created a home page that pulls the header and footer from smf then aplies the same theme so I had the old smf sorted for adding buttons but can't seem to figure the new way with out breaking the theme

Angelina Belle

I am not certain I understand.  Do you make this change directly in Subs.php, or via the integration hook 'integrate_menu_buttons'?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

Ok the main page pulls the header footer and theme from smf the changes to the menu were as above in my first post in the subs.php I'm trying to change the home button to take me to my main page and add a new button called community that takes me to forums. The buttons work but it broke the theme

Ozzie

Quote from: SNAFU0185 on September 28, 2011, 10:17:42 AM
and add a new button called community that takes me to forums.

have you tried using this mod ..ok its for rc 3 but loading it via emulation works as i use it on my site (i presume you are using latest smf)

http://custom.simplemachines.org/mods/index.php?mod=2657

2000+ games available to download

SNAFU0185

#6
Quote from: Ozzie on September 28, 2011, 10:32:50 AM
Quote from: SNAFU0185 on September 28, 2011, 10:17:42 AM
and add a new button called community that takes me to forums.

have you tried using this mod ..ok its for rc 3 but loading it via emulation works as i use it on my site (i presume you are using latest smf)

http://custom.simplemachines.org/mods/index.php?mod=2657
Yea that would let me add extra buttons i spose but doesnt let me rename home to community and put a new button before that  i woulh have resorted to using a pre made portal but i cant seem to get my file atributes rite so smf wont ato install it so i have to manualy edit all the files so i mayas well stumble through it

Ozzie

you could try another mod called menu order it allows you to place the buttons in order and rename/edit them also



this one   http://custom.simplemachines.org/mods/index.php?mod=2348

use this in conjunction with the other it may give you more scope

2000+ games available to download

SNAFU0185

Quote from: Ozzie on September 28, 2011, 06:48:25 PM
you could try another mod called menu order it allows you to place the buttons in order and rename/edit them also



this one   http://custom.simplemachines.org/mods/index.php?mod=2348

use this in conjunction with the other it may give you more scope
thanks Ozzie ill try that later when i get home from work

Ozzie

#9
let me know how you get on


i just had a thought if you wanna try it ...on my site i wanted a flashing arcade button so to do this i made it with the 6 custom button mod as you can add any url to it then added it to my menu then using the menu order mod i hid the original arcade button as that mod also allows you to hide/show buttons maybe thats your way around things

2000+ games available to download

SNAFU0185

i cant use either of those mods since i cant use smf package manager because of bung file permisions. the package manager is the only way to run something via emulation

Angelina Belle

What have you set your file permissions to?
Some hosts get all bent out of shape if you try directories at 777.  They prefer you set them to 755, which should work, too.
Likewise with the files. 644 is preferred, on some hosts.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

i have set them to 777 but it dosent work ill try the others in the morning

Angelina Belle

Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

#14
smf won let me make the changes in the admin section so im gonna use ftp but im not sure what files and directories i need to change
i get this error with the packages dir set to 755
QuoteAn Error Has Occurred!
You cannot download or install new packages because the Packages directory or one of the files in it are not writable
and my server returns an error when i try make files 644
doesnt seem to matter what i change them to it still says
QuoteAn Error Has Occurred!
You cannot download or install new packages because the Packages directory or one of the files in it are not writable!
maybe its just tiny portal that im trying to install

SNAFU0185

ok made some progress found out for some reason filezilla wasnt changing file permissions on the hunt for a better ftp

Ozzie

Quote from: SNAFU0185 on October 02, 2011, 07:53:37 PM
ok made some progress found out for some reason filezilla wasnt changing file permissions on the hunt for a better ftp

if its a free ftp you want core is quite good as a freebie  http://www.coreftp.com/

2000+ games available to download

SNAFU0185

what do i put in the advanced window to tel it to run as rc3
cause i installed it and cant find the mod

Illori

does your host offer a file manager? you should be able to use that to set your chmod. you could also ask your host to look into it for you, could be an ownership issue and that you can not fix.

SNAFU0185

Quote from: Illori on October 02, 2011, 08:21:30 PM
does your host offer a file manager? you should be able to use that to set your chmod. you could also ask your host to look into it for you, could be an ownership issue and that you can not fix.
yea thats what i used thanks just ftp is easyer

Ozzie

Quote from: SNAFU0185 on October 02, 2011, 08:15:15 PM
what do i put in the advanced window to tel it to run as rc3
cause i installed it and cant find the mod
i presume you on about in package manager ..you should put  SMF 2.0RC3 then hit apply

2000+ games available to download

SNAFU0185

Quote from: Ozzie on October 02, 2011, 08:31:48 PM
Quote from: SNAFU0185 on October 02, 2011, 08:15:15 PM
what do i put in the advanced window to tel it to run as rc3
cause i installed it and cant find the mod
i presume you on about in package manager ..you should put  SMF 2.0RC3 then hit apply
i didnt put that now i have to manualy uninstall

SNAFU0185


Angelina Belle

Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Ozzie

Quote from: SNAFU0185 on October 02, 2011, 10:57:37 PM
i installed 6custombuttons05.zip it didnt work


when you say it did not work..what do you mean ??

did you set all the permissions in admin that mod as its own permission set in admin you gotta set it to who can view etc etc

2000+ games available to download

SNAFU0185

The picture that was on the mod site seemed to sugest that the options where in the package manager under mod settings are they somewhere else?

Ozzie

yes that is correct the settings for it are in admin /configuration /modification settings if it installed correctly   and the settings for who can view and which button tab etc they can view are in admin / members/permissions...


when you said it did not work did it install? I.E is it showing in the mod list in package manager?

2000+ games available to download

SNAFU0185

It showed in the package manager and said it installed corectly but the only settings il see are for my facebook mod nothing shows up there for that mod

Angelina Belle

This sounds like the mod did not actually install correctly. When you did the install with package manager, did you get "test successful" for all of the files?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

 yep all tested ok i wont install a mod unless all tests ok. But something obviously not right because when i looked to uninstall it showed up all bad. im not sure whats up

Angelina Belle

Sounds like the package manager couldn't actually manage some of the steps, but didn't realize it.
Could be a CHMOD or CHOWN problem.  I'll try to help you more with this tomorrow.  I'm sorry I won't have more time today.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

#31
Many thanks I have manually removed it in the mean time including removing it from the database in the packages log. This issue Is probably why I was unable to install tiny portal in the beginning

Angelina Belle

Out of curiosity -- what did you find that needed to be removed? Were all of the file edits there?

And before you removed it, you never saw the "Custom buttons settings" tab for the "Modification Settings" page?
http://custom.simplemachines.org/mods/index.php?action=download;mod=2657;id=152688;image
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

#33
no the only mod showing in there was the facebook mod i have. and all i did to remove it was upload my backed up files and the edit the database and from memory when i tried to remove it in the package manager only the first 2 edits showed ok the rest was broken

Angelina Belle

Package manager probably could have managed the uninstall.
I think the most likely reason for the partial install is a permission or file ownership problem.

Let's go after file permission first.  Who is your host?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

Quote from: AngelinaBelle on October 06, 2011, 08:55:10 AM
Package manager probably could have managed the uninstall.
I think the most likely reason for the partial install is a permission or file ownership problem.

Let's go after file permission first.  Who is your host?
Expert Web Services

Illori

doing a search for "Expert Web Services" does not show a webhost, are you sure that is your hosts name? do you have a link to their website?

SNAFU0185

they run a business putting stabilised satilite dishes on boats etc the owner provideds me hosting in one of his server farms as a favour

Angelina Belle

I'm not familiar with that host.  I don't know whether they user suexec or not.
But I do hear you saying that Package Manager managed the required edits (http://custom.simplemachines.org/mods/index.php?action=parse;mod=2657;attach=155222;smf_version=2.0_RC3) in some of your files, but not in others

So let's do  a little digging and see if we can't find out why.
Please check the owner and file permissions of one of the files you just edited manually.  If you uploaded the file via FTP, then you can use FTP to give you a directory listing, using ftp's dir command. For example, dir index.php will show you the owner of index.php Did you use FTP or the Cpanel to upload the file there? If so, it should belong to you -- the same username you use to log in to ftp.
Who is the owner? what are the file permissions?

Next, please check the owner and file permissions of one of the files that Package Manager didn't manage to edit. Who is the owner? What are the file permission?

Finally, please check the ownership of a file that was created via the webserver. go to the attachments directory and dir. You'll see a bunch of files with funny names. Who is the owner of these files?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

Ok i know how toi check the atributes or permissions but how do il check who owns it?

Angelina Belle

Your ftp client should have some way to show that to you.
If you use the command-line FTP client, you can use the ls command, for example.
The windows built-in FTP client does not want to show you this at all.
And, for other FTP clients, you'd need to check your documentation.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

#41
i cant find anyway to check ownership i asume since i uploaded em i do but meh what do i know and cant find and way to do anythink u ask in ftp
whats a good command line ftp and what dow i type to cheack ownership


Illori

ask your host to check ownership, not all server configurations allow the users to check it.

SNAFU0185

dont know how acurate this is but accourding to filezilla all files on the server are owned buy ftp

Illori

your files should not be owned by ftp they should be owned by your user, ask your host to verify the ownership

SNAFU0185

ok i manualy edited the files for the button mod and it breaks my theme to

Illori


Angelina Belle

(I am partial to the command-line ftp in windows' "Command Prompt")
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

Quote from: Illori on October 17, 2011, 09:18:28 AM
breaks it in what way?

Quote from: SNAFU0185 on September 20, 2011, 07:26:36 AM

refering to the above picture it inserts the button i asked for after help. When i click on it it goes to the selected page butit highlights the homw button and the arrow apears above the home button

Illori

since you are using a mod to add the buttons you should post in the mods support thread to see if there is a way to fix this.

Angelina Belle

First, please double-check the edits you have made. In Subs.php, in function  setupMenuContext there are two important parts.
First, there is the part, starting with $buttons = array(, where the buttons are defined.

Then, there is the part, starting with    // Figure out which action we are doing so we can set the active tab., where it figures out which button needs to be active. That mod needs to deal with both of these sections.

Now that you are actually using the mod, I think you will get better help from the mod's author and users than you will from us.

I hope you figure out how to solve your problem installing mods.  The Package Manager is so much more convenient than doing manual installations.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

SNAFU0185

Yea it would be good I've always had issues with this server and permissions on files. But thanks for all of the help you and the other members have offered me I'll maybe chase support from the author but even then ultimately I think I'd be better of running tiny portal if I could get it to install I may manually install it just to get it running

Angelina Belle

I think the problem may be that you left out an essential edit from this mod -- the part that sets the active button.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Advertisement: