View Full Version : Further Explanaton PHP/SSI
Excuse my ignorance on this, but maybe I could be further enlightened on how to add a SSI/PHP file for a module. I've done the following:
I've created the PHP file to be used by the module and placed it in /forum/modules folder:
<?php
require_once "/path/to/myfile.php";
BigShow("http://domain_name.com/path/to/rss/feed/file");
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('your_template_name_here') . '";');
?>
I've then procreeded to build a template "your_template_name_here" and added a new module that includes the php file and the template.
The results places the output at the top of the page. How do I place the output within the moudule at the right place?
Shack Networks
06-15-2004, 03:41 PM
Yeah I am having the same problem with a Thales IRC intergration script. Any ideas on how to get it to go where it should ?
H
Brian
06-15-2004, 03:46 PM
It sounds like your file is echoing the output. You'll probably need to search the file for 'echo' and replace all occurances with:
$varaible .=
Then add $variable to the new template you created where you would like the output from the file to appear. You can of course change 'variable' to whatever you'd like, just be sure it's the same in the file and template.
Thanks Brian... I will try this tonight... by the way you've got my vote! I've come over from using PHPNuke for a few years and so far found the vB community to be heads up better to work with.
Shack Networks
06-15-2004, 04:49 PM
OK I now little about PHP coding but I am learning slowly, can you give me some directions on what to do with this file :)
<?
// version 1.3
// setup database
$dbuser = ""; // database user
$dbpass = ""; // database password
$dbserver = "localhost"; // database server (usually localhost)
$dbname = ""; // database name
// end of config
function connectDb($user, $pass, $host, $db) {
//this function connects to a mysql server
$sock = mysql_connect($host, $user, $pass);
//this function connects to a mysql database, once a server has been reached.
if(isset($sock)) {
if(!mysql_select_db($db, $sock)) {
echo mysql_error();
}
}
return $sock;
}
function cmp($a, $b) {
return strcmp(strtolower($a), strtolower($b));
}
if (!isset($_GET['chan'])){
$variable irc.users= "<td class=\"vbmenu_control\">Channel</td><td class=\"vbmenu_control\">Users</td><td class=\"vbmenu_control\">Topic</td></tr><td colspan=\"3\" class=\"alt1\">Top 10 IRC Channels</td></tr>"; // header
connectDb($dbuser, $dbpass, $dbserver, $dbname);
// START CHANNEL,NUMBER OF USERS ON CHANNEL,CHANNEL TOPIC
$result = mysql_query("SELECT channel, topic, COUNT(*) AS user_count FROM chan, ison WHERE chan.chanid = ison.chanid AND chan.mode_ls='N' AND chan.mode_lp='N' GROUP BY channel ORDER BY user_count DESC LIMIT 10;"); // query the db
$color1 = "alt1"; // setup alternate row colouring
$color2 = "alt2"; // "
while ($row = mysql_fetch_array($result)) { // loop till all results processed
$row_color = ($row_count % 2) ? $color1 : $color2;
echo "<td class=\"$row_color\"><a href=\"?chan=".substr($row['channel'],1)."\">".$row['channel']."</a></td>";
echo "<td class=\"$row_color\">".$row['user_count']."</td>";
echo "<td class=\"$row_color\">".$row['topic']."</td></tr>";
$row_count++;
}
mysql_close();
}
// END
// START DETAILED CHANNEL INFO
if (isset($_GET['chan'])){
echo "<table class=\"tborder\" width=\"100%\" align=\"center\"><tr align=\"middle\"><td class=\"vbmenu_control\" colspan=\"3\">Channel Information for #".$_GET['chan']."</td>";
echo "<tr><td class=\"alt1\">Channel Name: </td>";
echo "<td class=\"alt1\">#".$_GET['chan']."</td></tr>";
connectDb($dbuser, $dbpass, $dbserver, $dbname);
$properchan = "#".$_GET['chan'];
$result = mysql_query("SELECT channel, topic, topicauthor, topictime FROM chan WHERE chan.channel='$properchan' AND chan.mode_ls='N' AND chan.mode_lp='N'"); // query the db
if(!$row = mysql_fetch_array($result)){
exit();
}
echo "<tr><td class=\"alt2\">Topic: </td>";
echo "<td class=\"alt2\">".$row['topic']."</td></tr>";
echo "<tr><td class=\"alt1\">Set By: </td>";
if (!$row['topicauthor']){
echo "<td class=\"alt1\"></td></tr>";
} else {
echo "<td class=\"alt1\">".$row['topicauthor']." on ".$row['topictime']."</td></tr>";
}
echo "<tr><td class=\"alt1\">Users In Channel: </td><td class=\"alt1\">";
$whoinchan = mysql_query("SELECT nick, ison.mode_lh, ison.mode_lo, ison.mode_lv FROM user, ison, chan WHERE chan.channel = '$properchan' AND ison.chanid = chan.chanid AND ison.nickid = user.nickid ORDER BY nick");
$oplist=array();
$hoplist=array();
$voplist=array();
$userlist=array();
while ($row = mysql_fetch_array($whoinchan)) { // loop till all results processed
if ($row['mode_lo']=="Y") {
$oplist[]="@".$row['nick']."<br>";
} else {
if ($row['mode_lh']=="Y") {
$hoplist[]="%".$row['nick']."<br>";
} else {
if ($row['mode_lv']=="Y") {
$voplist[]="+".$row['nick']."<br>";
} else {
$userlist[]=$row['nick']."<br>";
}
}
}
}
usort($oplist, "cmp");
usort($hoplist, "cmp");
usort($voplist, "cmp");
usort($userlist, "cmp");
foreach($oplist as $user){
echo "<font color=\"blue\">$user</font>";
}
foreach($hoplist as $user){
echo "<font color=\"green\">$user</font>";
}
foreach($voplist as $user){
echo "<font color=\"orange\">$user</font>";
}
foreach($userlist as $user){
echo $user;
}
echo "</table></body></html>";
mysql_close();
}
///END
?>
Thanks in advance
Brian
06-16-2004, 12:28 PM
It sounds like your file is echoing the output. You'll probably need to search the file for 'echo' and replace all occurances with:
$varaible .=
Then add $variable to the new template you created where you would like the output from the file to appear. You can of course change 'variable' to whatever you'd like, just be sure it's the same in the file and template.
That looks like a teamspeak block. I have modified my teamspeak block to work with VBAdvanced, VBPorta and VBIndex. If you would like more info just head on over to http://www.nosquad.com.
Kesomir
07-10-2004, 08:37 PM
jugo, I'd be interested in a teamspeak block (at least until vbwar is out) but your site is now closed...
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.