Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
27 posts Page 3 of 3
srewebso wrote: Mine seems to stay cached for days? I have to manually save the page in couch backend to refresh the feed each day. Is there anything I put into the code to exclude caching for that specific code area?

I think before you showed me a <cms:nocache> tag?


Hey, @srewebso
You'll find description of no_cache tag in Couch Shopping Cart tutorial http://docs.couchcms.com/concepts/shopping-cart-1.html :)
Okay so this is a self closing tag right? we can't just wrap it around a bit of code it has to be for the whole page?

I have my twitter feed in the footer of my template (the footer is a snippet). If I put <cms:no_cache /> in that snippet does that mean every page wont be cached? Meaning the cache functionality is useless for me?

Is anyone else having problems with caching tweets? Why do I seem to be the only one?
I never used this twitter addon myself, but will share my thoughts on it whenever I try it in future.

No_cache is a self-closing tag, indeed. It is executed only on the template where it appears, like in that tutorial example. We can't enclose a piece of code with it, though.

Coming to your question, if you have twitter feed in all templates in footer, then you'd put that tag to your snippet and all templates would eventually drop out of cache. Instead, the better way would probably include creating a separate template for the twitter and fetch only captured data from it. So, that twitter template will have no_cache and will be updated every time your snippet calls for it.

Unfortunately, I can't provide a working code solution just yet, because, as I said, I haven't tried it myself. But if you have some experience with it, try to think a solution with a separate template.

srewebso wrote: Okay so this is a self closing tag right? we can't just wrap it around a bit of code it has to be for the whole page?

I have my twitter feed in the footer of my template (the footer is a snippet). If I put <cms:no_cache /> in that snippet does that mean every page wont be cached? Meaning the cache functionality is useless for me?

Is anyone else having problems with caching tweets? Why do I seem to be the only one?
I'd like to also comment on here, the twitter addon indeed will not function nicely with the caching feature. Obviously because when cached, couch serves a html-created page of the template being called, rather than creating that html page on each request. This speeds up loading but means anything that may be different on that page (Any data that changes each day, or something like tweets, will not be updated) because the back-end isn't creating a new html page with the up-to-date data, thus you are left with out of date tweets and the newest ones only show when you save the template in admin (couch recreates the cached html page).

As far as I'm aware, no-caching a single template will NOT fix this issue, because the templates calling the twitter info from the no-cached template will still be showing the cached version of those templates. So, your html-created page within the cache does not re-call the template that isn't cached each time it is requested, thus the same problem persists.

To the best of my knowledge, this is how the couch cache works and so the solution won't fix the problem. I think your best option is to use a third-party javascript solution to implement your tweet functionality. Any javascript will (obviously) be the same on the cached version and will function the same, thus calling the data from twitter via the front-end rather than couch doing the work. I would recommend doing this over disabling the caching feature, because it increases performance a lot. You could turn up the rate at which couch automatically invalidates the cache and generates a new html page for its cache, but in my opinion there's a cut-off between how much it actually increases performance and how often it regenerates the cache.

Just my two-cents. Perhaps more like 5 :lol:
Image
I agree with @Bartonsweb - since the twitter feed is being shown in the footer (which would mean being shown in all templates), caching would need to be removed from all templates displaying the feed.

Using JS would be a better solution here.
KK wrote: Using JS would be a better solution here.


A full solution is added to Tips viewtopic.php?f=8&t=10535 Hope it helps the next guy. :D
Hi, I had a wee problem with the Latest Tweets addon.

It's working fine on a site that has been running for a few years. (http://noahsarkcaravanpark.co.uk/). However, I need to update the site, so I have made a new copy of it on my local xampp server. This server runs PHP 7, and I get the following errors. It was running Couch 2.0, and I have updated it to 2.1.

Code: Select all
Deprecated: Non-static method Tweets::tweets_handler() should not be called statically in C:\xampp\htdocs\noahsark\couch\parser\parser.php on line 481

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; TweetsEx has a deprecated constructor in C:\xampp\htdocs\noahsark\couch\addons\tweets\tweets_ex.php on line 15


It's not a huge problem, the server the site will sit on is on PHP 5.6, and I doubt they'll be updating it anytime soon. But I figured that the latest tweet addon maybe needs a bit of tinkering to get it working on PHP 7. Is this an easy fix, or is it not worth it?
Cheers, ewanmc
27 posts Page 3 of 3

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests