Reordering Plug-ins on show.php page

I see this call: <?php echo plugin_append_to_items_show(); ?>

It displays a number of elements within each artwork page: social bookmarkings, my notes, and my tags (in that order). I'd like to change the order. What page controls that order?

Unfortunately this is not currently possible to do while using plugin_append_to_items_show(). The only alternative would be to remove that function and replace it with each individual plugin's hook in the order you would like.

That would be fine. What is that hook for My Notes, My Tags, and for Social Bookmarking?

The are:

<?php echo my_omeka_embed_notes_and_tags(); ?>

and

<?php echo social_bookmarking_append_to_item(); ?>

Don't forget, if you install/want to use any other plugins that display information on the items/show page you'll need to add their hooks as well. For most plugins they are relatively easy to find. Near the top of the plugin.php file you should see a list of plugin hooks. Look for one that starts with:

add_plugin_hook('public_append_to_items_show',

the hook should be defined immediately after the comma; e.g. for MyOmeka it reads:

add_plugin_hook('public_append_to_items_show', 'my_omeka_embed_notes_and_tags');

Hope this helps.

Thanks Ken.

It's working and I can reverse the order now. Thx.

However, I'm noticing a problem in Safari. In that browser the social bookmarks are showing but not the notes and tags. It did this before I changed the hooks (when I just had <?php echo plugin_append_to_items_show(); ?>). And it's still doing it when I use code for embed notes and tags and code for social bookmarking).

Hmm. Does the same happen in Chrome? (I'm assuming yes, but I just want to double check).

What versions of Omeka/MyOmeka are you running?

Don't have Chrome but I can get it.

I'm using 0.3.2. Now, I just discovered I hadn't configured that plugin. So I did but it still isn't working right.

Sorry, and what version of Omeka?

Also, are you loading jQuery for anything? MyOmeka runs on Prototype and you'd need to run jQuery in noconflict mode for MyOmeka to work properly.

Yes, I'm using jQuery. How do I run it in nonconflict mode? Using Omeka 1.2.1

The jQuery site probably does a better job than I could in explaining how to run noconflict mode:

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

The short answer is you'll need to load jQuery.noConflict() and also replace $ with jQuery in any other scripts you run.

Ken, one of the things I can do, according to that page, is reorder the list of libraries. Where is Prototype called?

Prototype gets loaded as part of the default javascripts, in

<?php echo js('default'); ?>

which you can find in common/header.php.

FYI, in the upcoming 1.3 release of Omeka, Prototype will no longer be part of js('default'). It will however still contain the library which can be loaded by calling

<?php echo js('prototype'); ?>

As a project we've moved toward jQuery, but some plugins (such as MyOmeka) still require Prototype. When these plugins will be upgraded to work with jQuery isn't clear just yet.

I'm afraid I'm going to need a little help on this one.

I went to the page you linked to. I first tried the third choice. I placed my calls to jquery and the hide/show js I was using with it above <?php echo js('default'); ?> and I used this script below it:

<script>
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery("div").hide();
     });

     // Use Prototype with $(...), etc.
     $('someid').hide();
   </script>

That didn't work. My whole page went black (which is the color of my body). So all the content area was missing.

So then I tried the second choice. Kept my jquery and js calls below the echo js('default') call. But that made all the content I wanted to hide with the jquery/js script show up. And the tags and notes still wasn't showing up.

Here's the URL for the page: http://americanartinvites.com/omeka/items/show/18# (all that content below the image and below each header should be hidden until you click on the header for each section.

<?php echo js('default'); ?>

<script type="text/javascript" src="/omeka/themes/fromscratch/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/omeka/themes/fromscratch/js/slicker.js"></script>

<script>
     jQuery.noConflict();

     // Put all your code in your document ready area
     jQuery(document).ready(function($){
       // Do jQuery stuff using $
       $("div").hide();
     });

     // Use Prototype with $(...), etc.
     $('someid').hide();
   </script>

Am I supposed to be doing anything additional when I use the second choice?

OK, before we go any further, let's confirm this is in fact a conflict with jQuery. Could you try loading the page without jQuery and your other script, loading just js('default') and tell me if MyOmeka appears?

Okay, with jquery deleted it's still not loading in Safari. BUT I did notice that today, before removing the jquery My Notes and My Tags weren't showing up in Firefox either. Yesterday, they were. Today, with our without jquery calls, they aren't.

Hmmm, and just to confirm you still have both

<?php echo my_omeka_embed_notes_and_tags(); ?>

<?php echo social_bookmarking_append_to_item(); ?>

?

Additionally, Notes and Tags will not appear if there is not a user logged in. This might explain why it suddenly has disappeared in Firefox. Can you also confirm you are logged in in Safari?

I realize I'm kind of interrupting a specific query here, but figured since this started as a post about re-ordering plugins, it would be the best place to post. My question is this. Understanding that I can manually call plugins in the order I prefer, is it possible to still use plugin_append_to_items_show() for remaining plugins? In other words, is there some way to detect plugins that have already been called and skip them when using plugin_append_to_items_show()?

PS, re:outtacontext's issue: I have noticed that the MyOmeka dashboard area does not react well to jQuery, so I avoided that conflict by only using jQuery in specific pages (for me, index and items/show), but have not seen any problems with jQuery interfering with MyOmeka Tags and Notes.

Ken, well why didn't you tell me so!!! <grin>

I wasn't logged into Omeka on Safari. And, today, I wasn't logged on Firefox. Now that I'm logging in, without changing the code it's working fine in both Firefox and Safari. The My Tags and My Notes is showing up!

@ebellempire Unfortunately, no. If you were to call plugin_append_to_items_show after manual calls it would repeat the ones you called manually. We do realize there needs to be a better way to handle plugin display, but have yet had the time to improve it.

@outtacontext Of course I managed to skip the most obvious answer. Sorry about that. However, as ebellempire notes above, you likely will have conflicts somewhere on the site, likely on the MyOmeka Dashboard or Posters page. I'd still recommend loading jQuery nonflict.

After you load 'default' and your version of jQuery then add:

<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
</script>

Then load slicker.js. However, in the slicker.js change all the $ to jQuery.

That's it-good luck!

Thanks Ken. When you say in the slicker.js change all the $ to jQuery, do you mean when I see an "$" replace it with "jQuery"?

Yes, exactly.

Seems to be working! Thanks.

Hi, I have been using the instructions given by Ken above to manually call plugins in the item show.php page.

These indications seems to work fine for all the plugins that I have installed. However, for the Zoomit plugin I cannot find the hook needed. Could someone give me some ideas, please?

I would really appreciate some help here.

Thanks

For the ZoomIt plugin, you'd probably have to do something like this:

$zoomit = new ZoomitPlugin;
$zoomit->append();

Thanks John, it worked fine for me!

I have tried to do something similar for the Html5Media plugin but didn´t work.

$media = new Html5MediaPlugin;
$media->append();

I didn´t expect that to work as I cannot see in Html5MediaPlugin.php the functions PublicAppendToItemsShow or append.

I supposed these functions have to be declared and make reference to the type of media file (video or audio) somewhere, but I´m a bit loss.

Could you please help me with that?

Thanks,
Daniel

My apologies John, I didn´t realize that this plugin doesn´t need to be called in any way. It only needs the piece of code that check if item has associated files. I had omited that code testing with different types of items in my items/show.php