1
PolderBoyII
php view in module
  • 2011/7/13 14:15

  • PolderBoyII

  • Just popping in

  • Posts: 3

  • Since: 2011/7/13


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

2
playsome
Re: php view in module
  • 2011/7/13 23:08

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


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 ?>

3
PolderBoyII
Re: php view in module
  • 2011/7/14 16:10

  • PolderBoyII

  • Just popping in

  • Posts: 3

  • Since: 2011/7/13


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

4
redheadedrod
Re: php view in module

You may have to clear your caches...

5
PolderBoyII
php view in module
  • 2011/7/18 9:57

  • PolderBoyII

  • Just popping in

  • Posts: 3

  • Since: 2011/7/13


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

Login

Who's Online

170 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 170


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits