Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Theme Helper Plugin Possibilities

R_JR_J Ex-FanboyMunich Admin

I've seen other software where it is possible to add HTML comments to the output, that show which file has created that output. That would be a great help for designers. Could anybody think of a way how that could be achieved? For example a way to replace the Render function, but I do not even Know if every output is initiated by the render function...

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    This is an interesting idea.

    And that is all I have to say about that.

    Ok, I lied, I will say that plugins aren't required to output content via the render function.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

    What about something along the lines of:

    public function Base_Render_Before($Sender) {
        echo '<!-- ' . $Sender->View . '-->';
    }
    

    I haven't tested it out so it's just a shot from the hip :)

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • Options
    R_JR_J Ex-Fanboy Munich Admin
    edited November 2013

    @Kasper said:
    What about something along the lines of:

    public function Base_Render_Before($Sender) {
        echo '<!-- ' . $Sender->View . '-->';
    }
    

    I haven't tested it out so it's just a shot from the hip :)

    I had a hard job not to start hysterically giggling when I've seen that, because it looked as if the solution could be so simple, but it is not. I've not completely understook the Render method, but it is called not often enough for what I'd like to see.

    What I think what could be super useful would be something like this

    < !-- start: /applications/vanilla/views/index.html -->
    ...
       < !-- start: /applications/vanilla/views/helper_functions.html -->
    ...
       < !-- stop: /applications/vanilla/views/helper_functions.html -->
       < !-- start: /applications/vanilla/views/comments.html -->
          < !-- start: /applications/vanilla/views/comment.html -->
    ...
          < !-- stop: /applications/vanilla/views/comment.html -->
       < !-- stop: /applications/vanilla/views/comments.html -->
    ...
    < !-- stop: /applications/vanilla/views/index.html -->
    

    That way you could see what view has to be overwritten to achieve some special changes.

    I already thought of a custom "developer theme" that is just a copy of the normal theme but with an additional <?php echo start filename ?> before the first line and an <?php echo stop filename ?> at the end.

  • Options
    KasperKasper Scholar of the Bits Copenhagen Vanilla Staff
    edited November 2013

    Ah, I see. What you have in mind is indeed slightly more complicated than my very simplistic "solution" :) However, all the Gdn_Controller::Render() function does, is take a master view and view, mash them together and render the output. Stuff like helper_functions.php and view partials are included in the views themselves and are therefore not handled directly by Gdn_Controller::Render().

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Yepp, slightly more... ;-)

    I did the most simple thing and altered the files. I could not add a "closing tag" but it should be enough without it: http://www.vanillaforums.org/addon/themerstheme-theme

Sign In or Register to comment.