xoops forums

PolderBoyII

Just popping in
Posted on: 2011/7/13 14:15
PolderBoyII
PolderBoyII (Show more)
Just popping in
Posts: 3
Since: 2011/7/13
#1

php view in module

Hello all,

I have built a simple module.
I have tested it on my server, works like a charme.

Today I have uploaded the module to the server and the installation worked, according to the admin.

But when I look at the page it shows the php code......

getVar('uid'); $BB_KlantNaam = $xoopsUser->getVar('name'); $BB_EmailAdres = $xoopsUser->getVar('email'); } else { $BB_uid = 0; $BB_KlantNaam = "Geen naam bekend"; $BB_EmailAdres = "Geen email bekend"; } $_SESSION["BB_uid"] = $BB_uid; $_SESSION["BB_KlantNaam"] = $BB_KlantNaam; $_SESSION["BB_EmailAdres"] = $BB_EmailAdres; print BB_KlantNaam; ?>

I don't want that..

The complete page is:

<?
// let start including the header of xoops
include("../../mainfile.php"); // including top functions of xoops
$xoopsOption['template_main'] = "Buitenhuis.php"; // this line must be defined BEFORE header.php, otherwise module will get threader like a x1 module (old style)
include(XOOPS_ROOT_PATH."/header.php"); // including the rest
// done, now your own files comes!

include ("functies.php");

global $xoopsUser;

if (is_object($xoopsUser) == true)
{
$BB_uid = $xoopsUser->getVar('uid');
$BB_KlantNaam = $xoopsUser->getVar('name');
$BB_EmailAdres = $xoopsUser->getVar('email');

$strGegevens = GegevensOphalen($BB_uid);
$arrGegevens = explode("|", $strGegevens);

//$org_soort . "|" . $contact_tussenvoegsel . "|" . $contact_achternaam . "|" . $contact_aanhef

if ($arrGegevens['3'] == "Dhr")
{
print "Geachte heer " . $BB_KlantNaam;
}
elseif ($arrGegevens['1'] == "Mw")
{
print "Geachte mevrouw " . $BB_KlantNaam;
}
else
{
print "Geachte " . $BB_KlantNaam;
}

print "<br>";
$Variabelen = "view=3&cid=1&cName=" . $arrGegevens['2'] . "&cEmail=" . $BB_EmailAdres . "&cSoort=" . $arrGegevens['0'];

print "<script language="javascript" src="load.php?" . $Variabelen . ""></script>";
}
else
{
print "Niet ingelogd.";
print "U kunt niet reserveren.";
}

// including footer of xoops
include(XOOPS_ROOT_PATH."/footer.php");
// done

?>

Could somebody tell me what is wrong?

PolderBoyII

playsome

Not too shy to talk
Posted on: 2011/7/13 23:08
playsome
playsome (Show more)
Not too shy to talk
Posts: 197
Since: 2009/4/15
#2

Re: php view in module

Hi, I am probably totally wrong here, I am a beginner php coder but I remember reading that some servers dont like shorttags i.e <? ?>

maybe try <?php ?>

PolderBoyII

Just popping in
Posted on: 2011/7/14 16:10
PolderBoyII
PolderBoyII (Show more)
Just popping in
Posts: 3
Since: 2011/7/13
#3

Re: php view in module

Dear PlaySome,

You were completly right.
It doesn't work yet but I think you were right.
If I look at the page code it shows the start tag <? and not <?php and I can see the code from there on.

But I have corrected the file, uploaded the php, did a complete re-install of the module and yet it shows <? in the source code from the browser. But when I look at the file (got it back on my computer with filezilla) the opening tag is <?php

It still shows:
<div id="content"> <?
if (is_object($xoopsUser) == true)
{

And I know it is
<?php
if (is_object($xoopsUser) == true)
{

But thanks again,
PolderBoyII

redheadedrod

Home away from home
Posted on: 2011/7/14 18:22
redheadedrod
redheadedrod (Show more)
Home away from home
Posts: 1296
Since: 2008/2/26
#4

Re: php view in module

You may have to clear your caches...

PolderBoyII

Just popping in
Posted on: 2011/7/18 9:57
PolderBoyII
PolderBoyII (Show more)
Just popping in
Posts: 3
Since: 2011/7/13
#5

php view in module

Hello,

Thank you for the tip, but I have already tried that.

The code is gone now. It turns out that I had a print statement in the /templates/file.php which blocked the working of the script.

Also I have learned that I need to upload the module in the admin pages to see the changes.
Which is strange as I don't have to do this local.

Anyway it seems to be working now.

Thanks for the tips and answers.

PolderBoyII