Menu

Welcome to Help

Help
2006-05-17
2013-04-08
  • Nobody/Anonymous

    Welcome to Help

     
    • Nobody/Anonymous

      Hi! I'm beta testing Sparse-PHP and was wondering if there was any way to embed the sparse template tags into a link? What I want to do is make one of my fields clickable so that when the user clicks the link, the ID of the table being displayed is used to pull up a record from another table. I see how to make it work in the constraints on the second page, but I get an XML error if I just try to embed the sparse template tag in the HTML like I do with PHP - eg. <a href="detail.php?id=<sqlfield name='ID' />">. Changing around the order of the quotes doesn't seem to help much. Thanks for your help, in advance!!

       
    • Daniel Orner

      Daniel Orner - 2006-05-24

      Hi!

      Yes, unfortunately Sparse won't be able to parse tags inside other tags, that's an XML limitation. There are two ways to deal with it, the pure way and the sort-of-hacking way. 8-) The first way is to use the displayValue attribute like so:

      <sqlfield name="ID" type="text" displayValue='"&lt;a href=\&quot;detail.php?id=$value\&quot;&gt;"' />

      However, you'll then have to be careful, because if you print a </A> tag normally, XML will *also* complain because it won't see a starting <A> tag. So you'd really have to put the entire link in there. 8-\ The second way is just to use PHP code like so:

      <?php
        print '<a href="detail.php?id=' . $row['ID'] . '">';
      ?>

      (I'm not entirely sure this last way will work properly in the current release, but in 1.02, which should be out in a day or two, it's definitely good.)

       
    • Daniel Orner

      Daniel Orner - 2006-05-31

      In case you're still there: the new version of Sparse should allow you to do exactly what you wanted the first time around. 8-)

       
    • Nobody/Anonymous

      I just noticed that! Thank you so much for adding that functionality!! It seems much more natural to me as a PHP sort of gal...

       
    • Daniel Orner

      Daniel Orner - 2006-05-31

      Not a problem. It fixed a few other things that bugged me as well. 8-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.