Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 6.5
Author Message
tonydg
Hangin' Around



Joined: Jul 16, 2003
Posts: 26

PostPosted: Tue Aug 12, 2003 10:30 pm Reply with quote

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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</td>
    <td bgcolor=\"fffcd9\">";
}
   
function CloseTable() {
    echo "</td>
    <td background=\"themes/XtremeDream/images/right2.gif\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Tue Aug 12, 2003 10:49 pm Reply with quote

In line 22 you have

end;

php doesn't like that Wink
 
View user's profile Send private message
tonydg







PostPosted: Tue Aug 12, 2003 10:56 pm Reply with quote

All I need to do is remove
Code:
end;


and have it read
Code:
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







PostPosted: Tue Aug 12, 2003 10:58 pm Reply with quote

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







PostPosted: Tue Aug 12, 2003 11:36 pm Reply with quote

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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</td>
    <td bgcolor=\"fffcd9\">";
}
   
function CloseTable() {
    echo "</td>
    <td background=\"themes/XtremeDream/images/right2.gif\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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







PostPosted: Wed Aug 13, 2003 7:03 am Reply with quote

How about some code like
Code:
if (!eregi("forums.php", $_SERVER['PHP_SELF'])) {

//run first routine
}
else {
//run second routine
}
 
tonydg







PostPosted: Wed Aug 13, 2003 8:46 am Reply with quote

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







PostPosted: Wed Aug 13, 2003 10:10 am Reply with quote

Remove the ! for routine 1 to be used. I'm still checking the routine.
 
tonydg







PostPosted: Wed Aug 13, 2003 10:21 am Reply with quote

Raven,

Like this?
Code:
if (eregi("forums.php", $_SERVER['PHP_SELF'])) { 


TDG

Be gentle still a php newbie
 
Raven







PostPosted: Wed Aug 13, 2003 11:21 am Reply with quote

Yes. I still don't know id that will work, but it will be syntactically correct whereas the other one wasn't.
 
tonydg







PostPosted: Wed Aug 13, 2003 11:36 am Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:00 pm Reply with quote

Wait a minute! What folder is this file in?
 
tonydg







PostPosted: Wed Aug 13, 2003 12:11 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:13 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:23 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:30 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:41 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 12:54 pm Reply with quote

#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







PostPosted: Wed Aug 13, 2003 1:13 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 2:06 pm Reply with quote

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







PostPosted: Wed Aug 13, 2003 2:33 pm Reply with quote

Info PM'd.

Thanks

TDG
 
Raven







PostPosted: Wed Aug 13, 2003 3:16 pm Reply with quote

Your host does not allow .htaccess files Mad

Can you get them to turn register_globals ON?
 
Raven







PostPosted: Wed Aug 13, 2003 3:28 pm Reply with quote

Try it now. I think I got it. And if so you don't need to contact your host!
 
tonydg







PostPosted: Wed Aug 13, 2003 3:31 pm Reply with quote

Raven,

They just turned it on. And rebooted the server.
probably kicked you from FTP

Should be able to get on now.

Tony
 
tonydg







PostPosted: Wed Aug 13, 2003 3:44 pm Reply with quote

Raven - It looks like its working great!!!!!! Very Happy

Checked in IE, Netscape and Mozilla - all good so far.

You are the best!!!!


TonyDG
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 6.5

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©