If you develop websites on the Wapkiz or Wapaxo platforms, you've probably faced a common challenge: how to make a click on the "Read More" button on a post summary take the user to the full article page?
The good news is that the platform offers powerful tools for this. The secret lies in using the unique ID that each post receives. When you create a list of posts, each item has an ID. Our goal is to pass this ID from the list page to a view page, which will use this information to load and display the correct content.
In this guide, we'll detail two efficient ways to set up this functionality. To get started, you will need two pages on your site:
- A page for the post list (e.g.,
blogs
). - A page to display the full post (e.g.,
post
).
Let's get to the methods!
Method 1: Using the :to-id: URL Parameter
This is the most direct and simple approach. We'll use a URL parameter (the part that comes after the ?to-KEY=VALUE) to pass the post's ID.
Step 1: Setting up the Post List Page
On your list page, you need to generate a link for each post that includes its ID. To do this, we use the %id% tag provided by Wapkiz. The link will point to your view page (page-post.html in our example) and add the ?to-id=%id% parameter followed by the post's ID.
Paste the following code into your list page:
[blog]o=u, l=100||
<li> <b>%title%</b><br> <a href="/page-post.html?to-id=%id%">Read more</a> </li>
[/blog]
How it works: When the page loads, Wapkiz will replace %id% with the actual ID of each post. A generated link will look something like this: /page-post.html?to-id=123.
Step 2: Setting up the Post View Page
Now, on the page-post.html page, we need to tell Wapkiz to grab the ID from the to-id parameter in the URL and load the corresponding post. We do this using the to=:to-id: code.
Paste this code into your post.html page:
[blog]to=:to-id:||
<h1>%title%</h1> <p>%text%</p>
[/blog]
How it works: The to=:to-id: code instructs the system: "Look at the URL, find the to-id parameter, and use its value as the ID of the post you should display here. Simple and effective!
Method 2: Using Friendly URLs with :url-X:
This technique is a bit more advanced, but it produces cleaner, more SEO-friendly URLs, like /page-post/123/ instead of /page-post.html?to-id=123.
Here, we will use the Wapkiz URL splitting feature, where' the platform divides the URL into parts using the slash (/) as a separator.
Note: To understand this method, it's essential to know how URL splitting works in Wapkiz. The part of the URL after the domain name is divided into positions, starting from 0. For example, in yoursite.com/page-articles/technology/, "articles" is at position 0 and "technology" is at position 1.
Step 1: Setting up the Post List Page
In this method, the post ID will become part of the URL path itself.
Paste the following code into your list page:
[blog]o=u, l=100||
<li> <b>%title%</b><br> <a href="/page-post/%id%/">Read more</a> </li>
[/blog]
How it works: A link generated here will look something like: /page-post/123/. It's more elegant and descriptive.
Step 2: Setting up the Post View Page
On the view page (page-post.html), we'll use the to=:url-X: tag to extract the ID from the URL. Since the ID is in the first position after the page name (/page-post/), we'll use :url-1:.
Analyzing the URL: In /page-post/123/, the split works like this:
- :url-0: = post
- :url-1: = 123 (This is the one we want!)
Paste the code below into your post.html page:
[blog]to=:url-1:||
<h1>%title%</h1> <p>%text%</p>
[/blog]
How it works: The to=:url-1: code tells Wapkiz: "Look at the URL, split it by slashes, grab the value at position 1, and use it as the ID to load the post."
Which Method Should I Use?
Both methods achieve the same result, but they serve slightly different purposes.
- Use Method 1 (:to-id:) if:
- You are a beginner and want the simplest, quickest solution.
- The appearance of the URL is not a priority for you.
- Use Method 2 (:url-X:) if:
- You want a more professional-looking site with clean URLs.
- You are concerned about SEO and want search-engine-friendly URLs.
- You are already comfortable with the basic concepts of the Wapkiz/Wapaxo platform.
Conclusion
Mastering how to display full posts is a fundamental step toward creating a functional and professional blog on Wapkiz and Wapaxo. You now know two powerful techniques to make this happen. Choose the one that best suits your skill level and your website's goals.
Try both methods and see which one you prefer. Happy coding!
0 Comments
Leave a Reply