On Sat, Apr 16, 2011 at 1:47 PM, cricket <zijn.digi...@gmail.com> wrote:
> On Fri, Apr 15, 2011 at 3:37 PM, Brian Sweeney <eclecticg...@gmail.com> > wrote: > > On Fri, Apr 15, 2011 at 2:47 PM, cricket <zijn.digi...@gmail.com> wrote: > >> > >> What the heck is this?! > >> echo "<?php $product_id = $product_id; ?>"; ?> > > > > Oh, and I just wanted to say that I was pretty sure this little snippet > > would get that kind of reaction. Nice to know that you care enough to > point > > out the insanity of it all ;) > > Shouldn't it at least have the first one escaped? > echo "<?php \$product_id = $product_id; ?>"; > You are correct. A typo on my part. > Not that I'm encouraging this sort of thing. ;-) > Of course not! ;) > For the example given, a general product list, another solution would > be to go with full on view caching and use javascript to read the > cart's product ids and change a class on each product's element block. > Given that a flag like this is rather non-critical I don't see any > harm in having (potentially disabled) JS handle it. > I have considered this as a solution, it would make the view much easier to handle. I try to avoid JS-only solutions for general-purpose web sites if possible. I may still go this route, but I wanted to explore the possibility of caching with the server-generated user content a little bit more. If the list of products were solely the contents of the cart, OTOH, > the best answer would be no caching at all. > I can't suggest more than that, though, without a clearer > understanding of your specific views. The page is more like a list of all products in a category, with an add-to-cart option next to it. This is a convenience feature. The user can also add an item to their cart from the item detail page. I have another page that lists the items in the cart and this page is not cached. I think the discussion has given me enough food for thought. I've already made some significant improvements on the site that help with the responsiveness. The controller data caching has helped. And I found that none of the content had expires headers (yikes). Speaking of expires headers ... if a view is cached does cake return an expires header for it? The content does have an expiration so it seems like this would be plausible. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php