override/custom template functions

i have seen some discussion on overriding or customizing the template functions in the past but couldn't tell where if anywhere it left off.

i would like the ability to customize any of the template functions that emit html especially printPasswordForm. i don't want to call my own custom function because that would mean replacing all the calls to printPasswordForm and i would like something unobtrusive.

the discussion about overriding the template functions from the admin console was interesting but that post appears to be old and i don't know if it ever got anywhere.

what i have done and am curious to get feedback on is the following:

i have added the following to the top of the printPasswordForm in template-funcions.php
`

if (function_exists('customPrintPasswordForm')) {

customPrintPasswordForm($hint, $showProtected, $showuser);

return;

}

`

i have then copied the printPasswordForm function to my template's customfunctions.php file where i have made the updates in the html formatting i desired. in the future i can easily diff my customPrintPasswordForm with the latest Zenphoto printPasswordForm to see if i have introduced any undesirable behaviors. i can also easily disable the customPrintPasswordForm override/custom function by changing its name to something else or deleting it.

if all the print... functions had hooks in them like this i could customize them easily at my own discretion.

thoughts, suggestions?

Comments

  • What you have done constitutes the part of the discussion where it says one can instrument the core to look for plugins. Each instance would have to be done like this.

    Have you tried just changing the CSS?
  • acrylian Administrator, Developer
    btw, most print...functions already have a get...function for easy customizing. I was about to ask about css, you can do a lot of things with that, too. Unfortunatly I just discovered that the table setup uses some inline css, which will override any css file styling. Since this is only `text-algin: right/left` we probably should do this via classes in the future.
Sign In or Register to comment.