55
XOOPS needs work in terms of speed and load especially when the amount of visitors increase.
I have a site that gets around 1M pageviews a month and I've done a lot of work on the backend to speed it up and minimize server resources.
Something that I saw as a big saving is putting the menus in your theme. If you dont install modules very often, it works just fine.
<{if $xoops_isuser}>
<div class="blockTitle">My Account</div>
<div class="blockContent">
<table cellspacing="0">
<tr>
<td id="usermenu">
<a class="menuTop" href="<{$xoops_url}>/user.php">Account</a>
<a href="<{$xoops_url}>/notifications.php">Notifications</a>
<{php}>
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
<{/php}>
<{if $msgcount > 0}>
<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>
<{if $xoops_isadmin}>
<a href="<{$xoops_url}>/admin.php">Admin CP</a>
<{/if}>
</td></tr></table></div>
<{else}>
<div class="blockTitle">Login</div>
<div class="blockContent">
<form style="margin-top: 0px;" action="<{$xoops_url}>/user.php" method="post">
Username<br />
<input type="text" name="uname" size="12" value="<{$unamevalue}>" maxlength="25" /><br />
Password<br />
<input type="password" name="pass" size="12" maxlength="32" /><br />
<input type="checkbox" name="rememberme" value="On" class ="formButton" checked />remember me<br />
<input type="hidden" name="xoops_redirect" value="<{$xoops_requesturi}>" />
<input type="hidden" name="op" value="login" />
<input type="submit" value="Login" /><br />
</form>
<br />
<a href="<{$xoops_url}>/user.php#lost">Lost Password?</a><br />
<a href="<{$xoops_url}>/register.php">Register now!</a>
</div>
<{/if}>
<{foreach item=block from=$xoops_lblocks}>
<div class="blockTitle"><{$block.title}></div>
<div class="blockContent"><{$block.content}></div>
<{/foreach}>
<div class="blockTitle">Main</div>
<div class="blockContent"><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td id="mainmenu">
<a class="menuTop" href="<{$xoops_url}>">Home</a>
<a class="menuTop" href="<{$xoops_url}>">Blah</a>
<{if $cmodule == 'blah'}>
<a class="menuSub" href="blah2url">Blah Sub</a>
<a class="menuSub" href="blah2url">Blah Sub</a>
<{/if}>
</td>
</tr>
</table>
</div>
Then to detect which module it is,
stick this in header.php
$cmodule = isset($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : "system";
$xoopsTpl->assign('cmodule', $cmodule);
If you have caching enabled for a module, it wont work, but to get around that.
Put $xoopsTpl->assign('cmodule', 'modname'); in the actual files for the module.
I foudn this as good way to speed up XOOPS