Implementing node.js + express + ejs template.
I implemented the bulletin board with a lot of help from the hash code.
I implemented it without an editor. (Because of that, I still implemented uploading images to the body.)
And I want to implement paging.
I'm using mariadb.
select * from board order by _id desc limit 0, 10;
I even understood that I could easily share and import posts using the same query limit.
And,
<ul>
<li><a href="#">«</a></li>
<% for(var i=1;i<8;i++ ) { %>
<li><a href="#"><%=i%></a></li>
<% } %>
<li><a href="#">»</a></li>
</ul>
Like this, I want to try Google's paging technique. (...getting only the front part without the interval)
But I don't know how to implement the link in the href="#" part in the code above.
I ask for your help me.
Thank you.
node.js express paging
In the code you posted, href="#"
comes out three times. You mean the first and last href="#"?
I don't know about express, but I think I'll make a controller that includes the page number in url and processes the url.
<ul>
<li><a href="/pages/<%= i-1 %>">«</a></li>
<% for(var i=1;i<8;i++ ) { %>
<li><a href="#"><%=i%></a></li>
<% } %>
<li><a href="/pages/<%= i+1 %>">»</a></li>
</ul>
And when it's the last page and the first page, we'll need a separate branch.
581 PHP ssh2_scp_send fails to send files as intended
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.