Main Menu
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 log in.

Who's Online

  • Dot Guests: 937
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

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]


Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Custom PHP block - losing main smf footer, sp footer appearing in block

Started by thellie, September 01, 2010, 05:05:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thellie

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.

// 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'];
?>
<?phprequire_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>
<?phpmysql_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.

AngelinaBelle

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

?>
<p>Here's a paragraph about
<?php echo $variable ?>
and
<?php for ($item in $list){?>

,
<?php $item['name'] ?>

<?php } ?>

</p>

with something like

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?

thellie

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 :)

AngelinaBelle

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?

thellie

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.

AngelinaBelle

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?

thellie

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 :)