Форуми / Cotonti / Extensions / Possible to look for tag before code execution ?

JonnyM
#1 29.04.2009 04:48
Hi,

Haven't coded anything Seditio related for some time now and definitely never done anything for Cotonti. But I figured I'd give it a go now.

So, I have this plugin that will display an image, anywhere on the website, where it finds a tag like {DISPLAY_ME_HERE} .
The problem is, whenever the code is generated for display, an counter increases. So I can't keep generating the code for each time any page loads and then just display it if a tag happens to be found.
What I need is a way to know IF the tag exists on the page being loaded ( in any of the .tpl files being used), THEN generate the code for display.
I'm not really sure how I would go about doing this.
I would appreciate any help and/ or pointers in the right direction.

Thanks,
JonnyM
Lombi
#2 29.04.2009 05:06
Will this be a banner rocket upgrade?

Guess simplest way would be to make a list of templates on each location, then parse the three (header-whatever-footer) to see if it's included. If yes, up the counter and run the code, if not, do nothing.
<a href="http://www.domenlo.com">Surreal Art</a>
Elgan
#3 29.04.2009 06:10
ive often thought about this in plugins.

would maybe save some code, time etc. Like for example id like to be able to produce lots of info and tags that were placeable on index or whatever. however i dont like to cause that overhead.

so maybe if(tag exists)

probably not so difficult to check.
Kilandor
#4 29.04.2009 06:21
Its easy to check, just read the file. But as elgan said this could and likely would create lots of overhead. The 1 and only solution I could see to something like this is creating a system, to cache tags in TPL, but this seems like alot of work.

Though there could be some gains for it with a re-design, as in some areas queries could be reduced I"ve thought of that myself, in some areas why have all these tags working to be built then never used, (wasted resources)
Elgan
#5 29.04.2009 22:08
# Kilandor : Its easy to check, just read the file. But as elgan said this could and likely would create lots of overhead. The 1 and only solution I could see to something like this is creating a system, to cache tags in TPL, but this seems like alot of work.

Though there could be some gains for it with a re-design, as in some areas queries could be reduced I"ve thought of that myself, in some areas why have all these tags working to be built then never used, (wasted resources)

i agree, so maybe its worth discussing and thinking more about some sort of skin tag cache system.