Get some troubles with CSS

Hi everyone.

I have some troubles with a CSS.

I design a simple html with a css file using <link href="mycdd.css" media="all" rel="stylesheet" type="text/css" />. Everything works perfectly .

Then I moved the css to my plugin and  I extended the elgg.css using: elgg_extend_view('elgg.css', 'plugin_name/mycdd');

But my css has not effect on my elgg installation even when I flush the caches. Moreove when I edit elgg.css file from my elgg data directory I can see my custom css in it. 

I dont know what's wrong

Best regard.

  • elgg_extend_view('elgg.css', 'foldername_in_mod_pluginname_views_default_where_your_file/mycdd.css');
  • yes I did it 

    elgg_extend_view('elgg.css', 'plugin_folder_name/mycdd.css');

    The folder_name_in_mod_pluginname_views_default_where_my_file is locates has the same name as my plugin folder name 'plugin_folder_name'

  • I did it before my post... But it is not working I dont know why...

    • The server's caches
    • The browser's caches
    • CDN cache (e.g. Cloudflare etc)

    There's one trick:

    1. Go to Administration -> Advanced settings
    2. Uncheck Use simple cache Use system cache Compress JavaScript and Compress CSS
    3. Save
    4. Now flush the caches and check your site
    5. Turn on all settings again if all works

    If don't work then see on above tips about caches.

  • And keep in your mind that you plugin must be at the bottom after all another plugins on the Plugins' page and your extended view (elgg_extend_view('elgg.css', 'plugin_folder_name/mycdd.css');) must be at the bottom after all another extended views in start.php of your plugin.

    In the last case you can use also:

    elgg_extend_view('elgg.css', 'plugin_folder_name/mycdd.css', 1000);

    w/o moving your code

  • With

    elgg_extend_view('elgg.css', 'plugin_folder_name/mycdd.css', 1000);

    you would need to place mycdd.css at

    mod/plugin_name/views/default/plugin_name/mycdd.css

    The paths in elgg_extend_view are always relative to the views/default folders (either within plugins or of Elgg core).

    After changes, flush the Elgg cache (or keep caching disabled during developing).

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