Override view on specific pages (embed external site, keeping elgg topbar only)

Hi guys,

I'm attempting to embed the elgg topbar in an external site. The idea being that the user can still access elgg functionality from an external site. The external site would also access the elgg user object to get a unique user ID for DB storage. 

I've been playing around with the code for a while and can't find a proper way to do this. 

One idea was to use the customhtml plugin. This allowed me to embed the external site somewhat. However, the plugin only allows the external code to appear within the document body. I need to:

  • remove everything elgg except for the topbar (no header [activity, discussion, groups], no footer, no css that sets the page width, etc.

I have attempted to override the following files:

  • views > default >page > layouts (created a new layout called maximal, outputs only the page body, however the Activity, Dicussion header is stil there)
  • views > default > css > elements > layout.php (set header css display to none. This works, but the header is hidden on all pages on the site)

Basically, I don't know how to define a "more global override" to be interpretted by elgg before it outputs the Activity, Dicussion header, and then, only on the specific external page.

Also, once I manage to override this view, I want to customise the elgg topbar on that page (no elgg logo, dashboard, etc. links + extra links) 

  • Side note, I have also attempted to do this the other way around, by creating an external php file that calls the needed elgg functions.

    This works more or less, however, for some reason, usersettings won't hide even if I call remove_menu_item ...I also feel that this approach might be a bit too "hackish".


    Simplified example:


    require_once(dirname(dirname(__FILE__)) . "/elgg/engine/start.php");

    //Disable unwanted elements in the elgg menu
    elgg_unregister_menu_item('topbar', 'elgg_logo');
    elgg_unregister_menu_item('topbar', 'dashboard');
    elgg_unregister_menu_item('topbar', 'administration');
    elgg_unregister_menu_item('topbar', 'usersettings');

    $topbar = elgg_view('page/elements/topbar', $vars);

    $messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages']));

    $body = elgg_view('page/elements/body', $vars);
    $footer = elgg_view('page/elements/footer', $vars);

    // Set the content type
    header("Content-type: text/html; charset=UTF-8");

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <?php echo elgg_view('page/elements/head', $vars); ?>
    <div class="elgg-page elgg-page-default">
    <div class="elgg-page-messages">
    <?php echo $messages; ?>

    <div class="elgg-page-topbar">
    <div class="elgg-inner">
    <?php echo $topbar; ?>

    <!-- external page embed -->

    <iframe src='index.html' style='position:relative;top:0px;left:0px;width:100%;height:700px;'/>

    <div class="elgg-page-footer">
    <div class="elgg-inner">
    <?php echo $footer;?>

    <?php echo elgg_view('page/elements/foot'); ?>







  • it seems you're trying for something similar to 
    http://elgg.org/ -- with it's global topmenu and the ability to move in/out of the community =>
            | Home | About | Blog | Services | Hosting | Community | Developers | Download |


  • Not exactly (I think). 

    If my live site looks like this:



    I'd like to be able to have this on an external page:



    Note how certain menu items are disabled on the external page. Basically, while the user navigates my site, I want them to stay connected to the basic elg functionality.

  • i kinda intentionally said " something similar to .. " ;-)
    you do want want somethwang similar, but with extras..
    the elgg.org topbar sorta disappears while in the @comm,
    which has it's own topbar menu..
    you want the connexn w/ yr @comm *all the time,
    while moving between the strict 'elgg' areas and
    other non-elgg areas of your whole setup.
    if this is so -- i am sure it can be done with some
    creativeness & imagination for the initial design of navigation.
    i'll be doing this after/ when i have set up my own littwle
    embracheee site for proper elgg tech & prods integration..
    if i only had more time.. only time...;-oO one of these days;-O

  • Hehe...yeah...if I only understood the model more, I'd get this done. I've been hacking at it for 3 days straight and am at my wit's end right now.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking