News:

Wondering if this will always be free?  See why free is better.

Main Menu

Content Management System

Started by atokar, December 15, 2009, 07:08:20 PM

Previous topic - Next topic

MarcusJ

This is a really nice mod.  I'm going to use it on my next project.

Thank you for coding it.

Jirsh

Installed the mod; it took away buttons from my menu but that is to be expected. I want to add a button on the menu called "Gaming" and that drops down and has buttons for "Chess" and "Arcade" mods and so forth. How would I do that. Every time I try to add something it gives an error and I have to undo it. Thanks in advance.

MarcusJ

Quote from: Jirsh on April 05, 2010, 12:20:52 PM
Installed the mod; it took away buttons from my menu but that is to be expected. I want to add a button on the menu called "Gaming" and that drops down and has buttons for "Chess" and "Arcade" mods and so forth. How would I do that. Every time I try to add something it gives an error and I have to undo it. Thanks in advance.

There is a tutorial on how to add tabs posted here.

Good luck.

Jirsh

Thanks for the link but I am still not getting it. For example...

I want a gaming button dropdown; the gaming button itself can just point back to the index if clicked or something like that. Then I want the following two buttons on the dropdown for gaming; these snippets pulled from my subs.php


                  'arcade' => array(
            'title' => $txt['arcade'],
            'href' => $scripturl . '?action=arcade',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),

and


         'chess' => array(
            'title' => $txt['SMFChess'],
            'href' => $scripturl . '?action=chess',
            'show' => $context['allow_chess'],
            'sub_buttons' => array(
            ),
         ),

anytime i try it myself; the site breaks so I must be doing something wrong

Arantor

So can you post the full code you're trying please (with those bits added)?
Holder of controversial views, all of which my own.


Jirsh


'gaming' => array(
'title' => $txt['Gaming'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'arcade' => array(
        'title' => $txt['arcade'],
        'href' => $scripturl . '?action=arcade',
        'show' => true,
),
            'chess' => array(
        'title' => $txt['SMFChess'],
        'href' => $scripturl . '?action=chess',
        'show' => $context['allow_chess'],
),
),

Arantor

Alright, so fixing the indentation to make it easier to see any problems...

'gaming' => array(
'title' => $txt['Gaming'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'arcade' => array(
        'title' => $txt['arcade'],
        'href' => $scripturl . '?action=arcade',
        'show' => true,
),
'chess' => array(
'title' => $txt['SMFChess'],
'href' => $scripturl . '?action=chess',
'show' => $context['allow_chess'],
),
),


Looks alright to me.. so what about the *rest* of the code?
Holder of controversial views, all of which my own.


luismanson

can someone explain whats the issue with prettyURLs ? maybe there is a way to avoid it

Jirsh

Parse error: syntax error, unexpected ';', expecting ')'  in /smf2/Sources/Subs.php on line 4374

Using the previous snippet in the attached subs.php

Arantor

Quote from: luismanson on April 06, 2010, 03:11:20 PM
can someone explain whats the issue with prettyURLs ? maybe there is a way to avoid it

The fact that both mods rewrite .htaccess in the forum root. Making them co-exist is troublesome at best.

Jirsh: As I suspected, code has been inserted in the wrong place. The full buttons code - which is what I asked for - should be:

$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),         
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'],
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'],
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => true,
'is_last' => true,
),
),
),
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),
'account' => array(
'title' => $txt['account'],
'href' => $scripturl . '?action=profile;area=account',
'show' => allowedTo(array('profile_identity_any', 'profile_identity_own', 'manage_membergroups')),
),
'profile' => array(
'title' => $txt['forumprofile'],
'href' => $scripturl . '?action=profile;area=forumprofile',
'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
'is_last' => true,
),
),
),
'gaming' => array(
'title' => $txt['Gaming'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'arcade' => array(
'title' => $txt['arcade'],
'href' => $scripturl . '?action=arcade',
'show' => true,
),
'chess' => array(
'title' => $txt['SMFChess'],
'href' => $scripturl . '?action=chess',
'show' => $context['allow_chess'],
),
),
),
'pm' => array(
'title' => $txt['pm_short'],
'href' => $scripturl . '?action=pm',
'show' => $context['allow_pm'],
'sub_buttons' => array(
'pm_read' => array(
'title' => $txt['pm_menu_read'],
'href' => $scripturl . '?action=pm',
'show' => allowedTo('pm_read'),
),
'pm_send' => array(
'title' => $txt['pm_menu_send'],
'href' => $scripturl . '?action=pm;sa=send',
'show' => allowedTo('pm_send'),
'is_last' => true,
),
),
),
'calendar' => array(
'title' => $txt['calendar'],
'href' => $scripturl . '?action=calendar',
'show' => $context['allow_calendar'],
'sub_buttons' => array(
'view' => array(
'title' => $txt['calendar_menu'],
'href' => $scripturl . '?action=calendar',
'show' => allowedTo('calendar_post'),
),
'post' => array(
'title' => $txt['calendar_post_event'],
'href' => $scripturl . '?action=calendar;sa=post',
'show' => allowedTo('calendar_post'),
'is_last' => true,
),
),
),
// Aeva Media changes
'media' => array(
'title' => (isset($txt['aeva_gallery']) ? $txt['aeva_gallery'] : 'Media') . (!allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? '' : ' [<b>' . $user_info['aeva_unseen'] . '</b>]'),
'href' => $scripturl . '?action=media',
'show' => allowedTo('aeva_access'),
'sub_buttons' => !allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? array() : array(
'aeva_home' => array(
'title' => $txt['aeva_home'],
'href' => $scripturl . '?action=media',
'show' => true,
),
'aeva_unseen' => array(
'title' => $txt['aeva_unseen'],
'href' => $scripturl . '?action=media;sa=unseen',
'show' => true,
),
),
),
// End Aeva Media changes

