Results 1 to 3 of 3

Thread: echo <a href>

  1. #1
    Join Date
    Jul 2010
    Posts
    228
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default echo <a href>

    Good day!

    I want to know if how can I edit my code to echo my <a href>

    here is my <a href> code

    PHP Code:
    <a href="machine1.php?pageno=1&field_name=<?php echo $data_sort?>&sorting=<?php echo $sort?>">FIRST</a>
    <a href="machine1.php?pageno=<?php echo $prevpage;?>&field_name=<?php echo $data_sort?>&sorting=<?php echo $sort?>">PREV</a>
    Thank you so much

  2. #2
    Join Date
    Jul 2010
    Posts
    228
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default

    my colleagues gave me an example of the link of page:
    PHP Code:
    $paging '<a href="?page=1">First</a> | ';
    $paging .= '<a href="?page=1">Next</a> ';
    $paging .= 'Page 1 of 5 ';
    $paging .= '<a href="?page=1">Previous</a> | ';
    $paging .= '<a href="?page=5">Last</a>';

    $tpl->set_var(array('pagination' => $paging,
    )); 
    then he puts {pagination} in his html code

    but in my case I have an if and else condition, so I tried this code.and I encountered problem.
    PHP Code:
    if ($pageno == 1) {
       echo 
    " FIRST PREV ";
    } else {
     
    $myLink ' <a href="machine1.php?pageno=1&field_name='.$data_sort.'&sorting='.$sort.'">FIRST</a>';
       
    $prevpage $pageno-1;
     
    $myLink .= ' <a href="machine1.php?pageno='.$prevpage.'&field_name='.$data_sort.'&sorting='.$sort.'">PREV</a>';
    }
     
    $paging 'Page $pageno of $lastpage ';
    //echo " ( Page $pageno of $lastpage ) ";
    if ($pageno == $lastpage) {
       echo 
    " NEXT LAST ";
    } else {
      
    $nextpage $pageno+1;
      
    $pagination2 .= ' <a href="machine1.php?pageno='.$nextpage.'&field_name='.$data_sort.'&sorting='.$sort.'">NEXT</a>';
      
    $pagination2 .= ' <a href="machine1.php?pageno='.$lastpage.'&field_name='.$data_sort.'&sorting='.$sort.'">LAST</a>';

    and I set_var
    PHP Code:
    $tpl->set_var(array('pagination' => '$myLink',
                        
    'paging' => '$paging',
                        
    'pagination2' => '$pagination2'
    )); 
    and i add in my html this code:
    Code:
    {pagination} {paging} {pagination2}
    and the output is:
    $myLink FIRST PREV

    whats wrong with my code?

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    it seems you're using some cms or function library (e.g., $tpl->set_var(); etc.). I have no idea what those functions do or how the overall system works, so I'm afraid there's not much help I could offer.

    You mention your "colleagues", and your "boss" in another thread. is this a system your work is using? do they have any resources, or people who could help familiarize you with the system?

  4. The Following User Says Thank You to traq For This Useful Post:

    rhodarose (05-19-2011)

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
  •