58 users online (1 members and 57 guests)  


  Results 1 to 5 of 5

Related

  1. Replies: 1
  2. HTML Function    Forum: Javascript Forum
    Replies: 2
  3. change html-text with a js-function    Forum: Javascript Forum
    Replies: 1
  4. Replies: 7
  1. #1
    Lamont1701's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Location
    New Jersey, USA
    Posts
    18

    How do you put a PHP Function, on a HTML Page?

    How do you use the “include function” to put this PHP Statement “Welcome, {$smarty.session._amember_user.name_f} {$smarty.session._amember_user.name_l} on a HTLM page? (top.htm)

  2. #2
    firmaterra's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    81

    Re: How do you put a PHP Function, on a HTML Page?

    Which version of Smarty are you using?
    You need to assign all variables from your PHP file to your Template file (ie. your HTML page). Which basically means you need to tell the html page everything you need.
    So somewhere in your PHP page you will have a statement like:
    $tpl->assign("$user", "Firmaterra");
    $tpl being the name of whatever you set Smarty up as in the config fire. To call this in your html file all you gotta do is:
    {$user}
    perhaps if you showed us your PHP code and HTML code we might be better able to help.

  3. #3
    Lamont1701's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Location
    New Jersey, USA
    Posts
    18

    Re: How do you put a PHP Function, on a HTML Page?

    <?php echo "Welcome, " . $smarty.session._amember_user.name_f . $smarty.session._amember_user.name_l;
    ?>


    What this code is suppose to do is display "Welcome" and then the person's Username when they logon to the website.


    Also, I would like to display this information Right Justified.

  4. #4
    CesarSJU's Avatar
    New User

    Status
    Offline
    Join Date
    May 2008
    Location
    Metuchen, NJ
    Posts
    1

    Re: How do you put a PHP Function, on a HTML Page?

    correct me if I'm wrong but wouldn't the file extension need to be .php to include any php syntax?

    but to answer your question and to reiterrate what people have already answered with, you simple
    <?

    callMyFunction();

    ?>

    within your html markup. pretty simple.

  5. #5
    HostV's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2008
    Posts
    2

    Re: How do you put a PHP Function, on a HTML Page?

    Thanks for the information, it was very helpful!



Tags for this Thread