• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1647
  • Last Modified:

php anchor tag problem in smarty tpl


please have a look at my code, if i click on Edit button, its not going to timeformat _add.php rather its going to other page "device_list.php" .what is wrong with the anchor tag?please correct me

{foreach  from=$format_ids key=k item=id}
     
      <tr>
       <td> {$data_time.$id.timename}</td>
       <td> {$data_time.$id.modbus_id}</td>
       <td> {$data_time.$id.function_code}</td>
       <td> {$data_time.$id.reg_address}</td>
       <td> {$data_time.$id.reg_number}</td>
       <td> {$data_time.$id.startbit}</td>
       <td> {$data_time.$id.stopbit}</td>
       <td> {$data_time.$id.dataformat}</td>
       <td> {$data_time.$id.scale}</td>
       <td> {$data_time.$id.offset}</td>
      <td> <a href="timeformat_add.php?format_id={$id|escape:'url'}">Edit</a></td>
      </tr>
       
     {/foreach}
0
onanar
Asked:
onanar
  • 5
  • 3
1 Solution
 
HainKurtSr. System AnalystCommented:
post one sample from HTML source, we cannot know what this one is producing...

<td> <a href="timeformat_add.php?format_id={$id|escape:'url'}">Edit</a></td>
0
 
HainKurtSr. System AnalystCommented:
maybe nothing is wrong and you have a redirect/transfer on the timeformat_add.php page ;)
0
 
onanarAuthor Commented:
its not going to any other page, its going only to device_list page (even if i give user_add.php)

here is my full code

<html>
  <head>
{include file="head.tpl.inc" title="Device Management"}

  </head>
  <body>

{include file="banner.tpl.inc" title="Device Management"}
{include file="sidebar.tpl.inc"}

    <div id="content">

<p><a href="device_update.php?device_id={$device.device_id}">Back</a></p>

<h2>Device Information</h2>

<table border="1">
  <tr>
    <th>Device ID</th>
    <td>{$device.device_id|escape}</td>
  </tr>
  <tr>
    <th>Description</th>
    <td>{$device.description|escape}</td>
  </tr>
</table>


<h2>New Time format Rule</h2>

<form name="actionform" action="timeformat_update.php?device_id={$device.device_id}" method="post">

<table border="1">
<tr>
 
          <th>Time name</th>
          <th>Modbus ID</th>
          <th>Function Code</th>
          <th>Address</th>
          <th>Register no</th>
          <th>Start Bit</th>
          <th>Stop Bit</th>
           <th>Data format</th>
            <th>Scale</th>
             <th>Offset</th>
             <th>Edit</th>

    </tr>
   
     {foreach  from=$format_ids key=k item=id}
     
      <tr>
       <td> {$data_time.$id.timename}</td>
       <td> {$data_time.$id.modbus_id}</td>
       <td> {$data_time.$id.function_code}</td>
       <td> {$data_time.$id.reg_address}</td>
       <td> {$data_time.$id.reg_number}</td>
       <td> {$data_time.$id.startbit}</td>
       <td> {$data_time.$id.stopbit}</td>
       <td> {$data_time.$id.dataformat}</td>
       <td> {$data_time.$id.scale}</td>
       <td> {$data_time.$id.offset}</td>
      <td> <a href="timeformat_add.php?format_id={$id|escape:'url'}">Edit</a></td>
      </tr>
       
     {/foreach}
   

 
 </table>


 
  <input type="submit" value="Update" />

</form>


{*
{if !$error}
{include file="generic_table.tpl" table=$table}
{elseif $error==STARFISH_COMM_ERROR_BAD_SYNTAX}
<p>Error: Bad Syntax! (Please contact developer)</p>
{elseif $error==STARFISH_COMM_ERROR_UNKNOWN_HOST}
<p>Error: Unknown Host {$ip}.</p>
{elseif $error==STARFISH_COMM_ERROR_CONNECTION_REFUSED}
<p>Error: Connection Refused from {$ip}.</p>
{elseif $error==STARFISH_COMM_ERROR_BAD_RESULT}
<p>Error: Bad Result! (Please contact developer)</p>
{else}
<p>Error: Unknown error! (Please contact developer)</p>
{/if}
*}

