Author |
Message |
tonydg
Hangin' Around

Joined: Jul 16, 2003
Posts: 26
|
Posted:
Tue Aug 12, 2003 10:30 pm |
|
Raven,
I.m still trying to get his table.pho to execute one set of fungtions if the forums module is callled and another set if anything else is called.
Problem is I must have a syntax error in that it doesen't call the second set of functions after the "else" in line 25.
Code:?php
if ($module == $forums){
function OpenTable() {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" ><tr><td class=>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable() {
echo "</td></tr></table></td></tr></table>\n";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"><tr><td class=nothing>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
end;
}
} else {
function OpenTable() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" width=\"100%\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\"> </td>
<td bgcolor=\"fffcd9\" width=\"100%\">";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\" width=\"100%\"><tr>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\"> </td>
<td bgcolor=\"fffcd9\">";
}
function CloseTable() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\"> </td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
}
function CloseTable2() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\"> </td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
}
}
?>
|
all teh table functions work great separately but I can't get the if....else code to work.
Thanks
Tony |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Tue Aug 12, 2003 10:49 pm |
|
In line 22 you have
end;
php doesn't like that  |
|
|
|
 |
tonydg

|
Posted:
Tue Aug 12, 2003 10:56 pm |
|
All I need to do is remove
and have it readCode:function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
}
} else {
|
and the if else is OK?
Also I wasn't sure about Code:if ($module == $forums){
function OpenTable() {
|
Is that syntax OK?
Thanks
TonyDG |
|
|
|
 |
Raven

|
Posted:
Tue Aug 12, 2003 10:58 pm |
|
Tony, I am not testing this code. I am just trying to eyeball it when you say you have a specific error. Syntax wise those look ok. |
|
|
|
 |
tonydg

|
Posted:
Tue Aug 12, 2003 11:36 pm |
|
Raven,
This code is my first set of function - no borders/ no /backgrounds
works perfect as a standalone code.
Code:function OpenTable() {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" ><tr><td class=>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable() {
echo "</td></tr></table></td></tr></table>\n";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"><tr><td class=nothing>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
|
My second set of function also work perfect - makes background color and borders.Code:function OpenTable() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" width=\"100%\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\"> </td>
<td bgcolor=\"fffcd9\" width=\"100%\">";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\" width=\"100%\"><tr>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\"> </td>
<td bgcolor=\"fffcd9\">";
}
function CloseTable() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\"> </td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
}
function CloseTable2() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\"> </td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\"> </td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
|
I still dont have the if else right - previous post never calls second set of functios.
I need to put a lineof code that handles the Code: If the module is forums.php ---run the first set of functions taht follows
|
Then I need to inset code between teh fisrt and second funtiions that funtions to:
Code:For anything else run this second set of functions
|
Then all I need is the right ending code after teh second set of functions.
All I need is the if /else coding and the end.
Thanks
Tony |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 7:03 am |
|
How about some code likeCode:if (!eregi("forums.php", $_SERVER['PHP_SELF'])) {
//run first routine
}
else {
//run second routine
}
|
|
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 8:46 am |
|
Raven,
I tried to imsert the code - still won't run second set of routines.
Code:<?php
if (!eregi("forums.php", $_SERVER['PHP_SELF'])) {
function OpenTable() {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" ><tr><td class=>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable() {
echo "</td></tr></table></td></tr></table>\n";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"><tr><td class=nothing>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
}
}
else {
function OpenTable() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" width=\"100%\" height=\"15\">&</td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\">&</td>
<td bgcolor=\"fffcd9\" width=\"100%\">";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/up-left2.gif\" alt=\"\" border=\"0\" width=\"100%\"><tr>
<td background=\"themes/XtremeDream/images/up2.gif\" align=\"center\" height=\"15\">&</td>
<td><img src=\"themes/XtremeDream/images/up-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
<tr>
<td background=\"themes/XtremeDream/images/left2.gif\" width=\"15\">&</td>
<td bgcolor=\"fffcd9\">";
}
function CloseTable() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\">&</td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\">&</td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
}
function CloseTable2() {
echo "</td>
<td background=\"themes/XtremeDream/images/right2.gif\">&</td></tr>
<tr>
<td width=\"15\" height=\"15\"><img src=\"themes/XtremeDream/images/down-left2.gif\" alt=\"\" border=\"0\"></td>
<td background=\"themes/XtremeDream/images/down2.gif\" align=\"center\" height=\"15\">&</td>
<td><img src=\"themes/XtremeDream/images/down-right2.gif\" width=\"15\" height=\"15\" alt=\"\" border=\"0\"></td></tr>
</td></tr></table>
<br>";
}
}
?>
|
Did I create a syntax error putting the code in?
Tony |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 10:10 am |
|
Remove the ! for routine 1 to be used. I'm still checking the routine. |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 10:21 am |
|
Raven,
Like this?Code:if (eregi("forums.php", $_SERVER['PHP_SELF'])) {
|
TDG
Be gentle still a php newbie |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 11:21 am |
|
Yes. I still don't know id that will work, but it will be syntactically correct whereas the other one wasn't. |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 11:36 am |
|
Raven
The string without the"!" skips over the first routine and just runs the second.
Could it be possible to use something like
Code:if (eregi($module_name = Forums, $_SERVER['PHP_SELF'])) {
|
This is frustrating as each routine works perfectly independently - just cant make if/else work.
TDG |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 12:00 pm |
|
Wait a minute! What folder is this file in? |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 12:11 pm |
|
File is in my themes folder. We took the Mtechnik Ultra theme and created a block.html and tables.php file to give us independent control over images and borders.
File location is : site/themes/XtremeDream/tables.php
TDG |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 12:13 pm |
|
That matters! So, now tell me, what is the condition that calls routine 1, as opposed to routine 2? When do I call routine 1? |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 12:23 pm |
|
If the user clicks "Forums" the program should run the first routine - so that when the Forums page is viewed it has no background color or border.
If any other module is selected it should run routine 2 - which puts a border and background in.
Taking the "!" out makes the tables.php run only the second routine.
In IE the borders and background routine totally scsrews up the Forums page. In Netscape and Mozilla it just corrupts the Forums right and bottom border.
That is why we decided to do an if/then funtion - if Forums is clicked there will be no border and background on the page. If any othe rmodule is clicked there will be a border and background which is mandatory for this theme to work tight.
If you look at the site you can see routine 2 in action
Only registered users can see links on this board! Get registered or login!
then go to forums and see the problem (especially in IE)!
Thanks
TDG |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 12:30 pm |
|
Try this. In the Forums hyperlink, add a variable pair, r1 (for routine1). So the link will look like this:
Code:http://multimodalmedia.com/site/modules.php?name=Forums&r1=1
|
Then, change your IF test to
Code:if ($_GET['r1']) {
routine 1
}
else {
routine 2
}
|
|
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 12:41 pm |
|
Do you mean:
#!
Code:<?php
if ($_GET['r1']) {
function OpenTable() {
|
or
#2
Code:<?php
if ($_GET['r1']) {
routine 1
}
function OpenTable() {
|
Also excuse my newness - wher do I go to change the Forums hyperlink?
Thanks
TDG |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 12:54 pm |
|
#1. And instead of altering the hyperlink, add this line to the Forums/index.php somewhere near the top, like before define('IN_PHPBB', true);
$r1 = 1;
Then, make that $_GET line this:
<?php
if ($r1) {
function OpenTable() {
I have a conference call I have to attend so I'll be back later. |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 1:13 pm |
|
Must have done it wron - still getting routine 2 only, even if you click forums.
Here is modified forums index.php
Code:if (!eregi("modules.php", $_SERVER['PHP_SELF']))
{
die ("You can't access this file directly...");
}
if ($popup != "1")
{
$module_name = basename(dirname(__FILE__));
require("modules/".$module_name."/nukebb.php");
}
else
{
$phpbb_root_path = 'modules/Forums/';
}
$r1 = 1;
define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
|
here is modified start of tables.php
Code:?php
if ($r1) {
function OpenTable() {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" ><tr><td class=>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable() {
echo "</td></tr></table></td></tr></table>\n";
}
function OpenTable2() {
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"><tr><td class=nothing>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" ><tr><td>\n";
}
function CloseTable2() {
echo "</td></tr></table></td></tr></table>\n";
}
}
else {
function OpenTable() {
|
where did I go wrong?
TDG |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 2:06 pm |
|
That just means that $r1 isn't getting recognized [yet]. Can I just have ftp access to your site? it would really make this a whole lot easier. i will then be changing code until I get it working. Send me, in a PM, your ftp url, id, and password. |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 2:33 pm |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 3:16 pm |
|
Your host does not allow .htaccess files
Can you get them to turn register_globals ON? |
|
|
|
 |
Raven

|
Posted:
Wed Aug 13, 2003 3:28 pm |
|
Try it now. I think I got it. And if so you don't need to contact your host! |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 3:31 pm |
|
Raven,
They just turned it on. And rebooted the server.
probably kicked you from FTP
Should be able to get on now.
Tony |
|
|
|
 |
tonydg

|
Posted:
Wed Aug 13, 2003 3:44 pm |
|
Raven - It looks like its working great!!!!!!
Checked in IE, Netscape and Mozilla - all good so far.
You are the best!!!!
TonyDG |
|
|
|
 |
|