// [Links button]
'links' => array(
'title' => $txt['smflinks_menu'],
'href' => $scripturl . '?action=links',
'show' => $context['allow_view_smflinks'],
'icon' => '',
),

// [Downloads] button
'downloads' => array(
'title' => $txt['downloads_menu'],
'href' => $scripturl . '?action=downloads',
'show' => $context['allow_downloads_view'],
'icon' => '',
),

// [Contact Page] button
'contact' => array(
'title' => $txt['smfcontact_contact'],
'href' => $scripturl . '?action=contact',
'show' => $context['allow_view_contact'],
'icon' => '',
), 
'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=mlist',
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
'mlist_view' => array(
'title' => $txt['mlist_menu_view'],
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
'is_last' => true,
),
),
),
'chat' => array(
'title' => $chatButton,
'href' => $chatLink,
'show' => true,
'sub_buttons' => array(
),
),
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;%1$s=%2$s',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
);


The code was broken when you added those buttons by adding them in the wrong place - though in the case of the CMS mod buttons are added to the CMS configuration not to Subs.php directly (normally, at least that's how it was originally when I reviewed/approved this mod)
Holder of controversial views, all of which my own.


Jirsh

Yea I guess i got sidetracked when a previous poster posted a link to adding buttons using subs.php which is what i was going by and basically bypassing cms. But I would like to use cms. Would the code you just gave me be what I use with cms or....

luismanson

Quote from: Jirsh on April 06, 2010, 03:52:52 PM
Parse error: syntax error, unexpected ';', expecting ')'  in /smf2/Sources/Subs.php on line 4374

Using the previous snippet in the attached subs.php

there is a fix for a mod to redirect error pages wich breaks with prettyurls, maybe this could help us

luismanson

Ok...so i removed the .htaccess from the package, to prevent overwriting the one on prettyurls, then added the line mannualy
at the end of "rules for: actions"

and seems to be working

Jirsh

Quote from: Arantor on April 06, 2010, 04:23:35 PM
Quote from: luismanson on April 06, 2010, 03:11:20 PM
can someone explain whats the issue with prettyURLs ? maybe there is a way to avoid it

The fact that both mods rewrite .htaccess in the forum root. Making them co-exist is troublesome at best.

Jirsh: As I suspected, code has been inserted in the wrong place. The full buttons code - which is what I asked for - should be:

$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),         
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'],
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'],
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => true,
'is_last' => true,
),
),
),
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),
'account' => array(
'title' => $txt['account'],
'href' => $scripturl . '?action=profile;area=account',
'show' => allowedTo(array('profile_identity_any', 'profile_identity_own', 'manage_membergroups')),
),
'profile' => array(
'title' => $txt['forumprofile'],
'href' => $scripturl . '?action=profile;area=forumprofile',
'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
'is_last' => true,
),
),
),
'gaming' => array(
'title' => $txt['Gaming'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'arcade' => array(
'title' => $txt['arcade'],
'href' => $scripturl . '?action=arcade',
'show' => true,
),
'chess' => array(
'title' => $txt['SMFChess'],
'href' => $scripturl . '?action=chess',
'show' => $context['allow_chess'],
),
),
),
'pm' => array(
'title' => $txt['pm_short'],
'href' => $scripturl . '?action=pm',
'show' => $context['allow_pm'],
'sub_buttons' => array(
'pm_read' => array(
'title' => $txt['pm_menu_read'],
'href' => $scripturl . '?action=pm',
'show' => allowedTo('pm_read'),
),
'pm_send' => array(
'title' => $txt['pm_menu_send'],
'href' => $scripturl . '?action=pm;sa=send',
'show' => allowedTo('pm_send'),
'is_last' => true,
),
),
),
'calendar' => array(
'title' => $txt['calendar'],
'href' => $scripturl . '?action=calendar',
'show' => $context['allow_calendar'],
'sub_buttons' => array(
'view' => array(
'title' => $txt['calendar_menu'],
'href' => $scripturl . '?action=calendar',
'show' => allowedTo('calendar_post'),
),
'post' => array(
'title' => $txt['calendar_post_event'],
'href' => $scripturl . '?action=calendar;sa=post',
'show' => allowedTo('calendar_post'),
'is_last' => true,
),
),
),
// Aeva Media changes
'media' => array(
'title' => (isset($txt['aeva_gallery']) ? $txt['aeva_gallery'] : 'Media') . (!allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? '' : ' [<b>' . $user_info['aeva_unseen'] . '</b>]'),
'href' => $scripturl . '?action=media',
'show' => allowedTo('aeva_access'),
'sub_buttons' => !allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? array() : array(
'aeva_home' => array(
'title' => $txt['aeva_home'],
'href' => $scripturl . '?action=media',
'show' => true,
),
'aeva_unseen' => array(
'title' => $txt['aeva_unseen'],
'href' => $scripturl . '?action=media;sa=unseen',
'show' => true,
),
),
),
// End Aeva Media changes

