SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create links dynamically in PHPLIB Template

    Hello,
    I would like to know how to create links dynamically in PHPLIB Template. Without using it, I know how to get a row from a database, display it and associate a link with it, but how to do it when using PHPLIB Template?

    Thanks in advance,
    John

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it... but now I have another problem, for this statement:

    $t->set_var("link", '<a href="disp_article.php?ID=$row["article_ID"]">edit</A>');

    when someone press 'edit', it goes to disp_article.php, but here's what appears in address line of browser:

    http://localhost/dev/disp_article.php?ID=$row[

    It should display such as:
    http://localhost/dev/disp_article.php?ID=5

    i.e. that $row["article_ID"] is not intepreted. How do I fix it?

    Thanks in advance,
    John

  3. #3
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could make it $t->set_var("link", '<a href="disp_article.php?ID='. $row["article_ID"] .'">edit</a>');

    It wasn't working because you used single quotes, which tells PHP not to parse the variables. You could also change it to double quotes and escape the ones that are in the string.

  4. #4
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's it. It works finally.

    Thanks,
    John


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •