1
Jackwan
Variables in Html
  • 2004/9/27 23:47

  • Jackwan

  • Not too shy to talk

  • Posts: 129

  • Since: 2004/9/8 2


I am not a PHP programer. Perhaps this is related to PHP programming, but I am trying to resolve it in html if I can.

The objective here is to add a user name variable in a Custom block.

In a theme.html, I saw $xoops_url and $xoops_uname being used, and when the html is executed in a Custom Block, the URL variable is resolved but the Uname is not resolved.

Please advise. Thanks.

2
Dave_L
Re: Variables in Html
  • 2004/9/28 3:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Make the block's Content Type "PHP Script".

Example:

global $xoopsUser;
$uname is_object($xoopsUser) ? $xoopsUser->getVar('uname') : '(guest)';
echo 
$uname;

3
Jackwan
Re: Variables in Html
  • 2004/9/28 4:41

  • Jackwan

  • Not too shy to talk

  • Posts: 129

  • Since: 2004/9/8 2


Thanks David_L

But I wrote the whole block in html and when I change to PHP script every thing is gone. I saw in zaja-x theme there is a $xoops_uname variable in the html and thought I can use it, but no go. I also load the entire theme.html to a custom block and found out that some of the variables are resolved(example is $xoops_url) most are not. Just wonder why?

4
Dave_L
Re: Variables in Html
  • 2004/9/28 13:22

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I'm not familiar with that theme.

theme.html is processed in a different "environment" than a custom block, so the variables available may be different. Also, theme.html is processed as a Smarty template and may use Smarty tags, while a custom block may not.

You can combine PHP and HTML in a "PHP Script" custom block, for example:

... PHP code ...
?>
... HTML code ...
... more PHP code ...
?>
... more HTML code


The contents of a custom block are blindly jammed into the middle of other code, without any checking for conflicts, so you have to be careful what you put in the block.

5
Jackwan
Re: Variables in Html
  • 2004/9/28 19:25

  • Jackwan

  • Not too shy to talk

  • Posts: 129

  • Since: 2004/9/8 2


Thank you very much.

I have decided to change my theme and the new theme has the User Name as a part, so I do not have to mess around the Custom Block.


Login

Who's Online

413 user(s) are online (51 user(s) are browsing Support Forums)


Members: 0


Guests: 413


more...

Donat-O-Meter

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

Latest GitHub Commits