DennisHermannsen Posted May 14, 2013 Share Posted May 14, 2013 Hi again! I'm working on a new template for our site, and I figured that it would be nice for clients to see the server status as soon as they log in (we'll be removing the server status page at some point), but whenever I try to include it into the clientareahome.tpl file, it does show up, but it gives NO info at all, other than "No Servers are currently being monitored", but that only shows up if I doesn't include {if $servers} {include file="$template/subheader.tpl" title=$LANG.serverstatustitle} <p>{$LANG.serverstatusheadingtext}</p> <br /> {literal} <script> function getStats(num) { jQuery.post('serverstatus.php', 'getstats=1&num='+num, function(data) { jQuery("#load"+num).html(data.load); jQuery("#uptime"+num).html(data.uptime); },'json'); } function checkPort(num,port) { jQuery.post('serverstatus.php', 'ping=1&num='+num+'&port='+port, function(data) { jQuery("#port"+port+"_"+num).html(data); }); } </script> {/literal} Any idea what I might have to do? 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted May 15, 2013 Author Share Posted May 15, 2013 Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
synik4l Posted May 16, 2013 Share Posted May 16, 2013 if you dont include what? 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted May 16, 2013 Author Share Posted May 16, 2013 If I don't include the code above. The serverstatus.tpl is looking like this: {include file="$template/pageheader.tpl" title=$LANG.networkstatustitle desc=$LANG.networkstatusintro} <div class="alert alert-block alert-warning"> <p class="textcenter fontsize3"> <a href="{$smarty.server.PHP_SELF}?view=open" class="networkissuesopen">{$opencount} {$LANG.networkissuesstatusopen}</a> <a href="{$smarty.server.PHP_SELF}?view=scheduled" class="networkissuesscheduled">{$scheduledcount} {$LANG.networkissuesstatusscheduled}</a> <a href="{$smarty.server.PHP_SELF}?view=resolved" class="networkissuesclosed">{$resolvedcount} {$LANG.networkissuesstatusresolved}</a> </p> </div> {foreach from=$issues item=issue} {if $issue.clientaffected}<div class="alert-message block-message alert-warning">{/if} <h3>{$issue.title} ({$issue.status})</h3> <p><strong>{$LANG.networkissuesaffecting} {$issue.type}</strong> - {if $issue.type eq $LANG.networkissuestypeserver}{$issue.server}{else}{$issue.affecting}{/if} | <strong>{$LANG.networkissuespriority}</strong> - {$issue.priority}</span></p> <br /> <blockquote> {$issue.description} </blockquote> <p><strong>{$LANG.networkissuesdate}</strong> - {$issue.startdate}{if $issue.enddate} - {$issue.enddate}{/if}</p> <p><strong>{$LANG.networkissueslastupdated}</strong> - {$issue.lastupdate}</p> {if $issue.clientaffected}</div>{/if} {foreachelse} <p class="textcenter"><strong>{$noissuesmsg}</strong></p> {/foreach} <div class="pagination"> <ul> <li class="prev{if !$prevpage} disabled{/if}"><a href="{if $prevpage}{$smarty.server.PHP_SELF}?{if $view}view={$view}&{/if}page={$prevpage}{else}javascript:return false;{/if}">← {$LANG.previouspage}</a></li> <li class="next{if !$nextpage} disabled{/if}"><a href="{if $nextpage}{$smarty.server.PHP_SELF}?{if $view}view={$view}&{/if}page={$nextpage}{else}javascript:return false;{/if}">{$LANG.nextpage} →</a></li> </ul> </div> {if $servers} {include file="$template/subheader.tpl" title=$LANG.serverstatustitle} <p>{$LANG.serverstatusheadingtext}</p> <br /> {literal} <script> function getStats(num) { jQuery.post('serverstatus.php', 'getstats=1&num='+num, function(data) { jQuery("#load"+num).html(data.load); jQuery("#uptime"+num).html(data.uptime); },'json'); } function checkPort(num,port) { jQuery.post('serverstatus.php', 'ping=1&num='+num+'&port='+port, function(data) { jQuery("#port"+port+"_"+num).html(data); }); } </script> {/literal} <div class="center80"> <table class="table table-striped table-framed"> <thead> <tr> <th>{$LANG.servername}</th> <th class="textcenter">HTTP</th> <th class="textcenter">FTP</th> <th class="textcenter">POP3</th> <th class="textcenter">{$LANG.serverstatusphpinfo}</th> <th class="textcenter">{$LANG.serverstatusserverload}</th> <th class="textcenter">{$LANG.serverstatusuptime}</th> </tr> </thead> <tbody> {foreach from=$servers key=num item=server} <tr> <td>{$server.name}</td> <td class="textcenter" id="port80_{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /></td> <td class="textcenter" id="port21_{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /></td> <td class="textcenter" id="port110_{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /></td> <td class="textcenter"><a href="{$server.phpinfourl}" target="_blank">{$LANG.serverstatusphpinfo}</a></td> <td class="textcenter" id="load{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /></td> <td class="textcenter" id="uptime{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /><script> checkPort({$num},80); checkPort({$num},21); checkPort({$num},110); getStats({$num}); </script></td> </tr> {foreachelse} <tr> <td colspan="7">{$LANG.serverstatusnoservers}</td> </tr> {/foreach} </tbody> </table> </div> {/if} {if $loggedin}<p>{$LANG.networkissuesaffectingyourservers}</p>{/if} <br /> <p align="right"><img src="images/rssfeed.gif" alt="RSS" align="absmiddle" /> <a href="networkissuesrss.php">{$LANG.announcementsrss}</a></p> <br /> I can't get it to work. 0 Quote Link to comment Share on other sites More sharing options...
synik4l Posted May 16, 2013 Share Posted May 16, 2013 (edited) I tried it. And couldnt get it to work either. it looks like the $servers variable has nothing in it. Like for some reason on that page it doesnt get that information. Not sure how to fix it at this moment. Edited May 16, 2013 by synik4l 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted May 16, 2013 Author Share Posted May 16, 2013 If I create a whole new template and call it test.tpl which I include i test.php, nothing shows up when visiting test.php - nothing at all! 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted May 17, 2013 Share Posted May 17, 2013 If I create a whole new template and call it test.tpl which I include i test.php, nothing shows up when visiting test.php - nothing at all! That would be expected, the server status information is only available in the server status php/tpl 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted May 17, 2013 Author Share Posted May 17, 2013 So it isn't possible for me to include it in clientareahome.tpl? 0 Quote Link to comment Share on other sites More sharing options...
shovenose Posted May 17, 2013 Share Posted May 17, 2013 I would love to do this as well... if there are any server issues affecting that client show it in the client area. 0 Quote Link to comment Share on other sites More sharing options...
And then there was one les Posted May 18, 2013 Share Posted May 18, 2013 (edited) This wont work how you expect it to. If you did manage to include the server status pages into another page you would find you have extra headers and footers in the container for it. This is because the file being accessed on the server status page is serverstatus.php which uses a complete template set of header body and footer. basically what you would end up with is a complete page, within a complete page. definitely not the desired affect. If you want to include it in another page you will need to speak to the whmcs team to see if they can put together a modified version of the file that does not take the header or footer. Once you have this, Create a new hook file and use an include on that php file instead, from there you simply assign the contents to a smarty variable to be used on the page you want to create the container. I can see no valid reason for this to be quite honest. You can just make a hook that will do what you need and check if there is a client affecting issue, If there is you can then automatically redirect them to the server status page. Edited May 18, 2013 by CDJ Hosting 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.