Results 1 to 7 of 7

Thread: Ajax Pagination script v1.2.2 : php/Mysql ?

  1. #1
    Join Date
    Jul 2006
    Posts
    64
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default Ajax Pagination script v1.2.2 : php/Mysql ?

    1) Script Title: Script Title: Ajax Pagination script v1.2.2

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...suppliment.htm

    3) Describe problem: I don't understand how to apply the php/mysql coding. is there a complete example of a php/mysql ajax demo?

    this is the current query coding that i use on my edit-comments.tpl file. Basically my site runs on a smarty template type setup. its a basic query on the db and then out putting the user comments and profile image. With the ajax pagination what I dont understand is how it works the php/mysql example just shows the querying of the info it doesn't show how to display. Am I missing something, If i can see a working example then I can apply it to my coding below.

    Code:
    <!--[Loop Start [<%from%>,<%to%>] QUERY:SELECT rpc.com_id, rpc.com_comment, rpc.com_time, rm.m_id, rm.m_user, rm.m_date, rm.m_pass, rp.i_id FROM $picscommtable AS rpc LEFT JOIN $membtable AS rm ON rpc.com_user=rm.m_id LEFT JOIN $picstable  AS rp ON (rm.m_id=rp.i_user AND rp.i_status=2) WHERE rpc.com_for=<%m_id%> ORDER BY rpc.com_time <%comment_order%>]-->
    <?php $en['date'] = date(d_date_format,$en['com_time']); $en['date_y'] = date("Y", $en['m_date']); $en['date_m'] = date("m", $en['m_date']);
    $result = @getimagesize("http://<%dir%>" . $en['date_y'] . "/" . $en['date_m'] . "/" . $en['m_id'] . "/imgPub/imgTmb/" . $en['m_id'] . "-" . $en['i_id'] . ".jpg");
    $en['imgsize'] = "";
    $en['imgpadding'] = "";
    if($result) {
        if($result[1] <= $result[0]) {
            if(($result[1] * (62 / $result[0])) <= 52) {
              $en['imgsize'] = " width=62";
              $en['imgpadding'] = "style=\"padding-top: " . round((53 - ($result[1] * (62 / $result[0]))) / 2) . "px;\"";
            } else {
              $en['imgsize'] = " height=52";
              $en['imgpadding'] = "style=\"padding-left: " . round((62 - ($result[0] * (53 / $result[1]))) / 2) . "px;\"";
            }
        } else {
            $en['imgsize'] = " height=52";
            $en['imgpadding'] = "style=\"padding-left: " . round((62 - ($result[0] * (53 / $result[1]))) / 2) . "px;\"";
        }
    }
    ?>
    
    <? $en['c_shown'] = 1; ?>
    
    <div class="img-comment">
    <!--[If Start $en['i_id'] != '']-->
    		<a href="<%dir%>view/<%m_user%>.html"><img <%imgsize%> <%imgpadding%> alt=<%m_user%> src="<%dimg%><%date_y%>/<%date_m%>/<%m_id%>/imgPub/imgTmb/<%m_id%>-<%i_id%>.jpg"></a>
    <!--[If Else]-->
    		<a title="User Deleted"><img src="<%dir%>simgs/img-7.gif"></a>
    <!--[If End]-->								
    </div>
    
    <? $en['date'] = date(d_date_format,$en['com_time']); ?>
    <B><%date%></b><br><br><%com_comment%>
    
    
    <!--[If Start $en['mpass'] == $en['mm_pass'] && $en['muser'] == $en['mm_user']]-->
    <a href='<%dir%>view/<%m_user%>/delcom/<%com_id%>'><%_del_com%></a> | <a href='<%dir%>index.php?req=banned&act=save&user=<%m_user%>&sm_ban=true'><%_ban_user%> <%m_user%></a>
    
    <Br>
    <!--[If End]-->
    
    <Br>
    
    <!--[Loop End]-->

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I believe I've seen a couple of running examples posted on the forums before. Regardless though, the best way to guide yourself in setting this up is to constantly view the page's source to see the final output as you try to get it right. As long as the output resembles exactly what you want as if everything was done manually (instead of via php/mysql), then it will work.
    DD Admin

  3. #3
    Join Date
    Jul 2006
    Posts
    64
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    I believe I've seen a couple of running examples posted on the forums before. Regardless though, the best way to guide yourself in setting this up is to constantly view the page's source to see the final output as you try to get it right. As long as the output resembles exactly what you want as if everything was done manually (instead of via php/mysql), then it will work.
    I think i'm getting lost on how the php/mysql part works. There is multiple examples of the simple static content setup... but a more common pulling for a database php/myswl setup just gives a basic query code. Where does the info out put? What am I replacing? Am I using the previous static div html coding? so many question I guess a lot is left to assume that the person editing/using the code would know what to do.

    I found one post of someone who said they had to edit the php coding but they didn't post what was edited. If I saw a complete demo exampe for a working php/mysql ajax pagination i'd understand it more.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The PHP/mySQL code on the instructions page is meant just to show a basic framework of how the concept would work. The fact is, even if the code was fully copy/paste functional, unless you have a working understanding of PHP/mySQL yourself, it's going to be very difficult for you to carry that all the way into your own site. Each site's database structure is unique, so this is different than just copying and pasting a DHTML script and having it working.
    DD Admin

  5. #5
    Join Date
    Jul 2006
    Posts
    64
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    The PHP/mySQL code on the instructions page is meant just to show a basic framework of how the concept would work. The fact is, even if the code was fully copy/paste functional, unless you have a working understanding of PHP/mySQL yourself, it's going to be very difficult for you to carry that all the way into your own site. Each site's database structure is unique, so this is different than just copying and pasting a DHTML script and having it working.
    Has anyone ever posted a working example with the php/mysql setup? I understand basic php/mysql and have found other paginate tutorials and examples that I've been able to understand and change to fit my site. If I could see a working php/mysql ajax script I could easily apply that to my current sites coding.

  6. #6
    Join Date
    Jul 2006
    Posts
    64
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    can anyone help me with a work example, i'd be willing to pay

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I've seen working examples from other members in the past, yes, though I don't remember the URLs. The basic premise is actually quite simple- get your server side code to output the Ajax Pagination code as if it was manually included on your page, except that the page URLs to show are actually constructed from info from your database:

    Code:
    <script type="text/javascript">
    
    var commentsbook={
    pages: ["http://www.mysite.com/comments.php?id=24", "http://www.mysite.com/comments.php?id=12", "http://www.mysite.com/comments.php?id=21", "http://www.mysite.com/comments.php?id=145", "http://www.mysite.com/comments.php?id=241"],
    selectedpage: 0
    }
    
    var comments=new ajaxpageclass.createBook(commentsbook, "bookdiv", ["paginate-top", "paginate-bottom"])
    
    </script>
    can anyone help me with a work example, i'd be willing to pay
    I can move this thread to the "Paid Work requests" forum if you like, or, I'm sure any php/mysql freelancer on the web can do it for you quite simply.
    DD Admin

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
  •