Jump to content

function php in tpl not work why?


StORE

Recommended Posts

Hi all

 

I have this functions but not work

[code]
{php}function check_sv($ipaddress) {
$http = @ fsockopen($ipaddress, 80, $errno, $errstr, 5);

           if($http) {
              $status = "Online";
           }else {
               $status =  "Offline";
           }
           return $status;

}{/php} 
{$status}

[/code]

Link to comment
Share on other sites

First problem... you've defined the function, but aren't actually calling it though. Unless you have a specific need for it to be a function, simply put the code that you want to run within the {php} tags and end it by setting a smarty variable which you can then reference within the template itself.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated