collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 1017
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Custom PHP block - losing main smf footer, sp footer appearing in block  (Read 6310 times)

0 Members and 1 Guest are viewing this topic.

Offline thellie

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
i don't know whether this is a bug, or a coding issue, but as it's running on smf2.0 rc3 and sp2.3.2, i thought i should post here first.

i've been using the custom php block already, and haven't had a problem up to a couple of days ago.

the code below is causing the main smf footer to disappear, and the sp footer to appear in another custom php block on the portal page.

deactivate the block in question, and the main footer returns, and disappears from the other block.

can't understand why as the template footer function isn't even in the code... i've stripped out all the comments etc, even the document header info (the table appears in the block ok, and there's no problem with connecting to the database) and it's still an issue.

Code: [Select]
// We're going to want a few globals... these are all set later.
global $context;

// specify variable name for user id
$userid = $context['user']['id'];
?>
<?php
require_once('./Connections/mirrorfoundation.php');
?>

<?php 
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

mysql_select_db($database_mirrorfoundation$mirrorfoundation);
$query_M_volunteer_type "SELECT id, value, type, active FROM volunteer_types WHERE active = 1 ORDER BY type ASC";
$M_volunteer_type mysql_query($query_M_volunteer_type$mirrorfoundation) or die(mysql_error());
$row_M_volunteer_type mysql_fetch_assoc($M_volunteer_type);
$totalRows_M_volunteer_type mysql_num_rows($M_volunteer_type);

mysql_select_db($database_mirrorfoundation$mirrorfoundation);
$query_users "SELECT id_member, member_name, email_address, startdate, enddate, M_volunteer_type FROM smf_members  WHERE `M_volunteer_type` IS NULL AND id_group = 24 ORDER BY id_member DESC";
$users mysql_query($query_users$mirrorfoundation) or die(mysql_error());
$row_users mysql_fetch_assoc($users);
$totalRows_users mysql_num_rows($users);
?>

<?php $pagetitle 'Volunteers leaving this week' ?>
<body>
<table class="mtable">
  <?php do { ?>
 <tr class="mtitlebg2">
    <td><a href="<?php $settings['boardurl'?>v_profile.php?id_member=<?php echo $row_vols_next['id_member']; ?>">iD: <?php echo $row_users['id_member']; ?></a></td>
    <td><a href="<?php $settings['boardurl'?>v_profile.php?id_member=<?php echo $row_vols_next['id_member']; ?>">Name: <?php echo $row_users['member_name']; ?></a></td>
  </tr>
  <?php } while ($row_users mysql_fetch_assoc($users)); ?>
  </table>
<?php
mysql_free_result
($users);

mysql_free_result($M_volunteer_type);

i'm also finding that a <div> of the sp footer code is embedding itself in custom php blocks - one block i created has had 3 sp footers embedded into it. i'm happy to have the footer at the bottom of each page, but really don't want it at the bottom of every custom php block i create.
« Last Edit: September 01, 2010, 05:44:11 AM by thellie »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #1 on: September 02, 2010, 11:51:51 AM »
I'm moving this to custom coding, because it looks like a coding error right now. If you do turn up a bug later, hopefully we'll be able to pinpoint it a little bit...
 
You can improve this code by submitting it to an HTML validator.  For starters, the <body tag inside the <body of a page is illegal HTML, and should be eliminated.
 
Inside the custom php block, it would probably be better to eliminate the <?php and ?> tags.
You would replace something like
Code: [Select]
?>
<p>Here's a paragraph about <?php echo $variable ?> and
<?php for ($item in $list){?>
 , <?php $item['name'?>
<?php ?>
</p>
with something like
Code: [Select]
echo '
<p>Here's a paragraph about ', $variable, ' and ';
  for ($item in $list){
  ', ', $item['name']
   }
echo '</p>';

 
This is the style of coding used in SMF and SimplePortal, and will probably make it easier for others to help you.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline thellie

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #2 on: September 02, 2010, 04:37:47 PM »
ok, thanks. i'll go through the code and replace the tags and see what happens.

i know people think dreamweaver is a pig and codes very badly, but without it i would be completely stuck, and nowhere near as knowledgable as i am (which isn't very much)

i have self taught on everything over the last 10 years or so, on the job as i go, so every little bit of help i get is vital.

i learn by taking others coding and playing around with - trial and error, and guesswork.

it's down to about 30% frustration, 69% perspiration, and a full 1% of inspiration :)

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #3 on: September 06, 2010, 07:43:17 PM »
One of my favorite debugging tricks, in the absence of "fancy" debugging tools, is to simply remove offending code until things are good again -- then add the code back in, one line at a time, until the error shows itself.  Then, I have narrowed down where the error really occurs.
 
Good luck!
 
The HTML tutorial at w3schools.com is a very useful reference on what is and is not valid HTML or XHTML.  And the HTML validator is an extrememly useful resource.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline thellie

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #4 on: September 06, 2010, 07:53:22 PM »
hi and thanks,
yes, i use that method often (adding code in from a temporary page), and did so on another page - the first i have fully converted to sit inside php tags.

...and it's working well. it created issues with using the javascript i had on the page, but i have resolved most of them now as well... this is a very quick and useful learning curve :)

i haven't looked at w3schools html yet, but use it alot for the php stuff - very easy to read and helpful.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #5 on: September 09, 2010, 04:14:52 PM »
Were you able to find and fix the HTML problems?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline thellie

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Custom PHP block - losing main smf footer, sp footer appearing in block
« Reply #6 on: September 09, 2010, 08:55:27 PM »
sorry, i'm  bit snowed under at the moment, and had to put a lot of things on hold. this can be marked solved if you like, and i'll come back in the near future if i need to.

thanks for your help :)