Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 10

6apxatCurtisOdenconnectrleafmonsterperegrinewhu606 +4 guests

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

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

  • Posts: 755
    LOL :D I liked there navigation ^^
  • Posts: 755
    Ehmm... just found out there is something already implemented to use an external footer.... but how do I use it?
  • Posts: 921
    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.
  • Posts: 755
    Ok tnx... it would be nicer if there was a RemoveControl opposed to the AddControl function :D
  • Posts: 4,883
    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);
  • Posts: 921
    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.
  • Posts: 4,883
    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.
  • Posts: 921
    Point taken.
  • Posts: 4,883
    For the record, I've added some remove methods to the dev version after reading this discussion...
  • Posts: 755
    Nice :)
This discussion has been closed.