Join the Webstudio community

Updated 7 months ago

set and update variable

At a glance

The community member is having trouble modifying variables, specifically how to increment a variable called "firstPosts". The comments indicate that variables are mostly static at the moment, and cannot be updated once set. However, resource variables can be updated by changing the remote data. The community members discuss alternative ways to manage pagination, such as using search parameters or the pagination feature in a WordPress template. One community member suggests against using a "load more" feature, as it is not the best approach for displaying posts.

Useful resources
Hello everyone.
after many hours of experimenting, I must have missed something in the use of variables.
I don't see how to modify a variable.
If I create a number variable 'firstPosts', how do I increment this variable.
In this example, with a pagination from two to two, I would set this variable by incrementing by 2
Thanks for your help !
Attachments
Capture_decran_2024-07-16_a_13.47.02.png
Capture_decran_2024-07-16_a_13.46.54.png
Capture_decran_2024-07-16_a_13.46.01.png
1
B
O
M
14 comments
Hey, variables are mostly static at the moment. Resources are changed based on their inputs and system is changed whenever page url is updated.
In other words, Variables in the current stage can not be updated once they are set.
Resource variables can be updated by changing the remote data, but not the variable itself.
This will be possible in some future, but for now variables are not used to implement actions based on interactions with the user.
Ok thanks, I'm not that bad then
in this case, how do you recommend managing pagination?
we have showed it in some templates which demonstrate CMS
also on the videos I think we have that, not sure though
ok I look for it. Thanks
You can update search params values with forms or links and access via system.search.myparam
Yes. I use system.search.limit .In expression editor I add "+" before system.search.limit to use it as number. It works fine except for scroll positiona
https://webstudio.wex.academy/blog/
Looks like youre using WP as a CMS. Have you tried using the pagination that's in the marketplace wordpress template?
Thank you for your answer.
I saw this template but I 'm looking for a load more feature.
I use limit as value for first query parameter in graphql.
Perhaps there is an easier way
I wouldnt use load more. For starters when more load, you're really just loading all of them again, its not like the new 10 are inserting in addition the previous 10.

And it's best to show lots of posts on one page. Google and visitors prefer less navigation
Add a reply
Sign up and join the conversation on Discord