This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Block syntax


avatar
Chris Hall 40
From: -
I'm trying to write a block that displays different html depending on if the user is logged in.

I'm testing for a logged in user using this:
if (strlen($user['user_username']) > 0){


However, I haven't found a way to make the php part of the block communicate with the html part.

I tried just moving everything into the php section but I could not update the block without having html.

My goal is to display a standard block if a user isn't logged in and if the user is logged in, display some information about the user (such as user name, userid etc.).

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Block syntax
avatar
OP 40
From: -
Just wanted to say I LOVE being able to add my own vars and have them parse in the blocks!

I'm really getting a lot of use out of that!
1 Re: Block syntax
avatar
Administrator
1342
From: Austria
Yes, you can use your own variables.
1 Re: Block syntax
avatar
OP 40
From: -
Thank you!

Is output a special variable or can I reference my on variables like that?

For example, if I have something like $myGreeting in the php section can I then referece {$myGreetin) in the HTML section?
1 Re: Block syntax
avatar
Administrator
1342
From: Austria
You should use a variable like $output instead of using echo. Then you can use {$output} in the HTML part.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.