Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Adding controls... got that... but how to remove them?

edited November 2005 in Vanilla 1.0 Help
Well... the topic title says it :P I know how to add controls to the page object, but how do I remove them?

I've written an extension that adds a HTML footer. But how can I remove the original footer? Any ideas?

Here's my extension (didn't add it to the extension list, cuz I want to be able to remove the default footer object):
Custom Footer

(omg ^^ it took me more time to write the html template than the extension :P)

Comments

  • omg ^^ righto. http://www.advice-landforsale.co.uk/
  • LOL :D I liked there navigation ^^
  • Ehmm... just found out there is something already implemented to use an external footer.... but how do I use it?
  • Each control class (Menu, Panel, Page, etc.) stores everthing in an array of that class. Just loop through the array of the control you want to edit and edit out all the elements you don't want in there. That's what I did with the Panel and Menu controls in my page manager extension, so if you want an example you could take a look at that.
  • Ok tnx... it would be nicer if there was a RemoveControl opposed to the AddControl function :D
  • MarkMark Vanilla Staff
    technically it would be easier to do a cheat in an instance like this.

    The foot control is held in a $Foot variable and it is added to the page object *right* after the extensions are included in the page. So, you could just re-assign that variable to your foot control and then let the app do it's thing:

    From appg/init_internal.php:
    
    // INCLUDE EXTENSIONS
    include(agAPPLICATION_PATH."appg/extensions.php"); // <-- Re-assign $Foot in here
    
    // Add the end of the page
    $Page->AddControl("Foot_Render", $Foot);
  • NickENickE New
    edited November 2005
    The only problem is that another extension included right after yours might attempt to use the Foot class, in which it would come up with a fatal error. It might be wiser to add a control the page head and in the Render() function take out the foot control, so it would be executed after all other code.
  • MarkMark Vanilla Staff
    edited November 2005
    well, as long as your substitute object followed the same interface, there wouldn't be any errors. You could even just extend the foot class and then override the render method.
  • Point taken.
  • MarkMark Vanilla Staff
    For the record, I've added some remove methods to the dev version after reading this discussion...
This discussion has been closed.