Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorbrady
    • CommentTimeJul 27th 2005 edited
     # 1
    This lets you add any HTML to the panel on the discussion page. Good for ads, quotes of the day, etc. Example: for google ads, you should be able to just reference a javascript file as the value for $HTMLToDisplay.

    <edited, see below>
    • CommentAuthorbrady
    • CommentTimeJul 27th 2005
     # 2
    tweaked a bit for clarity:

    /*
    Extension Name: Custom HTML Message in Panel
    Extension Url: http://lussumo.com/docs/
    Description: Adds Custon HTML to the panel
    Version: 1.0
    Author: BJ
    Author Url: http://lussumo.com/docs/
    */

    $MessageTitle = "My Title";
    $HTMLToDisplay = "My <i>HTML</i> message";

    if (in_array($Context->SelfUrl, array("index.php"))) {

    $Panel->AddList("$MessageTitle");

    $Panel->AddListItem("$MessageTitle", "</a> $HTMLToDisplay <a>", "" , "", $Position = "1", $Attributes = "");

    }
    •  
      CommentAuthorjsanders
    • CommentTimeJul 27th 2005
     # 3
    i see big things in your future, brady
    •  
      CommentAuthorlament
    • CommentTimeJul 27th 2005 edited
     # 4
    since this is the "official" post for this extension, could you provide examples of where in the code to put images that you want displayed, or text - for us non-coders? :) thanks!
    •  
      CommentAuthorjsanders
    • CommentTimeJul 27th 2005 edited
     # 5
    i'm not in a position to test this right now, brady, but why to do you have the tags around the variable?

    </a> $HTMLToDisplay <a>

    and lament,

    $HTMLToDisplay = "My <i>>HTML</i> message";


    just alter this bits in the quotes.

    (editied for lt's and gt's)
    •  
      CommentAuthornifkin
    • CommentTimeJul 27th 2005
     # 6
    I was just about to post that I played with it a bit too.

    &lt;?php
    /*
    Extension Name: Custom HTML Message in Panel (HEREDOC version)
    Extension Url: http://lussumo.com/docs/
    Description: Adds Custon HTML to the panel
    Version: 1.0
    Author: BJ
    Author Url: http://lussumo.com/docs/
    */

    if(in_array($Context->SelfUrl, array("index.php"))) {
    $Panel->AddList("htmlblock");
    $HTMLBlockTitle = "OMGWTF!";
    $HTMLToDisplay = &lt;&lt;&lt; ENDHTML

    &lt;p&gt;A BIG FAT BLOCK OF AD CODE COULD BE HERE!&lt;/p&gt;

    ENDHTML;
    $Panel-&gt;AddListItem($HTMLBlockTitle,"&lt;/a&gt;$HTMLToDisplay&lt;a&gt;","","",$Position="1",$Attributes="");
    }
    ?>
    •  
      CommentAuthorlament
    • CommentTimeJul 27th 2005
     # 7
    i'm a noob.. so do i just save this code and put it into the extensions folder?
    • CommentAuthorbrady
    • CommentTimeJul 27th 2005 edited
     # 8
    > </a> $HTMLToDisplay <a>

    because when you add something to the list, the Vanilla object wants to make it a URL. We don't want our batch of HTML to appear as a big link for this extension, so we </a> to keep us from w/in the tag and <a> so when the object tries to close it the rest of the page doesn't get jacked.

    in other words - it is a hack

    save it as CustomHTML.php, put "<?php" on the first line and "?>" on the last, and put it in your extension folder. Go in your admin section and enable the extension.
    •  
      CommentAuthorjsanders
    • CommentTimeJul 27th 2005
     # 9
    roger that, right on
    •  
      CommentAuthorlament
    • CommentTimeJul 27th 2005
     # 10
    nice! worked like a champ..
    •  
      CommentAuthorMark
    • CommentTimeJul 27th 2005 edited
     # 11
    Actually, you don't have to create a new list and add a list item.

    The Panel control has an "AddString" method that allows you to just dump a big string of anything into the panel, like this:

    $Panel->AddString("&lt;marquee>Weee!!!&lt;/marquee>");
    • CommentAuthorbrady
    • CommentTimeJul 27th 2005
     # 12
    AddString...

    WHO KNEW?! ;)

    Thx for the heads up, Mark.!
    •  
      CommentAuthornifkin
    • CommentTimeJul 27th 2005 edited
     # 13
    does $Panel->AddString() take any other parameters, like to sort where it falls in the sidebar?

    /* nw mark */
    • CommentAuthorjonezy
    • CommentTimeJul 27th 2005
     # 14
    you know i was thinking about control loading on the page and whether you could insert controls (at specific points) during the page_load event.

    and btw, marks page life cycle for this app is very similar to the asp.net page life cycle
    •  
      CommentAuthorMark
    • CommentTimeJul 27th 2005
     # 15
    right now there is a second parameter to the AddString method that is a boolean value indicating if the string should be added at the beginning or the end of the panel. If you add a string in one extension and then you add a string in another extension, it will load based on the order of the extensions being added to the page, I guess.

    I didn't think too much when making the addstring method. It was just a failsafe I threw in there for the hell of it. I guess I can make it smarter in coming revisions.
    •  
      CommentAuthornathan
    • CommentTimeJul 29th 2005
     # 16
    How about assigning 'weights' to the extensions, (or the extensions that load data inot the panel).

    Example of weights: -10, -9, -8, ..., 0, 1, 2, 3

    Lighter weights 'float' to the top and are exectued first, while 'heavier' weights sink to the bottom.

    Admins could order the extensions in anyway they wanted. i would recommend a drop down box, as user defined entires (text field) would require error checking.

    If no weights are assigned (0 by default), then they execute in alphabetical order.
    •  
      CommentAuthornathan
    • CommentTimeJul 29th 2005
     # 17
    Sorry, forgot to add, this should be added to core. I know this could be added as an extension, but I don't think it is practical to have an extension to manage the execution of extensions (unless that one is forced to load first ? )
    •  
      CommentAuthorMark
    • CommentTimeJul 29th 2005 edited
     # 18
    That's a great idea.

    I was thinking that the extensions form should change anyway - it's wayyyyy to bloated. I'd kind of like to make it a table and have the users able to move extensions up or down like you can move categories up or down.

    Want to add it to the enhancement list on the bugs page?
    •  
      CommentAuthornathan
    • CommentTimeJul 29th 2005
     # 19
    I forgot about the catagory listing (ajax). That would be heaps better than selecting it from a list.

    Just place them in order you want them to launch/ display, and then you are done.

    I will add this to the enhancement page (may need to apply for a wiki account), tomorrow, I am not home this weekend.

    Glad you like the idea.
    • CommentAuthortrabus
    • CommentTimeJul 29th 2005 edited
     # 20
    For those using this extension, if you need to add a stylesheet for the html you're inserting, you can add it by adding this line ($StyleSheetLocation is obviously the location of the stylesheet to add):

    $Head->AddStyleSheet($StyleSheetLocation);
    • CommentAuthorbrady
    • CommentTimeDec 9th 2005
     # 21
    If you use multiple extensions using this method to display HTML in the panel and you are having trouble getting them to show in the vertical order you would like, here's a trick - disable the extension above the one you want on top, then re-enable it. Now the one you just re-enabled should be on the bottom.
Add your comments
    Username Password
  • Format comments as