1
geoffgibbs
Embedded PHP
  • 2003/12/1 14:13

  • geoffgibbs

  • Just popping in

  • Posts: 9

  • Since: 2002/9/23


Hi,
I'm working on a theme for my site and would like to embed some PHP code into the theme.html file. I believe that this is possible, but don't know how to do it. Can anyone help?

Thanks.
Geoff

2
Tiran_Kenja
Re: Embedded PHP

I've been trying to do the same for awhile... But I am fairly sure that it's not possible to implement things in php directly in templates (SMARTY don't seem to support it). So I have been looking for alternative ways of doing it. I tried manipulating the $XoopsTpl object from the end of the header.php file. But I can't seem to get it to work (I'm trying to include a file so I don't heve to reinsert everything everytime header.php is updated)

Anyone made something like that work?

3
lykoszine
Re: Embedded PHP
  • 2003/12/1 14:32

  • lykoszine

  • Module Developer

  • Posts: 244

  • Since: 2002/1/2 2


You can definitly include files with smarty, but dunnno about php files. Not sure if it would parse them or not. You could always try

4
Tiran_Kenja
Re: Embedded PHP

Nevermind me. I figured out setting smarty variables in the header.php file. So that works for me now.

Basically you just need to have some (working =)) code in your header.php file (or somewhere else that is always included) set the smarty variables you need on the global $xoopsTpl object.

5
kahumbu
Re: Embedded PHP
  • 2003/12/1 15:45

  • kahumbu

  • Documentation Writer

  • Posts: 277

  • Since: 2003/8/23


I use these tags to place simple PHP codes in the theme.html:
<{php}>php code here<{/php}>

I'm not sure, though, if this is what you're looking for. I use this to include the username in all pages of my site.

6
geoffgibbs
Re: Embedded PHP
  • 2003/12/1 15:54

  • geoffgibbs

  • Just popping in

  • Posts: 9

  • Since: 2002/9/23


Great! That's just what I was after. Thanks.

7
Tiran_Kenja
Re: Embedded PHP

Doh!

I can't belive I missed that one... I looked in the smarty docs just the other day for a tag like that. *sigh*

Edit: Oh well. It seems the XOOPS stuff isn't set up when php is run this way. So all the global vars isn't there.

8
Andereset
Re: Embedded PHP
  • 2005/10/14 18:45

  • Andereset

  • Just popping in

  • Posts: 3

  • Since: 2005/10/14


Well, this smarty code:

<{php}>php code here<{/php}>

doesn't work in my Xoops. I'm trying to embed it in a HTML file (template) of one module. Does it change in this case?

I just want to stuck a table generated through php in the template of one module. Anyone can help me?

Thanx in advantage.

Login

Who's Online

423 user(s) are online (367 user(s) are browsing Support Forums)


Members: 0


Guests: 423


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