{if !empty($debug)}
<pre>
DEBUG OUTPUT:
{$debug}
</pre>
{/if}

    </div>

  </body>
</html>
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
HainKurtSr. System AnalystCommented:
can you please post html output, rendered html, view sorce on the browser ;) not code...
0
 
onanarAuthor Commented:
view source



1YEAR2DAY<html>
  <head>
    <title>Device Management</title>

    <style type="text/css" media="all">@import "style.css";</style>
    <link type="text/css" rel="stylesheet" href="css/SpryTabbedPanels.css">
<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->
<script src="js/SpryTabbedPanels.js" type="text/javascript"></script>
    <script type="text/javascript"><!--
function msg()
{

 
}

inited=0;

function init()
{
  inited=1;
  msg();
  startload();
}

function todo()
{
  alert('Construction/Upgrading work in progress...');
}

function redirect_confirm(str, url)
{
  var status;
  status = confirm(str);
  if (status == true) {
    redirect(url);
  }
}

function redirect(url)
{
  window.location.href = url;
}

function page_reload()
{
  // Refresh the entire page!
  // var sURL = unescape(window.location.pathname);
  // window.location.href = sURL;
  window.location.reload(false);
}

function dn(download_url)
{
  document.location = download_url;
}

function popup_window(url,name,attr)
{
  return window.open(url,name,attr);
}


function popup_minimal(url)
{
  popup_window(url, 'popup_minimal', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,titlebar=0,height=1,width=1');
}


function unescapeHTML(html)
{
  var htmlNode = document.createElement("DIV");
  htmlNode.innerHTML = html;
  if (htmlNode.innerText)
    return htmlNode.innerText; // IE
  return htmlNode.textContent; // FF
}


function select_all(id_prefix)
{
  for (var i=0; i<document.actionform.length; i++) {
    elem = document.actionform.elements[i];
    if (elem.id.substr(0,id_prefix.length) != id_prefix)
      continue;
    if (elem.type == 'checkbox')
      elem.checked = true;
  }
}


function unselect_all(id_prefix)
{
  for (var i=0; i<document.actionform.length; i++) {
    elem = document.actionform.elements[i];
    if (elem.id.substr(0,id_prefix.length) != id_prefix)
      continue;
    if (elem.type == 'checkbox')
      elem.checked = false;
  }
}


/*
function form_submit_confirm(str)
{
  var status = confirm(str);
  if (status == true) {
    document.actionform.submit();
    return true;
  }
  return false;
}
*/

/* Ajax Submit */
function newXmlHttpObject() {
  // Create a XMLHttpRequest object
  var request = false;
  try {
    // Firefox, Opera, Safari
    request = new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        request = false;
      }
    }
  }

  return request;
}

function startload(){
    var xhReq = newXmlHttpObject();
        if (!xhReq) {
                alert("Your browser does not support AJAX.");
        }else{
                xhReq.open("GET", "checklogin.php?action=load", false);
                xhReq.send(null);
        }

}

function finishload(){
    var xhReq = newXmlHttpObject();
        if (!xhReq) {
                alert("Your browser does not support AJAX.");
        }else{
                xhReq.open("GET", "checklogin.php?action=unload", false);
                xhReq.send(null);
        }
}

window.onload=init;
window.onunload=finishload;

//-->

</script>

  </head>
  <body>

  <div id="banner">
<table border="0">
  <tr>
    <td>
      <img src="images/egenkitlogo.png" alt="" />
    </td>

    <td>
      <h1>Device Management</h1>
    </td>
  </tr>
</table>
  </div><style type="text/css">
