Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 1323
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Using variables in blocks

Started by Chas, July 23, 2010, 11:08:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chas

Hi.

I have set up a block to show just on the Welcome New Members board (a BBC block) and I want to use a system variable in it like {$member.name} - The current member's name. (for personalization.)

I have tried using BBC and HTML blocks to no avail, the text {$member.name} shows not the actual members name.

Is there a way to use a variable within a block?

Thanks.
PS tried searching for the answer but could not find any relating to variables.

130860

it may be done with a php block, for example:


global $context;

$variable = 'your message here:  hi {username}  welcome to my forum';

// we parse $variable so we can use bbc on it.

parse_bbc($variable);


$variable = str_replace('{username}', $context['user']['username'], $variable);


this will replace {username}   with the name of the user.

and then  echo $variable:


echo $variable;


hope that helps

Chas

Many thanks 130860, that's just what I need.

Cheers

Hal

130860

glad it worked, marked as solved then :)