// [Links button]
'links' => array(
'title' => $txt['smflinks_menu'],
'href' => $scripturl . '?action=links',
'show' => $context['allow_view_smflinks'],
'icon' => '',
),

// [Downloads] button
'downloads' => array(
'title' => $txt['downloads_menu'],
'href' => $scripturl . '?action=downloads',
'show' => $context['allow_downloads_view'],
'icon' => '',
),

// [Contact Page] button
'contact' => array(
'title' => $txt['smfcontact_contact'],
'href' => $scripturl . '?action=contact',
'show' => $context['allow_view_contact'],
'icon' => '',
), 
'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=mlist',
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
'mlist_view' => array(
'title' => $txt['mlist_menu_view'],
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
'is_last' => true,
),
),
),
'chat' => array(
'title' => $chatButton,
'href' => $chatLink,
'show' => true,
'sub_buttons' => array(
),
),
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;%1$s=%2$s',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
);


The code was broken when you added those buttons by adding them in the wrong place - though in the case of the CMS mod buttons are added to the CMS configuration not to Subs.php directly (normally, at least that's how it was originally when I reviewed/approved this mod)

Ok, so I am trying to use CMS to make these changes instead of messing with the subs.php file. I go to CMS admin, edit menu, make any change and once I click save i get:

Fatal error: Call to undefined function: file_put_contents() in /hsphere/local/home/xxx/xxx.com/smf2/Sources/ContentManagementAdmin.php on line 230

Arantor

Jirsh: That means your server administrator has disabled that function and that you won't be able to do it using the interface. It may be possible to do it manually however I don't remember how the mod functions.

Hopefully the author will comment.
Holder of controversial views, all of which my own.


Jirsh

I have spoke with the host and they verified the function is enabled...

Arantor

Oh really? They're either using PHP 4 then (in which case they lied to you about it being available in the first place), or they're using PHP 5 with the function disabled (in which case they're still lying)

What version of PHP is on the server?
Holder of controversial views, all of which my own.


Jirsh

4.4.9 :(

How would I do this then since obviously I cant use CMS?

Arantor

You could ask your host to upgrade to a version of PHP that isn't out of date by more than 2 years.
Holder of controversial views, all of which my own.


Jirsh

They wont. All I want to do is edit the menu and just to consolidate it at that.

I want a gaming dropdown with the chess and arcade buttons and later a media dropdown for gallery and downloads. I appreciate the patience and help.

Advertisement: