Topic: First module, need serious help! (hacked up Submit_News)
norsejeff
avatar
Freshman
Freshman
Posts: 33

Posted:
9.Mar 2007 - 02:30

Okay, I can't get this to load no matter what I do! I want to make an emailer that fits right into my site and lets people put a link in 1 field, then a short description in a text field, then email me it. I wanted to hack up submit news because it shows you already what your name is if you're logged in, and I figure that could also be emailed to me. Anyway, here's what I got now:

Code

<?php

if (!defined('LOADED_AS_MODULE')) {
    die ("You can't access this file directly...");
}

$ModName = basename(dirname( __file__ ));

modules_get_language();

function defaultDisplay()
{
    $ModName = $GLOBALS['ModName'];

    $topic = pnVarCleanFromInput('topic');

    $dbconn =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();

    $currentlang = pnUserGetLang();

    include ('header.php');
    if (!pnSecAuthAction(0, 'Submit Media::', '::', ACCESS_COMMENT)) {
        echo _NOTALLOWED;
        include 'footer.php';
        exit;
    }

    OpenTable();
    echo '<h1>'._SUBMITNEWS.'</h1>'._SUBMITADVICE;
    CloseTable();

    OpenTable();

  echo '<form name="news" id="news" action="index.php?name=sendmail.php" method="post">'
        .'<strong>'._YOURNAME.':</strong> ';
    if (pnUserLoggedIn()) {
        echo '<a href="user.php">' . pnUserGetVar('uname') . '</a>';
    } else {
        echo pnConfigGetVar('anonymous');
    }
    echo'<br>'
. 'Link to Video:'
. '<input name="video_link" type="text" />'
.'<br />'
.'Short Discription: <br />'
. '<textarea name="message" rows="15" cols="40">'
. '   </textarea>'
. '<br />'
. '<input type="submit" />'
. '</form></p>';
CloseTable();
include ('footer.php');

?>


And I'm getting the error:

Parse error: parse error, unexpected $ in /mnt/Target01/328594/www.vgrealms.com/web/content/modules/emailer/index.php on line 55

There's nothing but ?> on line 55. But anyway, I know this code is horrible and is most likely completely wrong as I have no idea what I'm doing. But any help you could give would be awesome. I'm going to worry about the sendmail.php script later after I get this up.
InvalidResponse
avatar
Professional
Professional
Posts: 2423

Posted:
9.Mar 2007 - 03:01

the function's not closed.. add a } before ?>

--
http://www.invalidresponse.com
norsejeff
avatar
Freshman
Freshman
Posts: 33

Posted:
9.Mar 2007 - 03:07

Ah yes, that did take away that annoying error. Now I have just a blank white page. But I guess that's better than the error. Time for a bunch of trial and error!

Thanks