body{
      font-family: Arial,sans-serif;
      color: #000000;
      line-height: 1.5;      
      margin: 0px;
      font-size: 80%;
      padding: 5px 0px 0 10px;
}
</style>

  <div id="sidebar">

    <div class="block">
      <h3>Navigation</h3>
<p>Welcome back!</p>      <ul>
        <li><a href="home.php">Home</a>
        </li>

        <li>Advanced Administration
          <ul>

            <li><a href="image_list.php">Images</a></li>
            <li><a href="device_list.php">Devices</a></li>
            <li><a href="client_list.php">Clients</a></li>
            <li><a href="profile.php">Profiling</a></li>
            <li><a href="loggernetwork_list.php">Network Profiles</a></li>
            <li><a href="task_list.php?task=1">Task List - SMS</a></li>

            <li><a href="task_list.php?task=3">Task List - Wake-Up</a></li>
          </ul>
        </li>

        <li>Administration
          <ul>
            <li><a href="company_tree.php">Groups</a></li>
            <li><a href="user_list.php">Users</a></li>

                      </ul>
        </li>

        <li><a href="view_plant_list.php">Plants</a>
          <ul>
            <li><a href="map_plant_list.php">Map</a></li>
          </ul>
        </li>

        <li><a href="trend_data_1.php">Trending</a></li>

        <li><a href="logout_process.php"><b>Logout</b></a>
        </li>
      </ul>
    </div>

  </div>

    <div id="content">

<p><a href="device_update.php?device_id=85">Back</a></p>

<h2>Device Information</h2>

<table border="1">
  <tr>
    <th>Device ID</th>
    <td>85</td>

  </tr>
  <tr>
    <th>Description</th>
    <td>DEIF GC-1F Ver. 3</td>
  </tr>
</table>


<h2>New Time format Rule</h2>

<form name="actionform" action="timeformat_update.php?device_id=85" method="post">

<table border="1">
<tr>
 
          <th>Time name</th>
          <th>Modbus ID</th>
          <th>Function Code</th>
          <th>Address</th>
          <th>Register no</th>

          <th>Start Bit</th>
          <th>Stop Bit</th>
           <th>Data format</th>
            <th>Scale</th>
             <th>Offset</th>
             <th>Edit</th>

    </tr>
   
           
      <tr>
       <td> YEAR</td>
       <td> 22</td>
       <td> 2</td>

       <td> 2002</td>
       <td> 232</td>
       <td> 22</td>
       <td> 22</td>
       <td> 2</td>

       <td> 23</td>
       <td> 2</td>
      <td> <a href="access_add.php">Edit</a></td>
      </tr>
       
           
      <tr>
       <td> DAY</td>

       <td> 22</td>
       <td> 2</td>
       <td> 2002</td>
       <td> 232</td>
       <td> 22</td>

       <td> 22</td>
       <td> 2</td>
       <td> 23</td>
       <td> 2</td>
      <td> <a href="access_add.php">Edit</a></td>

      </tr>
       
         

 
 </table>


 
  <input type="submit" value="Update" />

</form>




    </div>

  </body>
</html>
0
 
HainKurtSr. System AnalystCommented:
this is funny ;) how come

<td> <a href="timeformat_add.php?format_id={$id|escape:'url'}">Edit</a></td>

produces

 <td> <a href="access_add.php">Edit</a></td>

;) try

<td> <a href='timeformat_add.php?format_id={$id|escape:'url'}'>Edit</a></td>
0
 
InsoftserviceCommented:
hi,
Ya its really funny.
can u just do one R.N.D. change timeformat_add.php to "onanar.php"

Please note its not a solution but a test please let us now whts the o/p of html
0
 
onanarAuthor Commented:
Hey .. I am sorry .. I tried this one.. this problem is because of the other program redirecting this page to another page ..i fixed it. thanks..
0
 
HainKurtSr. System AnalystCommented:
so the solution is actually here ;) @ 26102295
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now