php - How to implement JavaScript into PHTML -


i'm new php , phtml, how go implementing javascript phtml? here file i'm trying implement into, (viewer.phtml)

    <?php     if ($type == "jpeg") {         $stype = "jpg";     } else {         $stype = $type;     } ?> <!doctype html> <html lang="en">     <head>         <meta charset="utf-8">         <title><?php echo app_name . " - $file.$stype"; ?></title>         <link rel="stylesheet" href="/site/images/assets/css/style.css">     </head>      <body>         <h1><?php echo "$file.$type"; ?></h1>          <div class="container">             <img src="/images/<?php echo "$type/$file.$stype"; ?>" alt="<?php echo "$file.$stype"; ?>">         </div>          <?php             $time = microtime();             $time = explode(' ', $time);             $time = $time[1] + $time[0];             $finish = $time;             $total_time = round(($finish - $start), 4);         ?>       </body> </html> 

to add script use script tag. inject inside head tag , head might this

     <head>         <meta charset="utf-8">         <title><?php echo app_name . " - $file.$stype"; ?></title>         <link rel="stylesheet" href="/site/images/assets/css/style.css">         <script>         //you javascript code here         </script>     </head> 

or

          <head>             <meta charset="utf-8">             <title><?php echo app_name . " - $file.$stype"; ?></title>             <link rel="stylesheet" href="/site/images/assets/css/style.css">            <script type="text/javascript" src="your_js_file_location_here"></script>         </head> 

hope you


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -