?
Solved

php anchor tag problem in smarty tpl

Posted on 2009-12-21
9
Medium Priority
?
1,546 Views
Last Modified: 2013-12-13

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
Comment
Question by:onanar
  • 5
  • 3
9 Comments
 
LVL 61

Expert Comment

by:HainKurt
ID: 26102285
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
 
LVL 61

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 26102295
maybe nothing is wrong and you have a redirect/transfer on the timeformat_add.php page ;)
0
 

Author Comment

by:onanar
ID: 26102318
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 61

Expert Comment

by:HainKurt
ID: 26102355
can you please post html output, rendered html, view sorce on the browser ;) not code...
0
 

Author Comment

by:onanar
ID: 26102365
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
 
LVL 61

Expert Comment

by:HainKurt
ID: 26102392
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
 
LVL 15

Expert Comment

by:Insoftservice
ID: 26103117
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
 

Author Comment

by:onanar
ID: 26103127
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
 
LVL 61

Expert Comment

by:HainKurt
ID: 26105732
so the solution is actually here ;) @ 26102295
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question