Support » Plugins » [Plugin: pb-embedFlash] Automatically open on page load

  • I am successfully using the [Plugin: pb-embedFlash] from within a post to load a html page containing a slideshow, using the shadowbox feature. I would like to automatically load an html page also containing a slideshow from a wordpress page link.

    Is this possible and if so how? Can i activate it via javascript by editing the html of the page using the wordpress “write page” function.

    Many thanks

    Martin

Viewing 15 replies - 1 through 15 (of 32 total)
  • Do you want to open the shadowbox automatically on page finnished loading or open shadowbox when clicking on the page link (instead of loading a page)?

    To 1.: This can be made by adding JavaScript to your page. When I’m back home (tomorrow), I could give an example.

    To 2.: This is a bit more tricky because you have to edit the template files. You need to create the box’ content manually and add the “page” link to the page list/bar. pb-embedFlash cannot help here.

    Thread Starter martinbennett

    (@martinbennett)

    The best solution or more elegant would be the second one. But if its not possible it would also be ok to load the shadowbox overlay after the page link had finished loading.

    Many thanks

    for your help

    I suggest to write a dummy post with the [flash …] you wish to use. Open the blog post and copy the link generated for Shadowbox:
    <a class="shadowbox" ... rel="shadowbox..." href="http://...">

    Edit your template file and paste the code where you wish.

    And don’t forget to check the pb-embedFlash option page if “Load Shadowbox by default even if there is no flash content displayed […]” is checked.

    For further help I need a link to your blog. 🙂

    Thread Starter martinbennett

    (@martinbennett)

    i tried your solution but i get errors. or nothing happens. (i must admit i am no programmer!)

    i created a .php page for my wordpress page link called overview.php and set up the page Over to use this template. And inserted the shadowbox code into it. But no popup layer…

    My blog url is http://www.blog.martinbennett.com/
    and the page link i want to call the html flash file from is http://www.blog.martinbennett.com/overview/

    I hope you can help

    Many thanks

    Martin

    Using the second solution you don’t have to add a page link in the admin control panel but directly in your template file. I’ll take a look on it the next days. A bit busy at the moment.

    I’ve installed and activated. In the wp-admin under Options I have the pb-embedFlash page. But for Write or Manage I don’t have any tools to do the tag generation. Is it because I don’t have the tinyMCE or other plugins?

    Yes, you’re right. That’s why it’s called “TinyMCE popup” :).

    Thread Starter martinbennett

    (@martinbennett)

    Hello
    Dont want to be pushy but was wondering if you had any time to look into the page link problem?
    Many thanks

    Martin

    <li class="page_item">
    	<a href="http://blog.martinbennett.com/wp-content/uploads/overview/" title="Overview" rel="shadowbox;height=900;width=1000">
    		Overview
    	</a>
    </li>

    This is the code to use. It should be place after wp_list_pages(...) inside an ul tree. I found it three times on your page. (page list above your posts (maybe header.php), navigation (sidebar.php) and in your footer region (bottom.php/footer.php). Maybe you want to change width&height.

    If you do so, you should delete the page link “Overview” in your admin panel.

    Thread Starter martinbennett

    (@martinbennett)

    Many many thanks it works a treat.
    Ill buy you a beer

    martin

    That pleases me! Thanks for your donation!

    Thread Starter martinbennett

    (@martinbennett)

    In your very first response you suggested that it was easy to implement a javascript to automatically load shadowbow / pb-embedflash. I would like to set up a splash page that automatically loads a jpeg. Could you help me with the code?

    Many thanks

    Martin

    The Shadowbox FAQ knows it :). But as of I’m not using the latest version, most of the content cannot be applied to my plugin.

    But the following code from the FAQ should work:

    <script type="text/javascript">
    var openShadowbox = function(content, player, title){
        Shadowbox.open({
            content:    content,
            player:     player,
            title:      title
        });
    };
    </script>

    Thread Starter martinbennett

    (@martinbennett)

    i have tried to get the autoload function to work but with no sucess

    <script type=”text/javascript”>
    var openShadowbox = function(content, player, title){
    Shadowbox.open({

            content:    ‘http://www.martinbennett.com/uploads/portfolio/index.html&#8217;,
    player:     ‘html’,
            title:      ‘Martin Bennett – Photographer’
        });

    };

    </script>

    i placed this in the header.php of my template is that correct?

    Any help would be apreciated

    Many thanks

    Martin

    Maybe I was a bit unclear. The following script should be copied “as is” to your header.php:

    <script type="text/javascript">
    var openShadowbox = function(content, player, title){
        Shadowbox.open({
            content:    content,
            player:     player,
            title:      title
        });
    };
    </script>

    Afterwards, you can use the function to load something:
    openShadowbox('http://www.martinbennett.com/uploads/portfolio/index.html', 'html', 'Martin Bennett - Photographer');

    But how should the parser know, when exactly to load the function. Well… that’s really a bit tricky.

    function callOpenShadowbox() {
      openShadowbox('http://www.martinbennett.com/uploads/portfolio/index.html', 'html', 'Martin Bennett - Photographer');
    }
    
    if(window.onload) {
      var temp = window.onload;
      window.onload=function(e) {
        temp(e);
        callOpenShadowbox();
      };
    }
    else{
      window.onload=function(e) {
        callOpenShadowbox();
      };
    }

    The window.onload method can only be applied once, so we need to re-apply the old script (load the Shadowbox script) and add the new script (open the box directly onload).

    I couldn’t test anything yet, but basically, the code should work.

    — below this, there’s a bit offtopic stuff —

    Everything would be alot easier, but Microsoft does not implement the standard way “addEventListener” and has its own function “attachEvent”. Loading only two scripts, it would a bunch too much code to do it the “nice” way:

    /* for Mozilla/Safari(?)/Opera9*/
    if (document.addEventListener) {
      document.addEventListener("DOMContentLoaded", init, false);
    }
    
    /* for Internet Explorer */
    /*@cc_on @*/
    /*@if (@_win32)
      document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
      var script = document.getElementById("__ie_onload");
      script.onreadystatechange = function() {
        if (this.readyState == "complete") {
          init(); // call the onload handler
        }
      };
    /*@end @*/
    /* fallback for other browsers */
    window.onload = init;

    (init = function to load)

    See? 🙁

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘[Plugin: pb-embedFlash] Automatically open on page load’ is closed to new replies.