ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Is there a way an embed tag can increment the template hit counter?

July 15, 2008 12:47am

Subscribe [2]
  • #1 / Jul 15, 2008 12:47am

    Example:
    Two templates:
    (1) foo
    (2) bar

    http://yoursitename/foo

    in foo you have:
    {embed="bar"}

    The template hit count goes up for ‘foo’ but not ‘bar’.  Is there a way to have all embedded templates’ hit counters increment?

    ...

    I understand that in many cases, this would probably not be desirable.  So it should probably be a parameter of embed, i.e. {embed="bar" increment_hit_counter="true"}

    If I wanted to build an extension for something like this, is that even possible?  I don’t see a low-level enough hook that would let me inside the template tag parsing.  I was thinking if I could add custom code at parse time for “embed”.  I don’t know.

    Any thoughts?

    -Aaron

  • #2 / Jul 15, 2008 3:10am

    Ingmar

    29245 posts

    Using {embed} does not increase the hit counter as you have seen. Since it is most often used for parts of a page that are not called on their own, like headers, footers, common sidebars and the like, this behavior makes sense. I am not aware of a way to change that easily. Consider using “proper” templates and only embedding the common elements to get around that.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases