Fork me on GitHub

autotheme blocks and <!--[user]-->  Bottom

  • When I place in the body of my theme it displays the users name, however when I place it in an HTML block it does not. Can someone explain this to me?
  • That is a theme command not an HTML code.
    It is too late in the process to get parsed by the theme engine if you put it in an HTML block.

    --
    Zikula Themes
  • that is really too bad.
  • YOu could try this:

    Code

    <?php echo pnUserGetVar('uname'); ?>


    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Didn't work...:(
  • Maybe drop the
  • The code you sugguests does show the name if you are logged in, however unregistered users shows a blank where the name could be. How can you get it to say "guest" ?

    Since I don't know much PHP code this is my block so far

    Code

    echo "Welcome, ";
    echo pnUserGetVar('uname');
    echo "!";


    I would like the whole thing to be bold. How do you do this?
  • Code

    <?php

    $username = pnUserGetVar('uname');

    if ($username){

         echo "<strong>Welcome, $username</strong>";

    } else {

         echo "<strong>Welcome, Guest</strong>";

    {

    ?>


    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • I had to change it a bit to get it to work in a PHP block

    Code

    $username = pnUserGetVar('uname');

    if ($username){
    echo "<strong>Welcome,  $username!</strong>";
    }
    else {
    echo "<strong>Welcome, Guest!</strong>";
    }
  • What do you mean, it did not work originally?

    edit: ah you mean take out the PHP tags?

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • well actually in your original code the last squiggly bracket was backwards...should have been } But not that I know what I am doing :P

This list is based on users active over the last 60 minutes.