Custom icon PNG not showing up on pages?

Mitch Smith Posted in Component Development 7 years ago

http://gingkos.net/ossn/components/Games/images/games.png

I added that to the ossn_com.php

$icon = ossn_site_url('http://gingkos.net/ossn/components/Games/images/games.png');

because the icon wasn't showing up with the directory it had that didn't exist in the addon in the first place.

Replies
us Mitch Smith Replied 7 years ago

Omg! Thank you so much Homelancer. You saved sooo much frustration, now I can study the notes you included, & which will teach me so much more. I have so much to learn in PHP coding... Very grateful!

> Fun Fact:
>
> You were also the 9th comment, & in numerology the number
> "9" is the number of completion. What a synchronicity!

ph Rally Homelancer Replied 7 years ago

Created a fork and fixed the component. See the comments on the pull request/source code.

us Mitch Smith Replied 7 years ago

I don't understand what I am doing wrong.... This is complex. I added the CSS folder, & attempted to externalize it 2 different ways, & I even tried adding the code ~

    .menu-section-item-weather:before {
    content: "\f185" !important;
}

to the CSS file in the new CSS folder....

I have to be close to getting it right, What am I doing wrong now? Lol.

UPDATED REPO -

German Michael Zülsdorff Replied 7 years ago

Don't worry, I'm used to work in confused/confusing environments ... :)

But back to your issue: I had a look into your repository, and in fact there IS no icon css!
Thus,

  • have a look at the helloworld component again how to include some css in general
  • get one of those examples from the theme file, change it accordingly and add it to your component's css file. On doing that you can move the iframe css to that file, too. Because that's the right place - talking about component conventions.
us Mitch Smith Replied 7 years ago

(Click for Repository)

Okay, There is the link. ^

EDIT: Oops I just noticed I might have confused you a bit. I was trying to add an icon to 2 other components someone else's component, & my component. I accidentally posted 2 totally different snippets of code for 2 separate components. Although the same question still applies, & is still unresolved.

German Michael Zülsdorff Replied 7 years ago

Please upload your code to github.com.
This way it's much easier and transparent to others which way a problem like that can be resolved

us Mitch Smith Replied 7 years ago

> Yep,
>
> but besides of all that this method of displaying a menu icon is
> outdated (or at least not compatible with the current core theme)
> anyway.
>
> It would need some extra css instead. See
> https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/v4.x/themes/goblue/plugins/default/css/core/default.php
> (line 1213 and below) for examples and choose a meaningful icon for
> your component from the font-awesome pool.


Zet, Could you elaborate a bit more?


So, I have added this to the CSS

    .menu-section-item-weather:before {
    content: "\f185" !important;
}

but it still doesn't show?

do I have to edit the ossn_com.php in the plugin to get it to function properly. Surely I am missing something because it still isn't functioning.


This is my ossn_com.php code. ~

<?php

function weather_init() {
    ossn_register_page('weather', 'weather_pages');
      if (ossn_isLoggedin()) {       
        $icon = ossn_site_url('components/weather/image/weather.png');
        ossn_register_sections_menu('newsfeed', array(
            'text' => ossn_print('weather'),
            'url' => ossn_site_url('weather'),
             'icon' => $icon,
         'section' => 'links'
            ));     
    }
}


function weather_pages($pages) {

 if (!ossn_isLoggedin()) {
            ossn_error_page();
   }
$title = ossn_print('weather');
   $contents['content'] = ossn_plugin_view('weather/weather');
   $content = ossn_set_page_layout('contents', $contents);
   echo ossn_view_page($title, $content);
}

ossn_register_callback('ossn', 'init', 'weather_init');
German Michael Zülsdorff Replied 7 years ago

Yep,

but besides of all that this method of displaying a menu icon is outdated (or at least not compatible with the current core theme) anyway.

It would need some extra css instead. See https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/v4.x/themes/goblue/plugins/default/css/core/default.php (line 1213 and below) for examples and choose a meaningful icon for your component from the font-awesome pool.

ph Rally Homelancer Replied 7 years ago

Or

$icon = ossn_site_url("components/Games/images/games.png");

if your Ossn site URL is http://gingkos.net/ossn/

ph Rally Homelancer Replied 7 years ago

ossnsiteurl() returns your site URL like http://gingkos.net/

You only need to add the rest of the URL like:

$icon = ossn_site_url("ossn/components/Games/images/games.png");