Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-01-14 09:11:28
- eyesolation
- New Member
- Registered: 2005-10-18
- Posts: 4
Overwriting existing taghandlers?
i want to modify the txp:thumbnail function to output a slightly different html.
from what i could discover, /publish/taghandlers.php’s thumbnail() function has
html attributes like onclick=“window.open(…)” hardcoded, so i will somehow
have to overwrite this function with my own implemenation i guess? is there any
clean plugin-paradign compatible way to do that? or do i have to modify the
original source?
creating a thumbnail function of my own like myown_thumbnail() is no option for me,
since i would have to modify all calls to the original thumbnail function to call my function
instead.
or am i just confused and missed a completely different easy way to do this?
i’d appreciate any help.
Offline
Re: Overwriting existing taghandlers?
Everything that is in taghandlers.php is called by using the corresponding tags. It’s therefore easy to overwrite this function by writing your own plugin. To overwrite all calls you just have to use the corresponding tag in your page template or article form, as it is with all the tags in taghandlers.php (i.e. <code><txp:myown_thumbnail /></code>).
Offline
#3 2006-01-14 14:39:36
- eyesolation
- New Member
- Registered: 2005-10-18
- Posts: 4
Re: Overwriting existing taghandlers?
that’s exactly what i don’t want to do, because i already have a number of plugins in use that call the thumbnail function internally (like hak_article_image). if i wrote a myown_thumbnail function i would have to adjust all those plugins to call my function instead of the original one. (not exactly what i call extensible)
Last edited by eyesolation (2006-01-14 14:40:43)
Offline
Re: Overwriting existing taghandlers?
Cool languages allow function overloading and function redefining. PHP is not a cool language.
Since you cannot redefine existing functions, you’re stuck with patching the taghandlers.php.
Edit: Okay, PHP5 apparently does allow some overloading. Still not helpful here. <code>=^.^=</code>
Last edited by takshaka (2006-01-14 18:26:47)
Offline
Pages: 1