Adding images into custom_index

I've got my custom index page set through the included plugin, but I have a large empty box on the right side. I want to put clickable image links in that box for some of my partners & advertisers. My problem is that I'm still new at php and have no clue how I'd edit that box. I've tried inserting html into the php in a few different places but the image always shows up at the top left of my page instead of the box. Any help is appreciated

  • DOH...forgot to mention. I'm on 1.8. Website is www.hometown-directories.com. You can see the empty box on the right side there

  • My guess is that you got the box by modifying custom_index/views/default/page/layouts/custom_index.php, right?

    You can add a widget (with title text) by adding the following code there:

    <?php
    // right column

    // a view for plugins to extend
    echo elgg_view("index/righthandside");

    $infobox = 'Text shown in right column widget.';
    $infobox .= '<img src="./frontpage_image.jpg" alt="Frontpage_Image">';

    echo elgg_view_module('featured',  elgg_echo("Title of right column widget"), $infobox, $mod_params);

    This also allows you to add an image to this widget by the line

    $infobox .= '<img src="./frontpage_image.jpg" alt="Frontpage_Image">';

    Of course, you could also add more images, text etc. by adding the corresponding code accordingly (using the ".=" operator to add more to the $infobox variable). The code on the right hand side of .= is html, so you could also add an link to the image. The image file frontpage_image.jpg would have to be put in the Elgg root folder to be found in the above example, but you could put the image file(s) anywhere else, too. Of course you would need to adjust the path then.

  • No I haven't modified that file yet. I just activated the custom_index plugin and it layed out like that for me. I'm not sure where to work the coding in. No matter where I try to put it, the pic always ends up at the top of the page or the bottom

     

  • Where have you added your modifications then?

    In the file custom_index/views/default/page/layouts/custom_index.php there's the comment line

    // right column

    Below this line the output of the right column is defined. Each line with a "echo" command will output something. The output will be in the same order as the corresponding echo lines.

    If you added your code somewhere else, the output most likely is not added to the main content section of the index page at all but added for example to the page header or footer and therefore appearing on top or below the content of the index page.

  • That's just it. I've added nothing, just activated the custom index plugin. It put out a page that I'm happy with, it just has a large empty box to the right. 

    Now, when trying to insert that code, the box remains empty. I've tried adjusting it to read the full url of the pic, and I've tried dropping the pic into different folders and the root :( It just never shows up in the box

  • Then I think the box is added by another plugin. Most likely another plugin completely overrides the custom_index/views/default/page/layouts/custom_index.php view. This means that any changes you make in this file are currently not in use at all.

    I can't say which plugin might interfere, but you might be able to find it on your own. It surely is a 3rd party plugin. I guess the empty box means the developer of the plugin has prepared the view for adding some content into this box though it's empty by default. Maybe you can add content via the plugin settings page of this plugin or you would be able to do it by modifying the corresponding view of this plugin ( for example plugin_xxx/views/default/page/layouts/custom_index.php).

  • You,sir, are genius. Or I'm getting old and missing a few screws. I had Easy Theme activated. Once I deactivated that, it popped right up!

    Thanks a ton for all the troubleshooting!

  • one more question if I may...I'm attempting to put my header back to the top. When I disabled the other theme I lost a 997x225 header banner :( 

    I've found the section of code where the top box is, but I'm not sure of the exact name of that location. I'm assuming it'd be the same clip of coding just in a different location

     

  • If you want to keep that theme, you have to modify the mod/easytheme/views/default/page/layouts/custom_index.php file with the same modification Then enable the plugin and your all set

  • Again, thanks a ton! :) I just couldn't lose that header

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