1
simeon
"exclude" some php code for my theme.html
  • 2005/4/4 7:19

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


hi there

i need to page out some php code needed for my theme.
i.E. the following
$mod $GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );


i put that into a php file named includes.php located in my theme folder and include it with the following at the beginning of my theme.html
<{php}>
include_once 
XOOPS_URL.'/themes/theme/includes.php';
<{/
php}>


but i just got that error
Fatal errorCall to a member function on a non-object in /www/htdocs/root/themes/theme/includes.php on line X


matter of that all is that i have to include some more tpl assigns, wrote some cookies and so on an i dont want to put that all into the theme.html

thanks in advanced for all responding

2
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 6:47

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


im really despaired.its just the last step to finishing my new theme.
i tried everything but i cant get it to work.
pls help me

3
tjnemez
Re: "exclude" some php code for my theme.html
  • 2005/4/5 7:01

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


put this right at the top (line 1) of your theme.html

<{php}>
$mod = $GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign( 'xoops_cmod', $dirname );
<{/php}>

4
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 7:08

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


if you read my post you see that it is my only question how to NOT put it into the theme.html

there is a lot more code like the above and ich dont want 200 lines php code in my theme.html ;)

but thanks very much for the try

5
Herko
Re: "exclude" some php code for my theme.html
  • 2005/4/5 7:11

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


have you included (or required) mainfile.php in your includes.php file?

Herko

6
tjnemez
Re: "exclude" some php code for my theme.html
  • 2005/4/5 7:15

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


this works fine for me with no additional code other than my html so not sure what you are trying to do.

7
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 7:33

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


yeah mainfile is included but no changes

you can see the the includes HERE
and the theme HERE

and THIS is what it does

8
Dave_L
Re: "exclude" some php code for my theme.html
  • 2005/4/5 10:18

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I'm not sure which line is #26, but my guess is the error refers to $GLOBALS['xoopsTpl']->assign, which means that $GLOBALS['xoopsTpl'] hasn't been initialized as an instance of a XoopsTpl object.

Why are you including mainfile.php? That should have already been included by the time your code is executed.

9
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 20:04

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


i've just included the mailfile for testing but it makes no diff if its included or not.

your right, the error comes from the tmp assign.i'm no coder so i cant figure out how to prevent that sorry.
it would be nice if you can exlpain me how to

10
studioC
Re: "exclude" some php code for my theme.html
  • 2005/4/5 20:33

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hello simeon,
just put
$mod $GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );


at the end of header.php (before ?> though) and you will be able to use that smarty in theme


cheers
michael

Login

Who's Online

148 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 148


more...

Donat-O-Meter

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

Latest GitHub Commits