1
hipoonios
My custom page ignoring smarty codes
  • 2008/7/20 15:39

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Hello, can someone help me with this?

I have created a file in root called test.php with the following code.

if (file_exists("mainfile.php")) {
    include(
"mainfile.php");
}
elseif(
file_exists("../mainfile.php")) {
    include(
"../mainfile.php");
}
else {
    include(
"../../mainfile.php");
}
include(
XOOPS_ROOT_PATH "/header.php");
$xoopsTpl->assign('xoops_showrblock'0); // 1 display right blocks
$xoopsTpl->assign('xoops_showlblock'0); // 1 display right blocks
?>
<{if $xoops_isuser == 0}>Please login now<{/if}>
include(XOOPS_ROOT_PATH "/footer.php");
?>

But it doesnt work. It's only shows as code/text. Anything i have missed? It works from themes, but not from this page. But i dont want to have it in my theme.

Please help.
I love Xoops!

2
moonisharsh
Re: My custom page ignoring smarty codes
  • 2008/7/20 16:35

  • moonisharsh

  • Just popping in

  • Posts: 3

  • Since: 2008/7/20


Oh,god,i feel so terrible when seeing these codes...

3
iHackCode
Re: My custom page ignoring smarty codes

if i remember right. smarty wont work that way.

try assigning a template. $xoopsOption['template_main'] = some template file. (good if you have a module that can import templates to the database)
include header
and assign any other smarty variables with $xoopsTpl->assign
and the footer does the render

.. and i don't have a list of default XOOPS smarty variables.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

4
trabis
Re: My custom page ignoring smarty codes
  • 2008/7/20 20:22

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Try:
if (file_exists("mainfile.php")) {
    include(
"mainfile.php");
}
elseif(
file_exists("../mainfile.php")) {
    include(
"../mainfile.php");
}
else {
    include(
"../../mainfile.php");
}
include(
XOOPS_ROOT_PATH "/header.php");
$xoopsTpl->assign('xoops_showrblock'0); // 1 display right blocks
$xoopsTpl->assign('xoops_showlblock'0); // 1 display right blocks

if (!(is_object($xoopsUser) && $xoopsUser->getVar('uid')>0)) echo "
Please login now
"
;

include(
XOOPS_ROOT_PATH "/footer.php");
?>

5
hipoonios
Re: My custom page ignoring smarty codes
  • 2008/7/20 22:07

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Thank you very much trabis! That worked
I love Xoops!

6
hipoonios
Re: My custom page ignoring smarty codes
  • 2008/7/24 17:57

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Sorry to taking up this thread again. Now i want to to do it the another way too..

Show a message for all users that are logged in.

Please help.
I love Xoops!

Login

Who's Online

437 user(s) are online (305 user(s) are browsing Support Forums)


Members: 0


Guests: 437


more...

Donat-O-Meter

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

Latest GitHub Commits